/**
 * Document Viewer - Základné štýly
 *
 * Spoločné štýly pre všetky typy viewerov (PDF, Word, Excel)
 *
 * @package SRZ_Rada
 * @since 1.0.0
 */

/* ==========================================================================
   CSS Custom Properties (predvolené hodnoty)
   ========================================================================== */

.srz-document-viewer {
	--doc-primary: #28c2bb;
	--doc-primary-dark: #20a39e;
	--doc-primary-light: #2dd4cc;
	--doc-primary-lighter: #5ce0da;
	--doc-primary-alpha20: rgba(40, 194, 187, 0.2);
	--doc-primary-alpha30: rgba(40, 194, 187, 0.3);
	--doc-primary-alpha50: rgba(40, 194, 187, 0.5);

	/* Neutrálne farby */
	--doc-canvas-bg: #525659;
	--doc-content-bg: #ffffff;
	--doc-status-bg: #f8f9fa;
	--doc-status-text: #6c757d;
	--doc-white: #ffffff;
	--doc-border-radius: 8px;
	--doc-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	--doc-shadow-light: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   Hlavný kontajner
   ========================================================================== */

.srz-document-viewer {
	display: flex;
	flex-direction: column;
	background: var(--doc-white);
	border-radius: var(--doc-border-radius);
	box-shadow: var(--doc-shadow);
	overflow: hidden;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 14px;
	line-height: 1.4;
	width: 100%;
}

.srz-document-viewer * {
	box-sizing: border-box;
}

/* Fullscreen mód */
.srz-document-viewer.srz-doc-fullscreen {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	width: 100%;
	height: 100%;
	z-index: 999999;
	border-radius: 0;
	margin: 0;
}

.srz-document-viewer.srz-doc-fullscreen .srz-doc-content {
	height: calc(100vh - 100px) !important;
	flex: 1;
}

/* ==========================================================================
   Toolbar
   ========================================================================== */

.srz-doc-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 16px;
	background: linear-gradient(135deg, var(--doc-primary) 0%, var(--doc-primary-dark) 100%);
	color: var(--doc-white);
	flex-wrap: wrap;
	min-height: 56px;
}

.srz-doc-toolbar-left,
.srz-doc-toolbar-center,
.srz-doc-toolbar-right {
	display: flex;
	align-items: center;
	gap: 12px;
}

.srz-doc-toolbar-left {
	flex: 0 0 auto;
}

.srz-doc-toolbar-center {
	flex: 1 1 auto;
	justify-content: center;
}

.srz-doc-toolbar-right {
	flex: 0 0 auto;
}

.srz-doc-title {
	font-weight: 600;
	font-size: 15px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 200px;
}

/* ==========================================================================
   Badge typy dokumentov
   ========================================================================== */

.srz-doc-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 4px 8px;
	border-radius: 4px;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: var(--doc-white);
}

.srz-doc-badge.badge-pdf {
	background: #e74c3c;
}

.srz-doc-badge.badge-word {
	background: #2980b9;
}

.srz-doc-badge.badge-excel {
	background: #27ae60;
}

/* ==========================================================================
   Tlačidlá
   ========================================================================== */

.srz-doc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	background: rgba(255, 255, 255, 0.2);
	border: none;
	border-radius: 6px;
	color: var(--doc-white);
	cursor: pointer;
	transition: all 0.2s ease;
	text-decoration: none;
}

.srz-doc-btn:hover:not(:disabled) {
	background: rgba(255, 255, 255, 0.35);
	transform: translateY(-1px);
}

.srz-doc-btn:active:not(:disabled) {
	transform: translateY(0);
}

.srz-doc-btn:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.srz-doc-btn .dashicons {
	font-size: 20px;
	width: 20px;
	height: 20px;
}

/* ==========================================================================
   Zoom kontroly
   ========================================================================== */

.srz-doc-zoom {
	display: flex;
	align-items: center;
	gap: 8px;
}

.srz-doc-zoom-select {
	padding: 6px 28px 6px 10px;
	border: none;
	border-radius: 6px;
	background: rgba(255, 255, 255, 0.9);
	color: #333;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 8px center;
}

