/**
 * PDF Modal Styles
 *
 * Styles for the embedded PDF viewer modal.
 */

/* Modal container */
.pdf-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

/* Backdrop overlay */
.pdf-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Modal content container */
.pdf-modal-container {
    position: relative;
    width: 95%;
    max-width: 1100px;
    height: 90vh;
    max-height: 90vh;
    background: var(--bb-surface, #ffffff);
    border-radius: 12px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1;
    animation: pdf-modal-appear 0.25s ease-out;
}

@keyframes pdf-modal-appear {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Modal header */
.pdf-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--bb-border-light, #e5e7eb);
    background: var(--bb-bg-secondary, #f9fafb);
    flex-shrink: 0;
}

.pdf-page-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.pdf-modal-header .page-indicator {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.875rem;
    background: var(--bb-info, #3b82f6);
    color: white;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    flex-shrink: 0;
}

.pdf-modal-header .document-title {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--bb-text-secondary, #6b7280);
    max-width: 450px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Action buttons */
.pdf-modal-actions {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.pdf-modal-actions button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--bb-text-secondary, #6b7280);
    cursor: pointer;
    transition: all 0.2s ease;
}

.pdf-modal-actions button:hover {
    background: var(--bb-bg-tertiary, #f3f4f6);
    color: var(--bb-text, #1f2937);
}

.pdf-modal-actions button:focus {
    outline: 2px solid var(--bb-info, #3b82f6);
    outline-offset: 2px;
}

.pdf-modal-close:hover {
    background: rgba(220, 38, 38, 0.1);
    color: var(--bb-error, #dc2626);
}

/* Modal body with PDF */
.pdf-modal-body {
    flex: 1;
    overflow: hidden;
    background: #525659; /* Standard PDF viewer background */
    position: relative;
}

/* PDF iframe */
.pdf-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    display: none; /* Hidden until loaded */
}

/* Loading state */
.pdf-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: white;
    gap: 1rem;
}

.pdf-loading .spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: pdf-spin 0.8s linear infinite;
}

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

.pdf-loading p {
    font-size: 1rem;
    margin: 0;
}

/* Fallback state */
.pdf-fallback {
    display: none;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 2rem;
}

.pdf-fallback-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
    color: white;
}

.pdf-fallback-content svg {
    opacity: 0.7;
}

.pdf-fallback-content p {
    font-size: 1rem;
    margin: 0;
    opacity: 0.9;
}

.pdf-fallback-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--bb-info, #3b82f6);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 500;
    transition: background-color 0.2s ease;
    margin-top: 0.5rem;
}

.pdf-fallback-link:hover {
    background: var(--bb-info-hover, #2563eb);
}

/* Dark mode */
[data-theme="dark"] .pdf-modal-container {
    background: var(--bb-surface, #1f2937);
}

[data-theme="dark"] .pdf-modal-header {
    background: var(--bb-bg-secondary, #111827);
    border-bottom-color: var(--bb-border-dark, #374151);
}

[data-theme="dark"] .pdf-modal-header .document-title {
    color: var(--bb-text-secondary, #9ca3af);
}

[data-theme="dark"] .pdf-modal-actions button:hover {
    background: var(--bb-bg-tertiary, #374151);
    color: var(--bb-text, #f3f4f6);
}

[data-theme="dark"] .pdf-modal-close:hover {
    background: rgba(248, 113, 113, 0.1);
    color: #f87171;
}

/* Sepia mode */
[data-theme="sepia"] .pdf-modal-container {
    background: #faf8f3;
}

[data-theme="sepia"] .pdf-modal-header {
    background: #f5f0e6;
    border-bottom-color: #d4c9b0;
}

[data-theme="sepia"] .pdf-modal-header .document-title {
    color: #7a6545;
}

[data-theme="sepia"] .pdf-modal-header .page-indicator {
    background: #8b6914;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .pdf-modal-container {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border-radius: 0;
    }

    .pdf-modal-header {
        padding: 0.75rem 1rem;
    }

    .pdf-modal-header .document-title {
        display: none;
    }

    .pdf-page-info {
        gap: 0.5rem;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .pdf-modal-actions button {
        width: 36px;
        height: 36px;
    }

    .pdf-modal-actions button svg {
        width: 18px;
        height: 18px;
    }
}
