/* ============================================================
   Student Records System — Main Stylesheet
   Aesthetic: Bold Black & Pink
   ============================================================ */

:root {
    --bg:        #F7F7F7;
    --surface:   #FFFFFF;
    --surface2:  #F2F2F2;
    --border:    #E8E8E8;
    --border-2:  #D0D0D0;
    --text:      #111111;
    --text-2:    #444444;
    --text-3:    #999999;
    --accent:    #FC6377;
    --accent-2:  #e8404f;
    --accent-lt: #FFF0F2;
    --danger:    #C0392B;
    --danger-lt: #FDECEA;
    --success:   #1A7A4A;
    --success-lt:#E8F5EE;
    --warn:      #B45309;
    --warn-lt:   #FEF3C7;
    --sidebar-w: 240px;
    --radius:    8px;
    --radius-lg: 14px;
    --shadow:    0 1px 4px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.05);
    --shadow-lg: 0 4px 24px rgba(0,0,0,.14);
    --font-display: 'DM Serif Display', Georgia, serif;
    --font-body:    'DM Sans', system-ui, sans-serif;
    --transition: 0.18s ease;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
    line-height: 1.6;
}

/* ============================================================ Sidebar */
.sidebar {
    width: var(--sidebar-w);
    background: #111111;
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,.12);
    margin-bottom: 12px;
}

.sidebar-logo {
    max-width: 160px;
    max-height: 60px;
    width: 100%;
    object-fit: contain;
}

.nav-links { list-style: none; padding: 0 10px; flex: 1; }
.nav-links li { margin-bottom: 2px; }

.nav-section-label {
    font-size: 10px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(255,255,255,.35);
    padding: 12px 10px 4px;
    font-weight: 500;
}

.nav-links a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius);
    color: rgba(255,255,255,.75);
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    transition: background var(--transition), color var(--transition);
}

.nav-links a svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .8; }
.nav-links a:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-links a.active { background: var(--accent); color: #fff; font-weight: 500; }

/* ============================================================ Main Content */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-height: 100vh;
}

.page-inner {
    max-width: 1400px;
    padding: 36px 32px;
}

/* ============================================================ Page Header */
.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-header-text h1 {
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 400;
    line-height: 1.15;
    color: var(--text);
}

.page-header-text p {
    color: var(--text-2);
    font-size: 14px;
    margin-top: 4px;
}

/* ============================================================ Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    border: none;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover { background: var(--accent-2); }

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--border-2); background: var(--surface2); }

.btn-danger {
    background: var(--danger-lt);
    color: var(--danger);
    border: 1px solid #F5C6C2;
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-sm { padding: 6px 12px; font-size: 13px; }

.btn-icon {
    width: 34px; height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    background: transparent;
    border: 1px solid var(--border);
    cursor: pointer;
    color: var(--text-2);
    transition: all var(--transition);
}
.btn-icon svg { width: 15px; height: 15px; }
.btn-icon:hover { border-color: var(--accent); color: var(--accent); }
.btn-icon.danger:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-lt); }

/* ============================================================ Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: clip; /* clip background without clipping child borders */
}

/* ============================================================ Toolbar / Filters */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-wrap {
    position: relative;
    flex: 1;
    min-width: 220px;
    max-width: 380px;
}

.search-wrap svg {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    width: 15px; height: 15px;
    color: var(--text-3);
    pointer-events: none;
}

.search-wrap input {
    width: 100%;
    padding: 9px 12px 9px 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 14px;
    background: var(--surface);
    color: var(--text);
    transition: border-color var(--transition);
}
.search-wrap input:focus { outline: none; border-color: var(--accent); }

.filter-select {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 14px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    min-width: 150px;
}
.filter-select:focus { outline: none; border-color: var(--accent); }

/* ============================================================ Table */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); }

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

thead tr {
    background: var(--surface2);
    border-bottom: 2px solid var(--border);
}

thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-2);
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }

tbody td {
    padding: 13px 16px;
    font-size: 14px;
    color: var(--text);
    vertical-align: middle;
}