.srz-doc-zoom-select:focus {
	outline: 2px solid var(--doc-white);
	outline-offset: 1px;
}

/* ==========================================================================
   Obsah dokumentu
   ========================================================================== */

.srz-doc-content {
	position: relative;
	background: var(--doc-canvas-bg);
	overflow: auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
	padding: 20px;
}

/* ==========================================================================
   Loading overlay
   ========================================================================== */

.srz-doc-loading {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 16px;
	background: rgba(82, 86, 89, 0.95);
	z-index: 10;
}

.srz-doc-spinner {
	width: 48px;
	height: 48px;
	border: 4px solid rgba(255, 255, 255, 0.2);
	border-top-color: var(--doc-primary-light);
	border-radius: 50%;
	animation: srz-doc-spin 1s linear infinite;
}

@keyframes srz-doc-spin {
	to {
		transform: rotate(360deg);
	}
}

.srz-doc-loading-text {
	color: var(--doc-white);
	font-size: 14px;
	font-weight: 500;
}

/* ==========================================================================
   Error overlay
   ========================================================================== */

.srz-doc-error {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	background: rgba(82, 86, 89, 0.95);
	z-index: 10;
	color: var(--doc-white);
}

.srz-doc-error .dashicons {
	font-size: 48px;
	width: 48px;
	height: 48px;
	color: #e74c3c;
}

.srz-doc-error-text {
	font-size: 14px;
	text-align: center;
	max-width: 80%;
}

/* ==========================================================================
   Status bar
   ========================================================================== */

.srz-doc-status {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 8px 16px;
	background: var(--doc-status-bg);
	color: var(--doc-status-text);
	font-size: 12px;
	border-top: 1px solid #e9ecef;
}

.srz-doc-status-left,
.srz-doc-status-right {
	display: flex;
	align-items: center;
	gap: 8px;
}

.srz-doc-status .srz-doc-badge {
	font-size: 9px;
	padding: 2px 6px;
}

.srz-doc-zoom-level {
	font-weight: 600;
	color: var(--doc-primary);
}

/* ==========================================================================
   Chybová správa (mimo viewera)
   ========================================================================== */

.srz-document-viewer-error {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 16px 20px;
	background: #fff5f5;
	border: 1px solid #fed7d7;
	border-radius: var(--doc-border-radius);
	color: #c53030;
	font-size: 14px;
}

.srz-document-viewer-error .dashicons {
	font-size: 20px;
	width: 20px;
	height: 20px;
	color: #e53e3e;
}

/* ==========================================================================
   Fallback štýly (keď viewer nefunguje)
   ========================================================================== */

.srz-doc-fallback {
	display: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 40px 20px;
	text-align: center;
	background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
	min-height: 200px;
	width: 100%;
}

.srz-doc-fallback-icon {
	margin-bottom: 20px;
}

