/* preview_style.css */
:root {
    --preview-primary-color: #22c55e; /* Your green */
    --preview-primary-hover: #16a34a;
    --preview-text-dark: #212529;
    --preview-text-medium: #495057;
    --preview-text-light: #6c757d;
    --preview-border-color: #dee2e6;
    --preview-bg-light: #f8f9fa;
    --preview-bg-white: #ffffff;
    --preview-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

body.preview-page-active { /* Add this class to body in preview_page.php if needed */
    background-color: var(--preview-bg-light);
    color: var(--preview-text-dark);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    margin: 0;
}

.preview-page-container {
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Header Bar */
.preview-header-bar {
    background-color: var(--preview-bg-white);
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--preview-border-color);
    position: sticky;
    top: 0;
    z-index: 1020; /* Ensure above other content */
}
.preview-header-bar .preview-page-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.preview-logo-area a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--preview-text-dark);
    font-weight: 600;
    font-size: 1.1rem;
}
.preview-logo-area img {
    height: 32px; /* Adjust as needed */
    margin-right: 0.5rem;
    vertical-align: middle;
}
.preview-auth-actions .btn-preview-auth {
    margin-left: 0.5rem;
    padding: 0.4rem 0.8rem;
    border-radius: 0.3rem;
    font-size: 0.85rem;
    text-decoration: none;
    transition: all 0.2s ease-in-out;
    border: 1px solid transparent;
}
.btn-preview-ghost {
    background-color: transparent;
    border-color: var(--preview-border-color);
    color: var(--preview-text-medium);
}
.btn-preview-ghost:hover {
    background-color: var(--preview-bg-light);
    border-color: #adb5bd;
}
.btn-preview-primary {
    background-color: var(--preview-primary-color);
    border-color: var(--preview-primary-color);
    color: white;
}
.btn-preview-primary:hover {
    background-color: var(--preview-primary-hover);
    border-color: var(--preview-primary-hover);
}

/* Main Content Area */
.preview-main-content {
    padding: 2rem 0;
}
.file-primary-info {
    margin-bottom: 1.5rem;
}
.file-icon-and-name {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}
.file-type-icon-large {
    font-size: 1.8rem; /* Larger icon next to filename */
    margin-right: 0.75rem;
    color: var(--preview-text-medium);
}
.file-primary-info h1 {
    font-size: 1.8rem;
    font-weight: 600;
    margin: 0;
    word-break: break-all;
}
.file-sub-details {
    font-size: 0.9rem;
    color: var(--preview-text-light);
    margin-top: 0.25rem;
}

/* Action Buttons */
.file-action-buttons {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--preview-border-color);
}
.btn-preview-action {
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
    border-radius: 0.3rem;
    text-decoration: none;
    font-weight: 500;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
}
.btn-preview-action i {
    margin-right: 0.25rem; /* Slightly reduced gap controlled by main gap */
}
.btn-preview-download {
    background-color: var(--preview-primary-color);
    border-color: var(--preview-primary-color);
    color: white;
}
.btn-preview-download:hover {
    background-color: var(--preview-primary-hover);
    border-color: var(--preview-primary-hover);
}
.btn-preview-copy {
    background-color: var(--preview-bg-white);
    border-color: var(--preview-border-color);
    color: var(--preview-text-dark);
}
.btn-preview-copy:hover {
    background-color: var(--preview-bg-light);
}

/* File Preview Area */
.file-content-preview {
    background-color: var(--preview-bg-white);
    border-radius: 0.5rem;
    padding: 1rem; /* Adjust padding as needed */
    box-shadow: var(--preview-shadow);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 300px; /* Default min height */
    text-align: center;
}
.preview-image {
    max-width: 100%;
    max-height: 70vh; /* Limit image height */
    height: auto;
    border-radius: 0.25rem;
}
.preview-video, .preview-audio {
    width: 100%;
    max-width: 800px; /* Max width for media players */
    border-radius: 0.25rem;
}
.preview-video {
    max-height: 70vh;
    background-color: #000; /* Black background for video player */
}
.preview-pdf-iframe {
    width: 100%;
    height: 75vh; /* Good height for PDFs */
    border: 1px solid var(--preview-border-color);
    border-radius: 0.25rem;
}
.preview-fallback-text, .preview-generic p {
    font-size: 0.9rem;
    color: var(--preview-text-light);
    margin-top: 0.5rem;
}
.preview-generic-icon {
    font-size: 4rem;
    color: #ccc; /* Lighter color for generic icon */
    margin-bottom: 1rem;
}

