/* ===========================================
   NEW UI - MODERN DARK THEME (GLOBAL & DATASET PAGES)
   =========================================== */

/* -- 1. Global Styles & Color Palette -- */
:root {
    --bg-primary: #0D1117;     /* Very dark blue/black - main background */
    --bg-secondary: #161B22;   /* Lighter panel background (cards, modals) */
    --bg-tertiary: #010409;    /* Darkest background for depth */
    --border-color: #30363D;    /* Subtle borders for panels and dividers */
    --text-primary: #E6EDF3;    /* Main text color - light gray */
    --text-secondary: #8B949E;  /* Secondary text color */
    --accent-blue: #2F81F7;     /* Primary accent color for buttons, links */
    --accent-green: #2DA44E;    /* For positive indicators, save button */
    --accent-red: #DA3633;      /* For destructive actions */
    --font-main: "Inter", "SF Pro Text", system-ui, -apple-system, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

/* -- 2. Header Redesign -- */
.header {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 0 24px;
    height: 64px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    box-shadow: none;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 100;
}
.header h1 { font-size: 18px; font-weight: 500; }
.nav-links { display: flex; gap: 8px; align-items: center; }
.nav-links a { color: var(--text-secondary); text-decoration: none; font-weight: 500; font-size: 14px; padding: 8px 12px; border-radius: 6px; border-bottom: 2px solid transparent; transition: all 0.2s ease; }
.nav-links a:hover { color: var(--text-primary); background-color: rgba(139, 148, 158, 0.1); }
.nav-links a.active { color: var(--text-primary); border-bottom-color: var(--accent-blue); background-color: transparent; }
.user-info { display: flex; align-items: center; gap: 1rem; }
.user-name { font-weight: 500; color: var(--text-primary); }
.header-profile-pic { width: 36px; height: 36px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: border-color 0.2s; object-fit: cover; }
.header-profile-pic:hover { border-color: var(--border-color); }

/* -- 3. Main Content Area -- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: calc(64px + 2.5rem) 2rem 2.5rem 2rem; /* Add padding-top to clear fixed header */
}

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    padding-top: 64px;
    height: 100vh;
}

.sidebar {
    width: 300px;
    background: var(--bg-tertiary);
    border-right: 1px solid var(--border-color);
    padding: 24px;
    overflow-y: auto;
    flex-shrink: 0;
}

.main-content {
    flex-grow: 1;
    padding: 24px 32px;
    overflow-y: auto;
}

.page-header { margin-bottom: 2.5rem; border-bottom: 1px solid var(--border-color); padding-bottom: 1.5rem; }
.page-header h2 { font-size: 28px; font-weight: 600; color: var(--text-primary); margin-bottom: 0.5rem; }
.page-header p { color: var(--text-secondary); font-size: 16px; max-width: 80ch; }

/* -- 4. Dashboard Sidebar Sections -- */
.profile-section {
    text-align: center;
    padding-bottom: 24px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.profile-picture-container {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 1rem;
}

.profile-picture { 
    width: 80px; 
    height: 80px; 
    border-radius: 50%; 
    object-fit: cover; 
    border: 2px solid var(--border-color); 
    margin-bottom: 12px; 
    cursor: pointer;
    transition: opacity 0.2s;
}

.profile-picture:hover {
    opacity: 0.8;
}

.profile-upload-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    cursor: pointer;
    transition: opacity 0.2s;
}

.profile-picture-container:hover .profile-upload-overlay {
    opacity: 1;
}

.upload-icon {
    color: white;
    font-size: 24px;
}

.profile-name { 
    font-size: 18px; 
    font-weight: 600; 
    color: var(--text-primary); 
    margin-bottom: 0.25rem;
}
.profile-email { 
    font-size: 14px; 
    color: var(--text-secondary); 
    margin-bottom: 16px; 
}
.maps-link { 
    text-decoration: none; 
    color: var(--text-secondary); 
    font-size: 14px;
    display: inline-block;
    background: rgba(47, 129, 247, 0.1);
    color: var(--accent-blue);
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 500;
    transition: background 0.2s;
}

.maps-link:hover {
    background: rgba(47, 129, 247, 0.2);
}

.section-header-sidebar, .maps-section-sidebar { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 1rem; 
}
.section-header-sidebar h3 { 
    font-size: 16px; 
    color: var(--text-primary); 
}
.view-all-link { 
    font-size: 13px; 
    color: var(--accent-blue); 
    text-decoration: none; 
    font-weight: 500; 
}
.view-all-link:hover {
    text-decoration: underline;
}