.srz-doc-fallback-icon .dashicons {
	font-size: 64px;
	width: 64px;
	height: 64px;
	color: var(--doc-primary, #3498db);
	opacity: 0.7;
}

.srz-doc-fallback-info h3 {
	margin: 0 0 10px;
	font-size: 18px;
	color: #333;
	word-break: break-word;
}

.srz-doc-fallback-info p {
	margin: 0 0 20px;
	color: #666;
	font-size: 14px;
}

.srz-doc-fallback-actions {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
	justify-content: center;
}

.srz-doc-fallback-actions .button {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 10px 20px;
	text-decoration: none;
	border-radius: 6px;
	font-size: 14px;
	font-weight: 500;
	transition: all 0.2s;
	cursor: pointer;
}

.srz-doc-fallback-actions .button-primary {
	background: var(--doc-primary, #3498db);
	border: none;
	color: #fff;
}

.srz-doc-fallback-actions .button-primary:hover {
	background: var(--doc-primary-dark, #2980b9);
	transform: translateY(-1px);
}

.srz-doc-fallback-actions .button:not(.button-primary) {
	background: #fff;
	border: 1px solid #ddd;
	color: #333;
}

.srz-doc-fallback-actions .button:not(.button-primary):hover {
	background: #f5f5f5;
	border-color: #ccc;
}

.srz-doc-fallback-actions .dashicons {
	font-size: 18px;
	width: 18px;
	height: 18px;
}

/* ==========================================================================
   Responzívny dizajn - Tablet
   ========================================================================== */

@media (max-width: 1024px) {
	.srz-doc-toolbar {
		padding: 10px 12px;
		gap: 10px;
	}

	.srz-doc-title {
		max-width: 150px;
		font-size: 14px;
	}
}

/* ==========================================================================
   Responzívny dizajn - Mobil
   ========================================================================== */

@media (max-width: 768px) {
	.srz-doc-toolbar {
		flex-wrap: wrap;
		padding: 12px;
		gap: 12px;
	}

	.srz-doc-toolbar-left {
		order: 1;
		flex: 1 1 100%;
		justify-content: center;
	}

	.srz-doc-toolbar-center {
		order: 2;
		flex: 1 1 100%;
		justify-content: center;
	}

	.srz-doc-toolbar-right {
		order: 3;
		flex: 1 1 100%;
		justify-content: center;
	}

	.srz-doc-title {
		max-width: none;
	}

	.srz-doc-btn {
		width: 44px;
		height: 44px;
	}

	.srz-doc-btn .dashicons {
		font-size: 22px;
		width: 22px;
		height: 22px;
	}

	.srz-doc-content {
		padding: 10px;
	}

	.srz-doc-status {
		flex-direction: column;
		gap: 4px;
		text-align: center;
	}
}

/* ==========================================================================
   Touch optimalizácia
   ========================================================================== */

@media (hover: none) and (pointer: coarse) {
	.srz-doc-btn {
		min-width: 44px;
		min-height: 44px;
	}

	.srz-doc-btn:hover:not(:disabled) {
		transform: none;
	}
}

/* ==========================================================================
   Prístupnosť
   ========================================================================== */

.srz-document-viewer:focus-within {
	outline: 2px solid var(--doc-primary);
	outline-offset: 2px;
}

.srz-doc-btn:focus-visible,
.srz-doc-zoom-select:focus-visible {
	outline: 2px solid var(--doc-white);
	outline-offset: 2px;
}

/* Redukovaný pohyb */
@media (prefers-reduced-motion: reduce) {
	.srz-doc-spinner {
		animation: none;
	}

	.srz-doc-btn {
		transition: none;
	}
}

/* ==========================================================================
   Icon Mode - Kompaktné zobrazenie dokumentu
   ========================================================================== */

.srz-doc-icon-wrapper {
	--doc-color: #28c2bb;
	display: inline-block;
	max-width: 320px;
	width: 100%;
}

.srz-doc-icon-card {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	background: #fff;
	border: 1px solid #e5e5e5;
	border-radius: 8px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
	transition: all 0.2s ease;
}

.srz-doc-icon-card:hover {
	border-color: var(--doc-color);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Vizuálna časť s ikonou */
.srz-doc-icon-visual {
	position: relative;
	flex-shrink: 0;
	width: 48px;
	height: 48px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, var(--doc-color), color-mix(in srgb, var(--doc-color) 80%, black));
	border-radius: 8px;
}

.srz-doc-icon-visual .dashicons {
	font-size: 24px;
	width: 24px;
	height: 24px;
	color: #fff;
}

.srz-doc-icon-badge {
	position: absolute;
	bottom: -4px;
	right: -4px;
	padding: 2px 5px;
	background: #333;
	color: #fff;
	font-size: 9px;
	font-weight: 700;
	border-radius: 3px;
	text-transform: uppercase;
}

/* Typ špecifické farby pre badge */
.doc-icon-pdf .srz-doc-icon-badge {
	background: #e74c3c;
}

.doc-icon-word .srz-doc-icon-badge {
	background: #2980b9;
}

.doc-icon-excel .srz-doc-icon-badge {
	background: #27ae60;
}

/* Info časť s titulkom */
.srz-doc-icon-info {
	flex: 1;
	min-width: 0;
	overflow: hidden;
}

.srz-doc-icon-title {
	display: block;
	font-size: 13px;
	font-weight: 500;
	color: #333;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	line-height: 1.3;
}

/* Akčné tlačidlá */
.srz-doc-icon-actions {
	display: flex;
	gap: 6px;
	flex-shrink: 0;
}

.srz-doc-icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 4px;
	padding: 6px 10px;
	background: #f5f5f5;
	border: 1px solid #ddd;
	border-radius: 6px;
	color: #555;
	font-size: 12px;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.15s ease;
	text-decoration: none;
}

.srz-doc-icon-btn:hover {
	background: var(--doc-color);
	border-color: var(--doc-color);
	color: #fff;
}

.srz-doc-icon-btn .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
}

.srz-doc-icon-btn .srz-btn-label {
	display: none;
}

/* Zobraziť popisky na širších obrazovkách */
@media (min-width: 480px) {
	.srz-doc-icon-wrapper {
		max-width: 400px;
	}

	.srz-doc-icon-btn .srz-btn-label {
		display: inline;
	}
}

/* Responzívnosť pre úzke kontajnery */
@media (max-width: 320px) {
	.srz-doc-icon-card {
		flex-wrap: wrap;
	}

	.srz-doc-icon-actions {
		width: 100%;
		justify-content: flex-end;
		margin-top: 8px;
	}
}

/* ==========================================================================
   Icon Mode Modal - Modálne okno pre zobrazenie dokumentu
   ========================================================================== */

.srz-doc-modal-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.75);
	z-index: 999998;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease, visibility 0.2s ease;
}

