/* assets/css/dashboard.css - Complete Fixed Version */

:root {
    --primary-color: #4361ee;
    --secondary-color: #3a0ca3;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-bg: #f8f9fa;
    --fullscreen-bg: #0f172a;
    --scrollbar-color: rgba(67, 97, 238, 0.3);
    --scrollbar-hover-color: rgba(67, 97, 238, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

body {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-hover-color);
}

/* Full Screen Container */
.full-screen-container {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
    transition: all 0.3s ease;
}

.fullscreen-mode .full-screen-container {
    background: var(--fullscreen-bg);
}

/* Dashboard Header */
.dashboard-header {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 0;
    z-index: 100;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.fullscreen-mode .dashboard-header {
    opacity: 0;
    transform: translateY(-100%);
    height: 0;
    padding: 0;
    overflow: hidden;
    border: none;
    pointer-events: none;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.logo-text h1 {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(90deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-text small {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 500;
}

/* Status Indicators */
.status-indicators {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.05);
    white-space: nowrap;
}

.status-badge i {
    color: #60a5fa;
}

.status-badge .badge-text {
    color: #cbd5e1;
}

.status-badge .live-dot {
    width: 6px;
    height: 6px;
    background: var(--success-color);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Main Controls */
.main-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.control-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    white-space: nowrap;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
    color: white;
}

.control-btn:active {
    transform: scale(0.98);
}

.control-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Timer Badges */
.timer-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    background: rgba(67, 97, 238, 0.2);
    border: 1px solid rgba(67, 97, 238, 0.3);
    color: #60a5fa;
    white-space: nowrap;
}

.timer-badge i {
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.timer-badge.warning {
    background: rgba(255, 193, 7, 0.2);
    border-color: rgba(255, 193, 7, 0.3);
    color: #fbbf24;
}

.timer-badge.danger {
    background: rgba(220, 53, 69, 0.2);
    border-color: rgba(220, 53, 69, 0.3);
    color: #f87171;
}

/* Tab Navigation */
.tab-navigation {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0 20px;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.fullscreen-mode .tab-navigation {
    opacity: 0;
    transform: translateY(-100%);
    height: 0;
    padding: 0;
    overflow: hidden;
    border: none;
    pointer-events: none;
}

.tab-list {
    display: flex;
    gap: 5px;
    list-style: none;
    margin: 0;
    padding: 10px 0;
    overflow-x: auto;
}

.tab-item {
    flex: 1;
    min-width: 150px;
    max-width: 250px;
}

.tab-btn {
    width: 100%;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 8px 8px 0 0;
    color: #94a3b8;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    white-space: nowrap;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-bottom: 3px solid var(--primary-color);
}

.tab-indicator {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.tab-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(67, 97, 238, 0.3);
    color: #60a5fa;
}

/* Main Content Area */
.main-content {
    flex: 1;
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
}

.fullscreen-mode .main-content {
    height: 100vh;
}

.tab-content {
    width: 100%;
    height: 100%;
    position: relative;
}

.tab-pane {
    width: 100%;
    height: 100%;
    display: none;
    opacity: 0;
    transition: opacity 0.5s ease;
    position: relative;
}

.tab-pane.active {
    display: block;
    opacity: 1;
}

/* Scrollable Container for Tab Content */
.scrollable-container {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}

.content-wrapper {
    padding: 20px;
    min-height: 100%;
}

.content-iframe {
    width: 100%;
    min-height: 600px;
    border: none;
    border-radius: 10px;
    background: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.placeholder-content {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    color: #94a3b8;
}

.placeholder-content h3 {
    color: #60a5fa;
    margin-bottom: 15px;
}

.placeholder-content i {
    font-size: 24px;
    margin-right: 10px;
}

/* Fullscreen Mode Styles */
.fullscreen-mode {
    background: var(--fullscreen-bg);
}

/* Fullscreen Info Bar */
.fullscreen-info-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 20px;
    z-index: 10000;
    display: none;
    justify-content: space-between;
    align-items: center;
    opacity: 0;
    transform: translateY(-100%);
    transition: all 0.3s ease;
}

.fullscreen-mode .fullscreen-info-bar {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

.fullscreen-timer-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.fullscreen-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #cbd5e1;
}

.fullscreen-timer i {
    color: var(--primary-color);
    font-size: 12px;
}

.fullscreen-timer-label {
    font-size: 11px;
    color: #94a3b8;
    margin-left: 4px;
}

.fullscreen-current-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(67, 97, 238, 0.2);
    border-radius: 8px;
    font-weight: 600;
    color: #60a5fa;
}

.fullscreen-database-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    font-size: 13px;
    color: #94a3b8;
}

.fullscreen-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.fullscreen-control-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.fullscreen-control-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

.fullscreen-exit-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #cbd5e1;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.fullscreen-exit-btn:hover {
    background: var(--primary-color);
    color: white;
}

/* Scroll Top Button */
.scroll-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 40px;
    height: 40px;
    background: rgba(67, 97, 238, 0.8);
    border: none;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

.scroll-top-btn.visible {
    opacity: 1;
    transform: translateY(0);
}

.scroll-top-btn:hover {
    background: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(67, 97, 238, 0.4);
}

/* Scroll Progress Bar */
.scroll-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--primary-color);
    z-index: 10001;
    transition: width 0.1s ease;
}

