/* ========================================
   FULLSCREEN FUNCTIONALITY
   ======================================== */

/* Fullscreen toggle button */
.fullscreen-toggle {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 10;
    background-color: var(--iea-icils-dark-gray);
    color: #fff;
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}

.fullscreen-toggle:hover {
    background-color: var(--iea-icils-dark-gray);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.fullscreen-toggle:focus {
    outline: 3px solid var(--iea-icils-yellow);
    outline-offset: 2px;
}

.fullscreen-toggle .icon {
    font-size: 1.2em;
}

/* Fullscreen container styles */
.table-container:fullscreen,
.table-container:-webkit-full-screen,
.table-container:-moz-full-screen,
.table-container:-ms-fullscreen,
.table-container.fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    background-color: var(--iea-study-gray-3) !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 0.5rem !important;
    overflow: visible !important; /* Changed from hidden to visible to allow dropdowns and tooltips */
    display: flex !important;
    flex-direction: column !important;
    position: relative !important; /* Ensure proper stacking context for dropdowns */
}

/* Fullscreen toggle button positioning */
.table-container:fullscreen .fullscreen-toggle,
.table-container:-webkit-full-screen .fullscreen-toggle,
.table-container:-moz-full-screen .fullscreen-toggle,
.table-container:-ms-fullscreen .fullscreen-toggle,
.table-container.fullscreen .fullscreen-toggle {
    position: fixed !important;
    top: 0.5rem !important;
    right: 0.5rem !important;
    background-color: var(--iea-icils-yellow) !important;
    color: var(--iea-icils-dark-gray) !important;
    z-index: 10000 !important;
}

/* Fullscreen table styles - generic selectors for different table IDs */
.table-container:fullscreen #table-container,
.table-container:-webkit-full-screen #table-container,
.table-container:-moz-full-screen #table-container,
.table-container:-ms-fullscreen #table-container,
.table-container.fullscreen #table-container,
.table-container:fullscreen .tabulator,
.table-container:-webkit-full-screen .tabulator,
.table-container:-moz-full-screen .tabulator,
.table-container:-ms-fullscreen .tabulator,
.table-container.fullscreen .tabulator {
    width: 100% !important;
    height: calc(100vh - 2rem) !important;
    max-height: calc(100vh - 2rem) !important;
    margin: 0 !important;
    flex: 1 !important;
    min-height: 0 !important;
    overflow: visible !important; /* Ensure table doesn't clip dropdowns and tooltips */
}

/* Hide other elements in fullscreen mode */
.table-container.fullscreen ~ * {
    display: none !important;
}

/* Hide specific elements in fullscreen mode for different pages */
.table-container.fullscreen .panel,
.table-container.fullscreen .box,
.table-container.fullscreen #cil-legend,
.table-container.fullscreen #legend-title {
    display: none !important;
}

/* Responsive adjustments for fullscreen */
@media (max-width: 768px) {
    .fullscreen-toggle {
        top: 0.25rem;
        right: 0.25rem;
        padding: 0.25rem 0.5rem;
    }
    
    .table-container:fullscreen .fullscreen-toggle,
    .table-container:-webkit-full-screen .fullscreen-toggle,
    .table-container:-moz-full-screen .fullscreen-toggle,
    .table-container:-ms-fullscreen .fullscreen-toggle,
    .table-container.fullscreen .fullscreen-toggle {
        top: 0.5rem;
        right: 0.5rem;
    }
}

/* Ensure header filters are visible in fullscreen mode */
.table-container:fullscreen .tabulator-header,
.table-container:-webkit-full-screen .tabulator-header,
.table-container:-moz-full-screen .tabulator-header,
.table-container:-ms-fullscreen .tabulator-header,
.table-container.fullscreen .tabulator-header {
    overflow: visible !important;
    z-index: 100000 !important;
}

/* Keyboard shortcut support */
.table-container.fullscreen {
    outline: none;
}

.table-container.fullscreen:focus {
    outline: none;
}

/* Print styles - hide fullscreen toggle in print */
@media print {
    .fullscreen-toggle {
        display: none !important;
    }
}