.srz-doc-modal-overlay.active {
	opacity: 1;
	visibility: visible;
}

.srz-doc-modal {
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%) scale(0.95);
	width: 90vw;
	height: 85vh;
	max-width: 1200px;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
	z-index: 999999;
	opacity: 0;
	visibility: hidden;
	transition: all 0.25s ease;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.srz-doc-modal.active {
	opacity: 1;
	visibility: visible;
	transform: translate(-50%, -50%) scale(1);
}

.srz-doc-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 20px;
	background: var(--doc-color, #28c2bb);
	color: #fff;
	flex-shrink: 0;
}

.srz-doc-modal-title {
	font-size: 16px;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: calc(100% - 50px);
}

.srz-doc-modal-close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	background: rgba(255, 255, 255, 0.2);
	border: none;
	border-radius: 6px;
	color: #fff;
	cursor: pointer;
	transition: background 0.15s ease;
}

.srz-doc-modal-close:hover {
	background: rgba(255, 255, 255, 0.35);
}

.srz-doc-modal-close .dashicons {
	font-size: 20px;
	width: 20px;
	height: 20px;
}

.srz-doc-modal-body {
	flex: 1;
	overflow: hidden;
	position: relative;
}

.srz-doc-modal-loading {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 16px;
	background: #525659;
}

.srz-doc-modal-loading .srz-doc-spinner {
	width: 48px;
	height: 48px;
	border: 4px solid rgba(255, 255, 255, 0.2);
	border-top-color: var(--doc-color, #28c2bb);
	border-radius: 50%;
	animation: srz-doc-spin 1s linear infinite;
}

.srz-doc-modal-loading-text {
	color: #fff;
	font-size: 14px;
}

.srz-doc-modal-content {
	height: 100%;
	overflow: auto;
}

.srz-doc-modal-content .srz-document-viewer {
	border-radius: 0;
	box-shadow: none;
	height: 100%;
}

/* Responzívne modálne okno */
@media (max-width: 768px) {
	.srz-doc-modal {
		width: 100%;
		height: 100%;
		max-width: none;
		border-radius: 0;
		top: 0;
		left: 0;
		transform: translateY(20px);
	}

	.srz-doc-modal.active {
		transform: translateY(0);
	}

	.srz-doc-modal-header {
		padding: 10px 16px;
	}

	.srz-doc-modal-title {
		font-size: 14px;
	}
}

/* ==========================================================================
   Print štýly
   ========================================================================== */

@media print {
	.srz-document-viewer {
		box-shadow: none;
		border: 1px solid #ccc;
	}

	.srz-doc-toolbar,
	.srz-doc-status {
		display: none;
	}

	.srz-doc-content {
		height: auto !important;
		overflow: visible;
		background: white;
		padding: 0;
	}

	/* Skryť modal pri tlači */
	.srz-doc-modal-overlay,
	.srz-doc-modal {
		display: none !important;
	}
}