/* Tooltip */
.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    z-index: 10000;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.tooltip.show {
    opacity: 1;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.loading-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    color: #cbd5e1;
    font-size: 14px;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .header-content {
        flex-wrap: wrap;
        gap: 15px;
    }
    
    .status-indicators, .main-controls {
        flex-wrap: wrap;
    }
    
    .tab-item {
        max-width: none;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
        padding: 10px;
    }
    
    .logo-text h1 {
        font-size: 18px;
    }
    
    .status-indicators {
        justify-content: center;
        width: 100%;
    }
    
    .main-controls {
        justify-content: center;
        width: 100%;
    }
    
    .tab-list {
        overflow-x: auto;
        flex-wrap: nowrap;
    }
    
    .tab-item {
        flex: 0 0 auto;
    }
    
    .tab-btn {
        padding: 10px 15px;
        font-size: 12px;
    }
    
    .content-wrapper {
        padding: 15px;
    }
    
    .fullscreen-timer-info {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .fullscreen-info-bar {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }
    
    .fullscreen-exit-btn {
        align-self: flex-end;
    }
}

@media (max-width: 480px) {
    .logo-text h1 {
        font-size: 16px;
    }
    
    .tab-btn span {
        display: none;
    }
    
    .tab-btn i {
        margin-right: 0;
    }
    
    .control-btn span {
        display: none;
    }
    
    .control-btn i {
        margin-right: 0;
    }
    
    .fullscreen-timer {
        font-size: 11px;
        padding: 4px 8px;
    }
    
    .fullscreen-exit-btn span {
        display: none;
    }
}

/* Animation for tab switching */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.tab-pane.active .scrollable-container {
    animation: fadeIn 0.5s ease forwards;
}

/* Smooth scrolling for the entire page */
html {
    scroll-behavior: smooth;
}

/* ========== BOTTOM SPACE FIXES ========== */
body.fullscreen {
    overflow: hidden !important;
}

.full-screen-container {
    min-height: 100vh !important;
}

.main-content {
    flex: 1 1 auto !important;
    min-height: 0 !important;
}

.tab-pane {
    height: 100% !important;
}

.content-wrapper {
    height: 100% !important;
}

.content-iframe {
    height: 100% !important;
    min-height: 100% !important;
}

.dashboard-header,
.tab-navigation,
.main-content,
.tab-pane,
.scrollable-container,
.content-wrapper {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

.fullscreen-mode .full-screen-container {
    height: 100vh !important;
}

.fullscreen-mode .main-content {
    height: 100vh !important;
}

.fullscreen-mode .tab-pane.active {
    height: 100vh !important;
}

.fullscreen-mode .content-iframe {
    height: 100vh !important;
}

@supports (-webkit-touch-callout: none) {
    .full-screen-container {
        height: -webkit-fill-available !important;
    }
    
    .content-iframe {
        height: -webkit-fill-available !important;
    }
}