/* Footer */
.preview-footer-bar {
    margin-top: 3rem;
    padding: 1.5rem 0;
    text-align: center;
    font-size: 0.85rem;
    color: var(--preview-text-light);
    border-top: 1px solid var(--preview-border-color);
}
.preview-footer-bar p {
    margin: 0.25rem 0;
}
.preview-footer-bar a {
    color: var(--preview-text-medium);
    text-decoration: none;
}
.preview-footer-bar a:hover {
    text-decoration: underline;
    color: var(--preview-primary-color);
}

/* Toast Notification Styles (enhanced) */
.toast-container {
    position: fixed;
    bottom: 1.5rem; /* Added */
    right: 1.5rem;
    z-index: 2000;
    display: flex;
    flex-direction: column-reverse; /* Changed: New toasts appear above old ones */
    gap: 0.75rem;
    align-items: flex-end; /* Align toasts to the right */
}
.toast {
    display: flex; /* For icon alignment */
    align-items: flex-start; /* Align items to the top */
    background: var(--preview-bg-white);
    color: var(--preview-text-dark);
    border-radius: 0.375rem;
    padding: 0.8rem 1rem;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.1);
    min-width: 280px;
    max-width: 350px;
    border-left: 4px solid var(--preview-primary-color); /* Default success */
    animation: toastSlideIn 0.3s ease-out;
}
.toast-error { border-left-color: #dc3545; } /* Bootstrap danger red */
.toast-warning { border-left-color: #ffc107; } /* Bootstrap warning yellow */
.toast-info { border-left-color: #17a2b8; } /* Bootstrap info cyan */

.toast-icon {
    font-size: 1.2rem;
    margin-right: 0.75rem;
    flex-shrink: 0; /* Prevent icon from shrinking */
    padding-top: 0.1rem; /* Fine-tune vertical alignment */
}
.toast-success .toast-icon { color: var(--preview-primary-color); }
.toast-error .toast-icon { color: #dc3545; }
.toast-warning .toast-icon { color: #ffc107; }
.toast-info .toast-icon { color: #17a2b8; }

.toast-content {
    flex-grow: 1;
}
.toast-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}
.toast-message {
    font-size: 0.85rem;
    color: var(--preview-text-medium);
    line-height: 1.4;
}
.toast-close {
    background: transparent;
    border: none;
    color: var(--preview-text-light);
    font-size: 1.2rem;
    margin-left: 0.75rem;
    padding: 0 0.25rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.toast-close:hover { opacity: 1; }

@keyframes toastSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}


/* Responsive adjustments */
@media (max-width: 768px) {
    .preview-header-bar .preview-page-container {
        flex-direction: column;
        gap: 0.5rem;
    }
    .preview-auth-actions {
        width: 100%;
        display: flex;
        justify-content: center; /* Center auth buttons */
    }
    .file-primary-info h1 { font-size: 1.5rem; }
    .file-sub-details { font-size: 0.8rem; }
    
    .file-action-buttons {
        flex-direction: column;
        align-items: stretch; /* Make buttons full width */
    }
    .btn-preview-action {
        width: 100%;
        justify-content: center;
    }
    .file-content-preview { padding: 0.75rem; }
}
@media (max-width: 480px) {
    .toast-container {
        left: 0.5rem;
        right: 0.5rem;
        top: 0.5rem;
        width: auto; /* Allow toasts to span width */
    }
    .toast { min-width: unset; }
}