/* Clean Navigation CSS - Optimized for base.html integration */

/* Base container styling that works with base.html */
.clean-nav-container {
    display: flex;
    justify-content: center;
    margin: 2rem auto;
    max-width: 800px;
    padding: 0 2rem;
}

.clean-nav-buttons {
    display: flex;
    gap: 1rem;
    background: white;
    padding: 0.5rem;
    border-radius: var(--border-radius-lg, 50px);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color, #e0e0e0);
}

.clean-nav-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    border-radius: 40px;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    min-width: 120px;
    justify-content: center;
}

.clean-nav-btn.active {
    background: var(--dark-blue, #2C3E50);
    color: white;
    border: 2px solid var(--dark-blue, #2C3E50);
}

.clean-nav-btn:not(.active) {
    background: transparent;
    color: var(--secondary-color, #666);
    border: 2px solid transparent;
}

/* Removed hover effect to prevent movement */

.clean-content-section {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 2rem;
    padding-bottom: 5rem;
}

.clean-placeholder {
    background: white;
    border-radius: var(--border-radius, 12px);
    padding: 3rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.clean-placeholder-icon {
    font-size: 3rem;
    color: var(--border-color, #ccc);
    margin-bottom: 1rem;
}

.clean-placeholder h2 {
    color: var(--dark-blue, #2C3E50);
    margin-bottom: 1rem;
    font-weight: 600;
}

.clean-placeholder p {
    color: var(--secondary-color, #666);
    margin-bottom: 0.5rem;
}

/* Chart Modal Styles */
#metricsChartModal .modal-dialog {
    max-width: 90%;
    width: 1200px;
}

#metricsChartModal .modal-content {
    border-radius: 12px;
    overflow: visible;
}

#metricsChartModal .modal-header {
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 1rem 1.5rem;
}

#metricsChartModal .modal-body {
    padding: 1.5rem;
}

.chart-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    flex-wrap: wrap;
    gap: 1rem;
}

.time-range-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.time-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #2C3E50;
    background: white;
    color: #2C3E50;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Removed hover effect to prevent movement */

.time-btn.active {
    background: #2C3E50;
    color: white;
}

.export-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.export-btn {
    padding: 0.5rem 0.75rem;
    background: white;
    border: 1px solid #dee2e6;
    color: #495057;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* Removed hover effect to prevent movement */

.export-btn i {
    font-size: 0.875rem;
}

#chartContainer {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    min-height: 400px;
    position: relative;
}

.chart-info {
    text-align: center;
    padding: 0.5rem;
    color: #6c757d;
    font-size: 0.875rem;
}

@media (max-width: 768px) {
    #metricsChartModal .modal-dialog {
        max-width: 95%;
        margin: 0.5rem;
    }
    
    .chart-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .time-range-buttons,
    .export-buttons {
        justify-content: center;
    }
    
    .time-btn,
    .export-btn {
        font-size: 0.75rem;
        padding: 0.4rem 0.6rem;
    }
}

/* File Download Grid - Added for database integration */
.file-buttons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.file-download-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background: white;
    border: 2px solid var(--dark-blue, #2C3E50);
    border-radius: var(--border-radius, 12px);
    color: var(--dark-blue, #2C3E50);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    min-height: 60px;
    box-shadow: var(--shadow-sm);
    text-align: center;
    flex-direction: column;
}

/* Removed hover effect to prevent movement */

.file-download-button .file-size {
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.8;
    margin-top: 0.25rem;
}

.sync-status {
    text-align: center;
    margin-top: 2rem;
}

.sync-status small {
    color: var(--secondary-color, #666);
    font-size: 0.8rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .file-buttons-grid {
        grid-template-columns: 1fr;
        max-width: 300px;
        margin: 2rem auto;
    }
    
    .file-download-button {
        min-height: 70px;
    }
}

/* ===== BACK BUTTON STYLES ===== */
/* Back button styling is now handled globally by back-button-global.css */
/* Any module-specific overrides for insti_sales can be added here if needed */

/* Ensure the back button doesn't interfere with content */
.clean-content-section {
    padding-bottom: 5rem;
}

@media (max-width: 768px) {
    .clean-content-section {
        padding-bottom: 4rem;
    }
}

/* ===== ENHANCED FILE CARD STYLES ===== */

/* Updated file grid for cards */
.file-buttons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

/* File card container */
.file-download-card {
    position: relative;
    padding: 1.25rem;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    background: white;
    min-height: 160px;
    display: flex;
    flex-direction: column;
    /* Removed transition and hover effect to prevent movement */
}

/* File information section */
.file-info {
    margin-bottom: 1rem;
}

.file-title {
    color: var(--dark-blue, #2C3E50);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    display: flex;
    align-items: center;
}

.file-meta {
    display: block;
    color: #666;
    font-size: 0.85rem;
    margin: 0.25rem 0;
}

/* File actions section */
.file-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex-grow: 1;
}

.file-actions .btn {
    width: 100%;
    text-align: left;
    padding: 0.875rem 1rem;
    display: flex;
    align-items: center;
    font-weight: 500;
}

.file-actions .btn i {
    width: 20px;
    text-align: center;
}

.file-actions .btn-primary {
    background-color: #2C3E50;
    border-color: #2C3E50;
}

/* Removed hover effect to prevent movement */

/* File size info - positioned at bottom right */
.file-size-info {
    position: absolute;
    bottom: 0.75rem;
    right: 1rem;
    background: #f8f9fa;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
}

.file-size-info small {
    font-size: 0.75rem;
    color: #6c757d;
    font-weight: 600;
}

/* PDF Preview Modal Styles */
.pdf-toolbar {
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.pdf-controls, .pdf-zoom, .pdf-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pdf-fullscreen {
    display: flex;
    align-items: center;
}

.page-info, .zoom-level {
    font-size: 0.875rem;
    color: #6c757d;
    margin: 0 0.5rem;
}

.pdf-container {
    background: #525659;
    min-height: 500px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: auto;
    position: relative;
}

#pdfCanvas {
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    margin: 1rem;
}

.modal-xl {
    max-width: 95vw;
}

.modal-body {
    max-height: 80vh;
    overflow: hidden;
}

.pdf-container {
    max-height: calc(80vh - 120px);
    overflow: auto;
}

/* Fullscreen styles */
.pdf-modal-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    margin: 0 !important;
    z-index: 9999 !important;
}

.pdf-modal-fullscreen .modal-content {
    height: 100vh;
    border-radius: 0;
}

.pdf-modal-fullscreen .modal-body {
    max-height: calc(100vh - 120px);
    flex: 1;
}

.pdf-modal-fullscreen .pdf-container {
    max-height: calc(100vh - 180px);
    background: #000;
}

.pdf-modal-fullscreen #pdfCanvas {
    margin: 0;
    box-shadow: none;
}

/* Loading state */
.pdf-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    color: #6c757d;
}

