/* ============================================
   FILE PREVIEW - Shared Modal Styles
   ============================================
   Използва се за preview на документи, снимки и файлове
   в цялото приложение.
   ============================================ */

:root {
    --fp-accent: #F5875D;
    --fp-accent-dark: #e07a4f;
    --fp-text-color: #ffffff;
    --fp-text-muted: rgba(255, 255, 255, 0.7);
    --fp-dark-bg: rgba(20, 29, 42, 0.92);
    --fp-border: rgba(129, 134, 213, 0.25);
    --fp-shadow: 0 25px 60px rgba(15, 23, 42, 0.4);
    --fp-primary: #8186d5;
}

/* ============================================
   DARK MODAL
   ============================================ */
.fp-modal .modal-content {
    background: var(--fp-dark-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--fp-border);
    box-shadow: var(--fp-shadow);
    border-radius: 20px;
    color: var(--fp-text-color);
}

.fp-modal .modal-header {
    border-bottom: 1px solid var(--fp-border);
    background: rgba(129, 134, 213, 0.08);
    padding: 1.25rem 1.5rem;
}

.fp-modal .modal-title {
    color: var(--fp-text-color);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.fp-modal .modal-title i {
    color: var(--fp-primary);
}

.fp-modal .btn-close {
    filter: invert(1);
    opacity: 0.7;
    transition: all 0.2s ease;
}

.fp-modal .btn-close:hover {
    opacity: 1;
    transform: scale(1.1);
}

.fp-modal .modal-body {
    padding: 1.5rem;
}

.fp-modal .modal-footer {
    border-top: 1px solid var(--fp-border);
    background: transparent;
    padding: 1rem 1.5rem;
}

/* ============================================
   ADMIN OVERRIDES
   ============================================ */
.admin-root .fp-modal .modal-content {
    background: var(--fp-dark-bg) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--fp-border) !important;
    box-shadow: var(--fp-shadow) !important;
}

.admin-root .fp-modal .modal-header,
.admin-root .fp-modal .modal-footer {
    border-color: var(--fp-border) !important;
    background: transparent !important;
}

.admin-root .fp-modal .modal-header {
    background: rgba(129, 134, 213, 0.08) !important;
}

.admin-root .fp-modal .fp-download-btn,
.admin-root .fp-modal .fp-btn-accent {
    color: #ffffff !important;
}

/* ============================================
   MODAL SIZING
   ============================================ */
.fp-modal .modal-dialog {
    max-width: 65vw;
}

@media (max-width: 992px) {
    .fp-modal .modal-dialog {
        max-width: 85vw;
    }
}

@media (max-width: 768px) {
    .fp-modal .modal-dialog {
        max-width: 95vw;
        margin: 10px;
    }
}

/* ============================================
   PREVIEW CONTENT - Slide Container
   ============================================ */
.fp-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 450px;
}

@media (max-width: 768px) {
    .fp-slide {
        min-height: 300px;
    }
}

/* ============================================
   IMAGE PREVIEW
   ============================================ */
.fp-preview-image {
    max-width: 100%;
    max-height: 60vh;
    object-fit: contain;
    border-radius: 12px;
}

@media (max-width: 768px) {
    .fp-preview-image {
        max-height: 50vh;
    }
}

/* ============================================
   PDF / DOCUMENT PREVIEW (iframe)
   ============================================ */
.fp-preview-document {
    width: 100%;
    height: 60vh;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.95);
}

@media (max-width: 768px) {
    .fp-preview-document {
        height: 50vh;
    }
}

/* ============================================
   FALLBACK (за файлове които не могат да се визуализират)
   ============================================ */
.fp-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--fp-text-color);
    text-align: center;
    padding: 40px;
}

.fp-fallback-icon {
    font-size: 4rem;
    color: var(--fp-accent);
    opacity: 0.9;
    margin-bottom: 16px;
}

.fp-fallback-filename {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 8px;
    word-break: break-word;
    max-width: 100%;
}

.fp-fallback-message {
    color: var(--fp-text-muted);
    margin-bottom: 20px;
}

/* ============================================
   CAROUSEL CONTROLS
   ============================================ */
.fp-modal .carousel-control-prev,
.fp-modal .carousel-control-next {
    width: 50px;
    height: 50px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 50%;
    opacity: 0.9;
    transition: all 0.3s ease;
}

.fp-modal .carousel-control-prev {
    left: 15px;
}

.fp-modal .carousel-control-next {
    right: 15px;
}

.fp-modal .carousel-control-prev:hover,
.fp-modal .carousel-control-next:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

.fp-modal .carousel-control-prev-icon,
.fp-modal .carousel-control-next-icon {
    width: 20px;
    height: 20px;
}

/* Hide carousel controls when not needed */
.fp-modal.fp-no-carousel .carousel-control-prev,
.fp-modal.fp-no-carousel .carousel-control-next {
    display: none;
}

@media (max-width: 768px) {
    .fp-modal .carousel-control-prev,
    .fp-modal .carousel-control-next {
        width: 40px;
        height: 40px;
    }
}

/* ============================================
   COUNTER (1 / 5)
   ============================================ */
.fp-counter {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
    margin-top: 12px;
}

/* Hide counter when only one item or no carousel */
.fp-modal.fp-no-carousel .fp-counter,
.fp-modal.fp-single-item .fp-counter {
    display: none;
}

/* ============================================
   FOOTER
   ============================================ */
.fp-current-name {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
    max-width: 50%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 768px) {
    .fp-current-name {
        display: none;
    }
}

/* ============================================
   ACCENT BUTTON
   ============================================ */
.fp-btn-accent {
    background: var(--fp-accent);
    border-color: var(--fp-accent);
    color: white;
    border-radius: 8px;
    padding: 8px 20px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.fp-btn-accent:hover {
    background: var(--fp-accent-dark);
    border-color: var(--fp-accent-dark);
    color: white;
}

/* ============================================
   LOADING STATE
   ============================================ */
.fp-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--fp-text-color);
}

.fp-loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(129, 134, 213, 0.2);
    border-top-color: var(--fp-primary);
    border-radius: 50%;
    animation: fp-spin 0.8s linear infinite;
    margin-bottom: 16px;
}

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

/* ============================================
   CUSTOM SCROLLBAR
   ============================================ */
.fp-modal .modal-body::-webkit-scrollbar {
    width: 6px;
}

.fp-modal .modal-body::-webkit-scrollbar-track {
    background: rgba(129, 134, 213, 0.1);
    border-radius: 3px;
}

.fp-modal .modal-body::-webkit-scrollbar-thumb {
    background: var(--fp-primary);
    border-radius: 3px;
}

.fp-modal .modal-body::-webkit-scrollbar-thumb:hover {
    background: #8b5cf6;
}

/* ============================================
   MODAL ANIMATION
   ============================================ */
.fp-modal.fade .modal-dialog {
    transform: scale(0.9) translateY(-20px);
    transition: transform 0.3s ease-out;
}

.fp-modal.show .modal-dialog {
    transform: scale(1) translateY(0);
}