.recent-map-item { 
    display: flex; 
    align-items: center; 
    padding: 8px; 
    border-radius: 6px; 
    margin-bottom: 0.5rem; 
    transition: background-color 0.2s; 
    cursor: pointer; 
}
.recent-map-item:hover { 
    background: var(--bg-secondary); 
}
.map-icon { 
    background: var(--bg-secondary); 
    margin-right: 12px; 
    border-radius: 6px; 
    width: 32px; 
    height: 32px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    color: var(--text-primary); 
    font-size: 14px;
}

.recent-map-info {
    flex: 1;
}

.recent-map-name { 
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 2px;
}
.recent-map-date { 
    color: var(--text-secondary);
    font-size: 12px;
}
.no-maps-sidebar { 
    color: var(--text-secondary); 
    text-align: center; 
    padding: 1.5rem 0; 
}

.no-maps-sidebar p {
    margin-bottom: 1rem;
    font-size: 14px;
}

.create-first-map-btn {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.create-first-map-btn:hover {
    background: #3C8BFF;
}

/* Team Section */
.team-section {
    margin-bottom: 2rem;
}

.team-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.team-header h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin: 0;
}

.team-count {
    font-size: 14px;
    color: var(--text-secondary);
}

.team-member {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    transition: background 0.2s;
}

.team-member:hover {
    background: var(--bg-secondary);
}

.team-member-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 12px;
}

.team-member-info {
    flex: 1;
}