.pdf-loading .spinner-border {
    margin-right: 0.5rem;
}

/* Responsive adjustments for cards */
@media (max-width: 768px) {
    .file-buttons-grid {
        grid-template-columns: 1fr;
        max-width: 400px;
        gap: 1.5rem;
    }
    
    .file-actions {
        flex-direction: column;
    }
    
    .file-download-card .file-download-button,
    .preview-button {
        flex: 1;
    }
}

/* ===== COPY TO CLIPBOARD NOTIFICATION ===== */

/* Copy notification styling */
.copy-notification {
    position: absolute !important;
    background: #10B981 !important;
    color: white !important;
    padding: 0.5rem 1rem !important;
    border-radius: 6px !important;
    z-index: 99999 !important;
    font-size: 0.85rem !important;
    font-weight: 500 !important;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    white-space: nowrap;
}

.copy-notification i {
    margin-right: 0.25rem;
    font-size: 0.9rem;
}

/* CSP-safe visibility/helpers (used by JS instead of inline styles) */
.u-display-none { display: none !important; }
.u-display-block { display: block !important; }
.u-position-relative { position: relative !important; }
.u-offscreen { position: fixed !important; left: -999999px !important; top: -999999px !important; }

/* Copy notification placement and animation helpers */
.copy-notification { right: 10px; top: 50%; transform: translateY(-50%) translateX(10px); transition: opacity .2s ease, transform .2s ease; }
.copy-notification.show { opacity: 1; transform: translateY(-50%) translateX(0); }
.copy-notification--fixed-top { position: fixed !important; top: 20px; left: 50%; transform: translateX(-50%); }

/* Copied state for fund rows */
.class-item.copied {
    background: #d4f4dd !important;
}

.metrics-section.copied {
    background: #d4f4dd !important;
}

/* Ensure rows are clickable */
.class-item[data-action="copy-class"] {
    cursor: pointer;
}

.metrics-section[data-action="copy-metrics"] {
    cursor: pointer;
}

/* ===== PDF PREVIEW MODAL STYLES ===== */

/* PDF Preview Modal Styles */
.modal-body-pdf {
    padding: 0;
    height: 70vh;
    min-height: 500px;
}

.pdf-preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 0;
}

/* Ensure modal takes up more screen space */
#pdfPreviewModal .modal-xl {
    max-width: 90vw;
    width: 1200px;
}

#pdfPreviewModal .modal-content {
    height: 80vh;
}

#pdfPreviewModal .modal-body {
    max-height: calc(80vh - 120px);
    overflow: hidden;
}

/* Fullscreen improvements */
.pdf-modal-fullscreen .pdf-preview-iframe {
    width: 100vw;
    height: 100vh;
}

/* Chart container styles - CSP compliant (no inline styles) */
.chart-container {
    height: 400px;
    position: relative;
}

.chart-loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}