:root { --bg: #1a2035; --panel: #2a3149; --text: #e1e1e1; --accent: #4a90e2; }
body { margin: 0; font-family: sans-serif; background: var(--bg); color: var(--text); }
.app-container { display: flex; height: 100vh; }
.sidebar { width: 250px; background: var(--panel); padding: 20px; display: flex; flex-direction: column; }
.sidebar ul { list-style: none; padding: 0; }
.sidebar li a { display: block; padding: 10px; color: #a0a8c2; text-decoration: none; border-radius: 5px; margin-bottom: 5px;}
.sidebar li a.active, .sidebar li a:hover { background: var(--accent); color: white; }
.brand { font-size: 1.5em; font-weight: bold; margin-bottom: 30px; color: white; }
.main-content { flex: 1; padding: 30px; overflow-y: auto; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 30px; }
.stat-card { background: var(--panel); padding: 20px; border-radius: 8px; text-align: center; }
.stat-card h3 { margin: 0; font-size: 0.9em; color: #a0a8c2; }
.stat-card p { font-size: 1.8em; margin: 10px 0 0; font-weight: bold; }

.table-wrapper { background: var(--panel); padding: 20px; border-radius: 8px; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 12px; text-align: left; border-bottom: 1px solid #3a415a; }

.linker-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; height: 500px; }
.linker-col { background: var(--panel); padding: 20px; border-radius: 8px; display: flex; flex-direction: column; }
.scroll-list { flex: 1; overflow-y: auto; border: 1px solid #3a415a; padding: 10px; margin-top: 10px; }
.list-item { padding: 10px; border-bottom: 1px solid #3a415a; cursor: pointer; display: flex; align-items: center; gap: 10px;}
.list-item:hover, .list-item.active { background: #3a415a; }

.btn-primary { background: var(--accent); border: none; padding: 10px 20px; color: white; border-radius: 5px; cursor: pointer; }
.btn-secondary { background: #3a415a; border: 1px solid #a0a8c2; padding: 8px 15px; color: white; cursor: pointer; }
.full-width { width: 100%; padding: 10px; background: #1a2035; border: 1px solid #3a415a; color: white; box-sizing: border-box; }
.mb-10 { margin-bottom: 10px; }

/* Sidebar Submenu */
.submenu {
    list-style: none;
    padding-left: 20px !important; /* Indent */
    margin-top: 5px;
    margin-bottom: 5px;
}

.submenu li a {
    font-size: 0.9em;
    padding: 8px 10px;
    border-left: 2px solid #3a415a; /* Visual guide line */
    border-radius: 0 5px 5px 0;
}

.submenu li a:hover, .submenu li a.active {
    border-left-color: #4a90e2; /* Highlight line on hover */
    background: rgba(74, 144, 226, 0.1); /* Subtle background */
}

/* --- VISUAL POLISH --- */

/* 1. Sidebar Logout Button */
.logout-btn {
    width: 100%;
    padding: 12px;
    background-color: transparent;
    border: 1px solid #e74c3c;
    color: #e74c3c;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    margin-top: 20px;
}
.logout-btn:hover {
    background-color: #e74c3c;
    color: white;
}

/* 2. Tab Buttons (Schools Modal & Linking Page) */
.tab-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    border-bottom: 1px solid #3a415a;
    padding-bottom: 10px;
}

.tab-btn {
    background: none;
    border: none;
    color: #a0a8c2;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 500;
    border-radius: 4px;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: white;
    background: #4a90e2;
}

/* 3. Input Fields (Global Fix for Settings, Modals, etc) */
input[type="text"], 
input[type="password"], 
textarea, 
select {
    background-color: #1a2035;
    border: 1px solid #3a415a;
    color: white;
    padding: 10px;
    border-radius: 4px;
    outline: none;
    font-size: 14px;
    transition: border-color 0.2s;
}

input:focus, textarea:focus, select:focus {
    border-color: #4a90e2;
}

/* 4. Custom Checkboxes (Linking Page) */
/* Hide the default ugly checkbox */
.list-item input[type="checkbox"] {
    display: none;
}

/* Create a custom box */
.list-item input[type="checkbox"] + label {
    position: relative;
    padding-left: 35px; /* Make space for the box */
    cursor: pointer;
    display: block;
    user-select: none;
}

.list-item input[type="checkbox"] + label::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: 2px solid #3a415a;
    border-radius: 4px;
    background: #1a2035;
    transition: all 0.2s;
}

/* Checked State */
.list-item input[type="checkbox"]:checked + label::before {
    background: #4a90e2;
    border-color: #4a90e2;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white' width='18px' height='18px'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
    background-position: center;
    background-repeat: no-repeat;
}

/* Hover Effect */
.list-item:hover {
    background-color: rgba(74, 144, 226, 0.05);
}

/* Custom Checkbox Style matching Schools page checkbox with Linking Page check box */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    user-select: none;
}

.checkbox-wrapper input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #1a2035;
    border: 1px solid #3a415a;
    border-radius: 4px;
    margin-right: 8px;
    cursor: pointer;
    position: relative;
    display: inline-block;
}

.checkbox-wrapper input[type="checkbox"]:checked {
    background: #4a90e2;
    border-color: #4a90e2;
}

.checkbox-wrapper input[type="checkbox"]:checked::after {
    content: '✔';
    color: white;
    font-size: 12px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.checkbox-wrapper label {
    color: #a0a8c2;
    cursor: pointer;
    font-size: 0.9em;
}

.checkbox-wrapper input[type="checkbox"]:checked + label {
    color: #e1e1e1; /* Brighter text when checked */
}