.team-member-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.admin-badge {
    background: var(--accent-blue);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

.team-member-email {
    font-size: 12px;
    color: var(--text-secondary);
}

/* -- 5. Main Content Sections & Cards -- */
.welcome-section, .maps-section, .guide-section, .settings-section, .setup-section {
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}
.welcome-section h2 { 
    font-size: 24px; 
    font-weight: 600; 
    color: var(--text-primary); 
    margin-bottom: 0.5rem; 
}
.welcome-section p { 
    color: var(--text-secondary); 
    font-size: 16px; 
    max-width: 75ch; 
}
.section-header { 
    padding: 0; 
    border-bottom: none; 
    margin-bottom: 1.5rem; 
    background: transparent; 
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.section-header h3 { 
    color: var(--text-primary);
    font-size: 20px;
}
.section-header p { 
    color: var(--text-secondary); 
}

/* -- 6. Dataset Cards Redesign -- */
.datasets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}
.dataset-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: none;
    overflow: hidden;
    transition: border-color 0.2s ease, transform 0.2s ease;
    display: flex;
    flex-direction: column;
}
.dataset-card:hover { border-color: #404852; transform: translateY(-4px); }
.dataset-card.pinned { border-color: var(--accent-blue); }

.dataset-header {
    background: #101419;
    color: var(--text-primary);
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}
.dataset-title { font-size: 16px; font-weight: 600; }
.dataset-title-editable { font: inherit; color: inherit; background: transparent; border: none; outline: none; padding: 2px; }
.dataset-title-editable:focus { background: rgba(59, 130, 246, 0.1); }
.edit-title-btn { background: transparent; opacity: 0.6; color: white; border: none; cursor: pointer; }
.edit-title-btn:hover { background: rgba(139, 148, 158, 0.1); opacity: 1; }

.dataset-pin {
    background: rgba(47, 129, 247, 0.2);
    color: #58A6FF;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 16px;
    font-weight: 500;
}

.dataset-dates { font-size: 11px; color: var(--text-secondary); }
.dataset-body { padding: 1.25rem; display: flex; flex-direction: column; flex-grow: 1; gap: 1rem; }
.dataset-meta { display: flex; flex-wrap: wrap; gap: 1.5rem; }
.dataset-stat { color: var(--text-secondary); font-size: 14px; display: flex; align-items: center; gap: 0.5rem; }
.dataset-stat .icon { font-size: 16px; color: var(--text-secondary); }
.dataset-stat .number { font-weight: 600; color: var(--text-primary); }
.dataset-actions { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--border-color); display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* Add New Dataset Card */
.add-dataset-card {
    border: 1px dashed var(--border-color);
    background: transparent;
    border-radius: 12px;
    min-height: 150px;
    color: var(--text-secondary);
    transition: all 0.2s;
    justify-content: center;
    align-items: center;
    display: flex;
    cursor: pointer;
}
.add-dataset-card:hover { border-color: var(--accent-blue); background: var(--bg-secondary); color: var(--text-primary); }
.add-dataset-content { text-align: center; }
.add-dataset-content .icon { font-size: 28px; color: var(--text-secondary); margin-bottom: 0.5rem; }
.add-dataset-content h3 { color: var(--text-primary); }

/* Maps Grid */
.maps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.map-card { 
    background: var(--bg-secondary); 
    border: 1px solid var(--border-color); 
    padding: 1.5rem; 
    border-radius: 8px; 
    transition: all 0.2s ease; 
    cursor: pointer; 
}
.map-card:hover { 
    border-color: var(--accent-blue); 
    transform: translateY(-3px); 
}
.map-card h4 { 
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 18px;
}
.map-card p { 
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 1rem;
}
.map-meta { 
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.no-maps, .no-datasets {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.no-maps h4, .no-datasets h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.empty-state h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

/* Create Map Card */
.create-map-card {
    border: 2px dashed var(--border-color);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 12px;
}

.create-map-card:hover {
    border-color: var(--accent-blue);
    background: var(--bg-secondary);
}

.create-map-content {
    text-align: center;
    color: var(--text-secondary);
}

.create-map-content .icon {
    font-size: 32px;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.create-map-content h3 {
    font-size: 16px;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.create-map-content p {
    font-size: 12px;
    margin: 0;
}

/* -- 7. Buttons & Interactive Elements -- */
.btn, .create-map-btn, .logout-btn, .setup-btn {
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    padding: 8px 14px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid var(--border-color);
    font-family: var(--font-main);
}
.btn-primary, .create-map-btn { 
    background: var(--accent-blue); 
    color: white; 
    border-color: var(--accent-blue); 
}
.btn-primary:hover, .create-map-btn:hover { 
    background: #3C8BFF; 
    border-color: #3C8BFF; 
}
.btn-secondary, .logout-btn { 
    background: #21262D; 
    color: var(--text-primary); 
    border-color: var(--border-color); 
}
.btn-secondary:hover, .logout-btn:hover { 
    border-color: var(--text-secondary); 
    background: #30363D; 
}
.btn-danger { 
    background: var(--accent-red); 
    color: white; 
    border-color: var(--accent-red); 
}
.btn-danger:hover { 
    background: #F85149; 
    border-color: #F85149; 
}
.btn-success { 
    background: var(--accent-green); 
    color: white; 
    border-color: var(--accent-green); 
}
.btn-success:hover { 
    background: #32B857; 
    border-color: #32B857; 
}

/* -- 8. Forms & Input Elements -- */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label { 
    color: var(--text-primary);
    font-weight: 500; 
    font-size: 14px;
    display: block;
    margin-bottom: 8px;
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-family: var(--font-main);
    transition: all 0.2s ease;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(47, 129, 247, 0.1);
    outline: none;
}
.form-group input::placeholder, .form-group textarea::placeholder {
    color: var(--text-secondary);
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
}

/* -- 9. Setup Section Styling -- */
.setup-section {
    background: rgba(47, 129, 247, 0.1);
    border-color: rgba(47, 129, 247, 0.3);
}

.setup-section h3 { 
    color: #58A6FF; 
    margin-bottom: 1rem;
}

.setup-section p { 
    color: var(--text-secondary); 
    margin-bottom: 1rem;
}

.setup-btn { 
    background: var(--accent-blue); 
    color: white; 
    border: none; 
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.setup-btn:hover { 
    background: #3C8BFF; 
}

/* -- 10. Edit Dataset Modal -- */
.edit-modal-overlay, .modal-overlay, .create-modal-overlay, .crop-modal-overlay { 
    background: rgba(13, 17, 23, 0.6); 
    backdrop-filter: blur(5px); 
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.edit-modal-overlay.active, .modal-overlay.active, .create-modal-overlay.active {
    display: flex;
}

.edit-modal, .setup-modal, .create-modal, .crop-modal { 
    background: var(--bg-secondary); 
    border: 1px solid var(--border-color); 
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); 
    border-radius: 12px; 
    max-width: 90vw;
    width: 1000px;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
}

.edit-modal-header, .modal-header, .create-modal-header, .crop-modal-header { 
    background: transparent; 
    border-bottom: 1px solid var(--border-color); 
    text-align: left; 
    padding: 1.5rem 2rem; 
    position: relative;
}
.edit-modal-header h2, .modal-header h2, .create-modal-header h2, .crop-modal-header h3 { 
    text-align: left; 
    color: var(--text-primary); 
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}
.edit-modal-header p, .modal-header p, .create-modal-header p { 
    text-align: left; 
    color: var(--text-secondary); 
    margin: 0.5rem 0 0 0;
}
.edit-modal-close, .modal-close, .create-modal-close, .crop-close-btn { 
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px; 
    height: 36px; 
    font-size: 20px; 
    background: transparent; 
    color: var(--text-secondary); 
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.edit-modal-close:hover, .modal-close:hover, .create-modal-close:hover, .crop-close-btn:hover { 
    background: rgba(139, 148, 158, 0.1); 
    color: var(--text-primary); 
}

.edit-tabs { 
    background: var(--bg-primary); 
    border-bottom: 1px solid var(--border-color); 
    display: flex;
}
.edit-tab { 
    color: var(--text-secondary); 
    border-bottom: 3px solid transparent; 
    font-size: 14px; 
    padding: 12px 24px; 
    cursor: pointer;
    background: transparent;
    border: none;
    transition: all 0.2s;
}
.edit-tab:hover { 
    color: var(--text-primary); 
    background: var(--bg-secondary); 
}
.edit-tab.active { 
    color: var(--text-primary); 
    background: var(--bg-secondary); 
    border-bottom-color: var(--accent-blue); 
}
.edit-modal-body, .modal-body, .create-modal-body, .crop-modal-body { 
    height: calc(85vh - 140px); 
    color: var(--text-primary);
    overflow-y: auto;
}
.edit-tab-content { 
    padding: 24px; 
}

/* Data Table in Modal */
.data-table { 
    background: var(--bg-primary); 
    width: 100%;
    border-collapse: collapse;
}
.data-table th { 
    background: var(--bg-secondary); 
    color: var(--text-primary); 
    border: 1px solid var(--border-color); 
    font-size: 12px; 
    text-transform: uppercase; 
    padding: 12px;
    text-align: left;
    font-weight: 600;
    letter-spacing: 0.5px;
}
.data-table td { 
    border: 1px solid var(--border-color); 
    color: var(--text-secondary); 
    padding: 12px;
    vertical-align: middle;
}
.data-table tr:hover td { 
    background: var(--bg-secondary); 
}
.data-table th:last-child { 
    background: var(--bg-secondary); 
    box-shadow: -10px 0 15px -8px rgba(0, 0, 0, 0.4); 
    position: sticky;
    right: 0;
}
.data-table td:last-child { 
    background: var(--bg-primary); 
    box-shadow: -10px 0 15px -8px rgba(0, 0, 0, 0.2); 
    position: sticky;
    right: 0;
}
.data-table tr:hover td:last-child { 
    background: var(--bg-secondary); 
}
.action-icon-btn { 
    color: var(--text-secondary); 
    background: transparent;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}
.action-icon-btn:hover { 
    background: var(--bg-tertiary); 
    color: var(--text-primary); 
}

/* Add Record & Upload CSV Forms */
.add-record-form, .csv-upload-area { 
    background: var(--bg-primary); 
    border: 1px solid var(--border-color); 
    border-radius: 8px; 
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.add-record-form h3, .csv-preview h4 { 
    color: var(--text-primary); 
    margin-bottom: 1rem;
}
.add-record-form p { 
    color: var(--text-secondary); 
    margin-bottom: 1rem;
}
.csv-upload-area { 
    border-style: dashed; 
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}
.csv-upload-area:hover { 
    border-color: var(--accent-blue); 
    background: var(--bg-secondary); 
}

.csv-preview {
    margin-top: 1rem;
}

.modal-footer, .create-modal-footer {
    border-top: 1px solid var(--border-color);
    background: rgba(1, 4, 9, 0.6);
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Step Indicators */
.step-indicator {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 1.5rem;
}

.step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: background 0.3s;
}

.step-dot.active {
    background: var(--accent-blue);
}

.step {
    display: none;
}

.step.active {
    display: block;
}

/* Option Cards */
.option-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.option-card {
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: var(--bg-primary);
}

.option-card:hover {
    border-color: var(--accent-blue);
    background: rgba(47, 129, 247, 0.05);
    transform: translateY(-2px);
}

.option-card.selected {
    border-color: var(--accent-blue);
    background: var(--accent-blue);
    color: white;
}

.option-card h4 {
    margin: 0 0 0.5rem 0;
    font-size: 16px;
}

.option-card p {
    margin: 0;
    font-size: 14px;
    opacity: 0.8;
}

/* School Entry Forms */
.school-entry-form {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    background: var(--bg-primary);
}

.school-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.school-entry-header h4 {
    margin: 0;
    color: var(--text-primary);
}

.remove-school-btn {
    background: var(--accent-red);
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.add-school-btn {
    background: var(--accent-green);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    width: 100%;
    margin-top: 1rem;
    transition: background 0.2s;
}

.add-school-btn:hover {
    background: #32B857;
}

/* -- 11. Authentication Pages -- */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.auth-card h2 {
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
    text-align: center;
}

.auth-card p {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 2rem;
}

.logo {
    text-align: center;
    margin-bottom: 30px;
}

.logo h1 {
    color: var(--text-primary);
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 5px;
}

.logo p {
    color: var(--text-secondary);
    font-size: 16px;
}

.auth-link {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color 0.2s ease;
}

.auth-link:hover {
    color: #3C8BFF;
}

.login-btn, .signup-btn {
    width: 100%;
    background: var(--accent-blue);
    color: white;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
    margin-bottom: 16px;
}

.login-btn:hover, .signup-btn:hover {
    background: #3C8BFF;
}

.google-btn {
    width: 100%;
    background: #4285f4;
    color: white;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
    margin-bottom: 20px;
}

.google-btn:hover {
    background: #357ae8;
}

.divider {
    text-align: center;
    margin: 20px 0;
    color: var(--text-secondary);
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-color);
    z-index: 1;
}

.divider span {
    background: var(--bg-secondary);
    padding: 0 15px;
    position: relative;
    z-index: 2;
}

.signup-link, .login-link {
    text-align: center;
}

.signup-link a, .login-link a {
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 600;
}

.signup-link a:hover, .login-link a:hover {
    text-decoration: underline;
}

.error-message {
    background: rgba(218, 54, 51, 0.1);
    color: #F8716D;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
    border: 1px solid rgba(218, 54, 51, 0.3);
}

.success-message {
    background: rgba(45, 164, 78, 0.1);
    color: #52D57D;
    border: 1px solid rgba(45, 164, 78, 0.3);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
}

/* School Selection */
.school-selection {
    margin-bottom: 20px;
}

.school-selection select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
}

.school-selection select:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.org-name {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 10px;
    padding: 10px;
    background: var(--bg-primary);
    border-radius: 8px;
    text-align: center;
}

/* Maps specific styling */
.map-header {
    background: #101419;
    color: var(--text-primary);
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 50px;
}

.map-title-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.map-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.map-title-editable {
    background: none;
    border: none;
    color: white;
    font-size: 16px;
    font-weight: 600;
    padding: 0;
    margin: 0;
    outline: none;
}

.map-title-editable:focus {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
}

.map-dates {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    text-align: right;
    line-height: 1.4;
}

.map-dates .date-line {
    margin-bottom: 0.2rem;
}

.map-dates .date-line:last-child {
    margin-bottom: 0;
}

.map-dates strong {
    font-weight: 600;
}

.map-body {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.map-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 14px;
}

.map-stat .icon {
    font-size: 16px;
    color: var(--text-secondary);
}

.map-stat .number {
    font-weight: 600;
    color: var(--text-primary);
}

.map-actions {
    display: flex;
    gap: 0.5rem;
}

.map-actions .btn {
    padding: 0.4rem 0.8rem;
    font-size: 12px;
    border-radius: 4px;
}

.dataset-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.dataset-chip {
    background: rgba(47, 129, 247, 0.1);
    color: var(--accent-blue);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

/* Dataset Table Specific Elements */
.dataset-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
}

.dataset-table {
    width: 100%;
    border-collapse: collapse;
}

.dataset-table th {
    background: var(--bg-secondary);
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

.dataset-table th:first-child {
    width: 40px;
    text-align: center;
}

.dataset-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.dataset-table tr:last-child td {
    border-bottom: none;
}

.dataset-table tr:hover {
    background: var(--bg-secondary);
}

.dataset-table tr.selected {
    background: rgba(47, 129, 247, 0.1);
}

.dataset-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.dataset-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.dataset-records {
    font-weight: 600;
    color: var(--accent-blue);
}

.dataset-geocoded {
    font-size: 12px;
    color: var(--accent-green);
}

.dataset-date {
    font-size: 12px;
    color: var(--text-secondary);
}

.dataset-selection {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    background: var(--bg-secondary);
}

.dataset-selection h4 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
}

.no-datasets {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.no-datasets a {
    color: var(--accent-blue);
    text-decoration: none;
}

.no-datasets a:hover {
    text-decoration: underline;
}

/* -- 12. Responsive Design -- */
@media (max-width: 768px) {
    .dashboard-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .main-content {
        padding: 16px;
    }
    
    .maps-grid, .datasets-grid {
        grid-template-columns: 1fr;
    }
    
    .nav-links {
        display: none;
    }

    .container {
        padding: calc(64px + 1rem) 1rem 1rem 1rem;
    }
}

/* -- 13. Utility Classes -- */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.flex { display: flex; }
.flex-column { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

.hidden { display: none; }
.block { display: block; }

hr { 
    border: none;
    border-top: 1px solid var(--border-color); 
    margin: 1.5rem 0;
}