/* public/css/style.css */

/* --- IMPORT COMPONENT STYLES --- */
@import url('./components/_buttons.css');
@import url('./components/_dashboard.css');
@import url('./components/_loaders.css'); 
@import url('./components/_media-library.css');
@import url('./components/_modals.css');
@import url('./components/_scheduler.css');
@import url('./components/_tables.css');
@import url('./components/_toast.css');


:root {
    --bg-dark: #121212;
    --bg-light: #1E1E1E;
    --bg-lighter: #2a2a2a;
    --border-color: #333333;
    --primary-color: #3B82F6;
    --primary-hover: #2563EB;
    --danger-color: #EF4444;
    --danger-hover: #DC2626;
    --text-main: #E5E7EB;
    --text-muted: #9CA3AF;
    --green-status: #10B981;
    --font-family: 'Inter', sans-serif;
}

body.light-mode {
    --bg-dark: #F3F4F6;
    --bg-light: #FFFFFF;
    --bg-lighter: #F9FAFB;
    --border-color: #E5E7EB;
    --text-main: #1F2937;
    --text-muted: #6B7280;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

#sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 999; /* Below sidebar */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* --- LOGIN PAGE STYLES --- */
.login-page-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-container { text-align: center; padding: 16px; }
.login-box { background-color: var(--bg-light); padding: 48px; border-radius: 16px; border: 1px solid var(--border-color); }
.login-box .sidebar-header { justify-content: center; }
.login-box p { margin-top: -30px; margin-bottom: 30px; color: var(--text-muted); }
.btn-google { display: inline-flex; align-items: center; gap: 12px; padding: 12px 24px; background-color: #FFF; color: #333; border: 1px solid #CCC; border-radius: 8px; font-weight: 600; font-size: 16px; cursor: pointer; transition: all 0.2s ease; }
.btn-google:hover { background-color: #f7f7f7; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.login-error-message { color: var(--danger-color); margin-top: 16px; height: 20px; font-weight: 500; }

/* --- MAIN LAYOUT --- */
.dashboard-container { display: flex; min-height: 100vh; }

.sidebar {
    width: 260px;
    background-color: var(--bg-light);
    border-right: 1px solid var(--border-color);
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: fixed;
    height: 100%;
    z-index: 1000;
    transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    transition: margin-left 0.3s ease;
    
    /* --- The CSS Grid Fix --- */
    display: grid;
    /* 1st row for header (auto height), 2nd for content (takes rest of space) */
    grid-template-rows: auto 1fr; 
    /* Set a max-height to prevent the container itself from growing */
    height: 100vh;
    padding: 32px;
}

/* --- SIDEBAR --- */
.sidebar-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 40px; }
.sidebar-header .logo-wrapper { display: flex; align-items: center; gap: 12px; }
.sidebar-header .logo-icon { font-size: 28px; color: var(--primary-color); }
.sidebar-header h1 { font-size: 24px; font-weight: 700; }
.sidebar-nav ul { list-style-type: none; }
.sidebar-nav a { display: flex; align-items: center; gap: 16px; padding: 12px 16px; text-decoration: none; color: var(--text-muted); font-weight: 500; border-radius: 8px; transition: all 0.2s ease; margin-bottom: 4px; }
.sidebar-nav a:hover { background-color: var(--bg-lighter); color: var(--text-main); }
.sidebar-nav a.active { background-color: var(--primary-color); color: #FFF; }
.sidebar-nav a i { width: 20px; text-align: center; }
.sidebar-close-btn { font-size: 24px; color: var(--text-muted); cursor: pointer; display: none; }

/* --- SIDEBAR FOOTER --- */
.sidebar-footer { border-top: 1px solid var(--border-color); padding-top: 16px; }
.user-info { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.user-info img { width: 40px; height: 40px; border-radius: 50%; }
.user-info .name { font-weight: 600; font-size: 14px; }
.sidebar-footer-actions { display: flex; justify-content: space-between; align-items: center; }
.logout-link { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text-muted); font-weight: 500; border-radius: 8px; transition: all 0.2s ease; padding: 8px; }
.logout-link:hover { color: var(--danger-color); }
.theme-toggle { background: var(--bg-dark); border: 1px solid var(--border-color); border-radius: 50px; padding: 4px; cursor: pointer; display: flex; }
.theme-toggle .icon { font-size: 16px; padding: 4px; color: var(--text-muted); }
.theme-toggle .icon.sun { display: none; }
body.light-mode .theme-toggle .icon.sun { display: block; }
body.light-mode .theme-toggle .icon.moon { display: none; }

/* --- MAIN CONTENT HEADER --- */
.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px; 
    gap: 16px;
    /* The header now lives happily in the first grid row and won't be stretched */
}

.content-header .header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0; /* Allow the title container to shrink */
}
.content-header h2 {
    font-size: 28px;
    font-weight: 600;
    white-space: nowrap;      /* Prevent title from wrapping */
    overflow: hidden;         /* Hide overflow */
    text-overflow: ellipsis;  /* Add ... if it's too long */
}

.menu-toggle {
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    display: none;
}
/* --- PAGE SWITCHING --- */
.page { 
    display: none; 
    animation: fadeIn 0.5s ease;
    /* Allow individual pages to have their own scrollbars if content overflows */
    overflow: auto; 
}

.scheduler-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-grow: 1; /* ADD THIS LINE */
}

.page.active { 
    display: block; 
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ========================================================= */
/* ---                  RESPONSIVE STYLES                  --- */
/* ========================================================= */

/* --- TABLETS AND SMALLER (Sidebar behavior) --- */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.active {
        transform: translateX(0);
    }
    .sidebar-close-btn {
        display: block;
    }
    .main-content {
        margin-left: 0;
    }
    .menu-toggle {
        display: block;
    }
}

/* --- SMALLER TABLETS AND PHONES --- */
@media (max-width: 768px) {
    .main-content {
        padding: 24px;
    }
    .content-header h2 {
        font-size: 22px;
    }
    .dashboard-grid {
        grid-template-columns: 1fr; /* Stack live view and upcoming */
    }
  
    .scheduler-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .scheduler-nav {
        /* On mobile, this group contains the buttons and the date */
        display: flex;
        justify-content: space-between; 
        align-items: center;
        width: 100%;
        flex-grow: 0; /* Reset flex-grow for mobile */
    }
     .scheduler-nav h3 { /* The date */
        font-size: 16px; /* Make the date font smaller */
        font-weight: 600;
        text-align: right;
        min-width: 0;
        flex-shrink: 1; /* Allow date to shrink if needed */
    }
    .scheduler-view-options {
        margin-left: 0;
        width: 100%;
        justify-content: space-between;
    }
    .scheduler-nav .nav-buttons-group {
        display: flex;
        align-items: center;
        gap: 12px;
    }
    .form-group-row {
        flex-direction: column;
        gap: 0;
    }
    
    .header-actions .btn .btn-text {
        display: none;
    }

    .date-desktop {
        display: none; /* Hide desktop date on mobile */
    }
    .date-mobile {
        display: inline; /* Show mobile date on mobile */
    }
}

/* --- SMALL PHONES --- */
@media (max-width: 480px) {
    .main-content {
        padding: 16px;
    }
    .content-header {
        margin-bottom: 24px;
    }
    .header-actions .btn {
        padding: 8px 12px;
        font-size: 13px;
    }
    .login-box {
        padding: 32px 24px;
    }
    .modal-content {
        padding: 24px;
    }
}