/* ============================================================ Student Avatar */
.student-avatar {
    display: flex;
    align-items: center;
    gap: 11px;
}

.avatar-img {
    width: 38px; height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    flex-shrink: 0;
}

.avatar-placeholder {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: #FFF0F2;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 14px;
    color: var(--accent);
    flex-shrink: 0;
}

.student-name { font-weight: 500; line-height: 1.3; }
.student-email { font-size: 12px; color: var(--text-3); }

/* ============================================================ Badge */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}
.badge::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: .8;
}

/* ============================================================ Form */
.form-card { padding: 0; overflow: hidden; }

.form-section {
    border-bottom: 1px solid var(--border);
}

.form-section:last-child { border-bottom: none; }

.form-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 28px;
    background: var(--surface2);
    cursor: pointer;
    user-select: none;
}

.form-section-icon {
    width: 36px; height: 36px;
    background: #FFF0F2;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.form-section-icon svg { width: 17px; height: 17px; color: var(--accent); }

.form-section-title { font-weight: 600; font-size: 15px; flex: 1; }
.form-section-desc { font-size: 12px; color: var(--text-3); margin-top: 1px; }

.section-toggle {
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-3);
    transition: transform var(--transition);
}
.section-toggle svg { width: 15px; height: 15px; }
.form-section.collapsed .section-toggle { transform: rotate(-90deg); }

.form-section-body {
    padding: 24px 28px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px 24px;
}
.form-section.collapsed .form-section-body { display: none; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-group.half { grid-column: span 2; }

label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--text-2);
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="number"],
input[type="password"],
select,
textarea {
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    transition: border-color var(--transition), box-shadow var(--transition);
    width: 100%;
    box-sizing: border-box;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    outline: none;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(252,99,119,.12);
}

/* Force consistent styling on browser-native input types */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    opacity: 0.5;
    cursor: pointer;
}

input[readonly] {
    background: var(--surface2);
    color: var(--text-3);
    cursor: not-allowed;
}

textarea { resize: vertical; min-height: 80px; }

select { cursor: pointer; }

.field-note {
    font-size: 11px;
    color: var(--text-3);
    margin-top: 1px;
}

/* Photo Upload */
.photo-upload-wrap {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    grid-column: 1 / -1;
}

.photo-preview {
    width: 100px; height: 100px;
    border-radius: 12px;
    background: var(--surface2);
    border: 2px dashed var(--border);
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: border-color var(--transition);
}
.photo-preview:hover { border-color: var(--accent); }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.photo-preview-placeholder { text-align: center; color: var(--text-3); }
.photo-preview-placeholder svg { width: 28px; height: 28px; margin-bottom: 4px; }
.photo-preview-placeholder span { font-size: 10px; display: block; }

.photo-upload-info { flex: 1; }
.photo-upload-info h4 { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.photo-upload-info p { font-size: 12px; color: var(--text-3); line-height: 1.5; }

input[type="file"] {
    font-size: 13px;
    padding: 7px 10px;
    margin-top: 8px;
}

/* Form Actions */
.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 28px;
    border-top: 1px solid var(--border);
    background: var(--surface2);
}

/* ============================================================ Alerts */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
    border: 1px solid;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--success-lt); color: var(--success); border-color: #A7D7BC; }
.alert-danger  { background: var(--danger-lt);  color: var(--danger);  border-color: #F5C6C2; }
.alert-warn    { background: var(--warn-lt);    color: var(--warn);    border-color: #FDE68A; }

/* ============================================================ Empty State */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-3);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: 14px; opacity: .4; }
.empty-state h3 { font-family: var(--font-display); font-size: 20px; color: var(--text-2); margin-bottom: 6px; }
.empty-state p { font-size: 14px; }

/* ============================================================ Student Detail View */
.detail-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    align-items: start;
}

.detail-sidebar { display: flex; flex-direction: column; gap: 16px; }

.student-profile-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    text-align: center;
    box-shadow: var(--shadow);
}

.profile-photo {
    width: 100px; height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border);
    margin: 0 auto 14px;
    display: block;
}

.profile-photo-placeholder {
    width: 100px; height: 100px;
    border-radius: 50%;
    background: #FFF0F2;
    border: 3px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 32px;
    color: var(--accent);
    margin: 0 auto 14px;
}

.profile-name {
    font-family: var(--font-display);
    font-size: 22px;
    line-height: 1.2;
    margin-bottom: 4px;
}

.profile-file {
    font-size: 13px;
    color: var(--text-3);
    margin-bottom: 12px;
}

.meta-table { width: 100%; font-size: 13px; }
.meta-table tr td:first-child { color: var(--text-3); padding-right: 12px; width: 40%; }
.meta-table tr td { padding: 5px 0; vertical-align: top; border-bottom: 1px solid var(--surface2); }
.meta-table tr:last-child td { border-bottom: none; }

.detail-sections { display: flex; flex-direction: column; gap: 16px; }

.detail-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.detail-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: var(--surface2);
    border-bottom: 1px solid var(--border);
}

.detail-card-header svg { width: 16px; height: 16px; color: var(--accent); }
.detail-card-header h3 { font-size: 14px; font-weight: 600; }

.detail-card-body {
    padding: 18px 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.detail-field label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-3);
    margin-bottom: 2px;
}

.detail-field span {
    font-size: 14px;
    color: var(--text);
}

.detail-field span.empty {
    color: var(--text-3);
    font-style: italic;
}

/* ============================================================ Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-2);
}

/* ============================================================ Confirm Dialog */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    backdrop-filter: blur(3px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
}
.overlay.show { opacity: 1; pointer-events: all; }

.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 380px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    transform: translateY(16px) scale(.97);
    transition: transform .25s cubic-bezier(.34,1.56,.64,1);
}
.overlay.show .modal { transform: none; }

.modal h3 { font-family: var(--font-display); font-size: 20px; margin-bottom: 10px; }
.modal p { font-size: 14px; color: var(--text-2); margin-bottom: 22px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ============================================================ Stats Bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow);
}

.stat-value {
    font-family: var(--font-display);
    font-size: 28px;
    line-height: 1;
    color: var(--accent);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: .06em;
}

/* ============================================================ Responsive */
@media (max-width: 900px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; }
    .page-inner { padding: 24px 16px; }
    .detail-grid { grid-template-columns: 1fr; }
}

/* ============================================================ Sidebar Footer */
.sidebar-footer {
    margin-top: auto;
    padding: 16px 12px;
    border-top: 1px solid rgba(255,255,255,.12);
}

.session-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    color: rgba(255,255,255,.7);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.session-user svg { width: 15px; height: 15px; flex-shrink: 0; opacity: .7; }

.session-timer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    color: rgba(255,255,255,.5);
    font-size: 12px;
    font-family: monospace;
    letter-spacing: .04em;
    border-radius: var(--radius);
    margin-bottom: 4px;
    transition: color var(--transition), background var(--transition);
}
.session-timer svg { width: 14px; height: 14px; flex-shrink: 0; }
.session-timer.timer-warn {
    color: #FC6377;
    background: rgba(252,99,119,.12);
}

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 12px;
    border-radius: var(--radius);
    color: rgba(255,255,255,.6);
    text-decoration: none;
    font-size: 14px;
    transition: background var(--transition), color var(--transition);
    width: 100%;
}
.sidebar-logout svg { width: 15px; height: 15px; flex-shrink: 0; }
.sidebar-logout:hover {
    background: rgba(252,99,119,.2);
    color: #FC6377;
}



/* ============================================================ Settings Card Header (global) */
.settings-card-header {
    padding: 18px 24px;
    background: var(--surface2);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ============================================================ Settings Tabs (global) */
.settings-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 5px;
    flex-wrap: wrap;
    width: fit-content;
    max-width: 100%;
}

.stab {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
}

.stab svg { width: 15px; height: 15px; }
.stab:hover { background: var(--surface2); color: var(--text); }
.stab.active { background: var(--accent); color: #fff; }
.stab.active svg { stroke: #fff; }
