/* ─── Variables ─────────────────────────────────────────────────────────────── */
:root {
    --primary:       #3B9ED0;
    --primary-dark:  #2C85B5;
    --primary-light: #EAF5FB;
    --accent:        #FFCE3A;
    --accent-dark:   #E5B530;
    --green:         #4DB89E;
    --coral:         #FF7B5E;

    --sidebar-bg:     #1E3A4A;
    --sidebar-hover:  #2A4F63;
    --admin-bg:       #F2F7FA;
    --card-bg:        #FFFFFF;

    --text:          #1E3A4A;
    --text-muted:    #6B8FA0;
    --border:        #D0E8F4;

    --shadow-sm:  0 2px 12px rgba(30,58,74,.08);
    --shadow:     0 4px 24px rgba(30,58,74,.12);

    --radius-sm: 8px;
    --radius:    14px;
    --radius-lg: 20px;

    --font: 'Nunito', sans-serif;
    --sidebar-w: 240px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { height: 100%; }
body { font-family: var(--font); background: var(--admin-bg); color: var(--text); line-height: 1.5; min-height: 100%; }
a    { color: var(--primary); text-decoration: none; }
ul   { list-style: none; }
img  { max-width: 100%; display: block; }

/* ─── Layout ─────────────────────────────────────────────────────────────────── */
.admin-layout { display: flex; min-height: 100vh; }

/* ─── Sidebar ────────────────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 200;
    flex-shrink: 0;
}
.sidebar-brand {
    padding: 22px 18px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-squid-logo { font-size: 1.8rem; display: block; margin-bottom: 6px; animation: squid-bob 2.8s ease-in-out infinite; }
.sidebar-brand-name { font-size: 1rem; font-weight: 900; color: #fff; }
.sidebar-brand-sub  { font-size: .72rem; color: rgba(255,255,255,.45); font-weight: 600; margin-top: 2px; }

.sidebar-nav        { padding: 14px 10px; flex: 1; }
.sidebar-section    { font-size: .65rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: rgba(255,255,255,.28); padding: 14px 10px 5px; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,.65);
    font-weight: 700;
    font-size: .88rem;
    transition: all .2s;
    margin-bottom: 2px;
}
.sidebar-nav a:hover   { background: var(--sidebar-hover); color: #fff; }
.sidebar-nav a.active  { background: var(--primary); color: #fff; }
.sidebar-nav .nav-icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-footer { padding: 14px 10px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-footer a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: var(--radius-sm);
    color: rgba(255,255,255,.45); font-weight: 600; font-size: .85rem; transition: all .2s;
}
.sidebar-footer a:hover { background: rgba(255,255,255,.05); color: rgba(255,255,255,.8); }

/* ─── Main ───────────────────────────────────────────────────────────────────── */
.admin-main {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.admin-topbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 15px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0; z-index: 100;
    box-shadow: var(--shadow-sm);
}
.admin-topbar-title { font-size: 1.2rem; font-weight: 800; }
.admin-topbar-meta  { font-size: .82rem; color: var(--text-muted); margin-top: 1px; font-weight: 600; }
.admin-topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-user        { font-size: .85rem; font-weight: 700; color: var(--text-muted); }

.admin-content { padding: 28px; flex: 1; max-width: 1200px; }

/* ─── Stats Grid ─────────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 18px; margin-bottom: 28px; }
.stat-card  {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
}
.stat-icon {
    width: 50px; height: 50px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; flex-shrink: 0;
}
.si-blue   { background: var(--primary-light); }
.si-green  { background: #e2f7f2; }
.si-yellow { background: #fff8e0; }
.si-coral  { background: #ffeee9; }

.stat-value { font-size: 1.9rem; font-weight: 900; line-height: 1; }
.stat-label { font-size: .78rem; color: var(--text-muted); font-weight: 700; margin-top: 3px; }

/* ─── Cards ──────────────────────────────────────────────────────────────────── */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    overflow: hidden;
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}
.card-title   { font-size: 1rem; font-weight: 800; }
.card-body    { padding: 22px; }
.card-body-sm { padding: 14px 22px; }

/* ─── Table ──────────────────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left;
    padding: 10px 14px;
    font-size: .75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.data-table td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--border);
    font-size: .9rem;
    vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--primary-light); }

/* ─── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-family: var(--font); font-weight: 700; font-size: .88rem;
    cursor: pointer; border: none; transition: all .2s;
    text-decoration: none; line-height: 1;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #3da589; color: #fff; }
.btn-warning { background: #fff8e0; color: #a07500; }
.btn-warning:hover { background: #fff0b3; color: #886200; }
.btn-danger  { background: #ffe8e8; color: #c03333; }
.btn-danger:hover  { background: #ffd0d0; color: #a02020; }
.btn-outline { background: transparent; border: 2px solid var(--border); color: var(--text-muted); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm  { padding: 5px 11px; font-size: .8rem; }
.btn-lg  { padding: 13px 28px; font-size: .97rem; }
.btn-block { width: 100%; justify-content: center; }

/* ─── Forms ──────────────────────────────────────────────────────────────────── */
.form-group  { margin-bottom: 18px; }
.form-label  { display: block; font-weight: 700; font-size: .84rem; color: var(--text); margin-bottom: 5px; }
.form-control {
    width: 100%; padding: 10px 14px;
    background: var(--admin-bg); border: 2px solid var(--border);
    border-radius: var(--radius-sm); font-family: var(--font);
    font-size: .9rem; color: var(--text); outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,158,208,.14); background: #fff; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }
.form-hint  { font-size: .76rem; color: var(--text-muted); margin-top: 4px; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-divider { border: none; border-top: 1px solid var(--border); margin: 22px 0; }

/* ─── Alerts ─────────────────────────────────────────────────────────────────── */
.alert      { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 20px; font-weight: 600; font-size: .88rem; }
.alert-success { background: #e4f8f4; color: #1a7a60; border-left: 4px solid var(--green); }
.alert-error   { background: #ffe8e8; color: #c03333; border-left: 4px solid var(--coral); }
.alert-info    { background: var(--primary-light); color: var(--primary-dark); border-left: 4px solid var(--primary); }

/* ─── Badges ─────────────────────────────────────────────────────────────────── */
.badge       { display: inline-block; padding: 2px 10px; border-radius: 100px; font-size: .73rem; font-weight: 800; }
.badge-green { background: #e2f7f2; color: #1a7a60; }
.badge-gray  { background: #eef0f2; color: #7b8c96; }
.badge-blue  { background: var(--primary-light); color: var(--primary); }
.badge-coral { background: #ffeee9; color: var(--coral); }

/* ─── Document list ──────────────────────────────────────────────────────────── */
.doc-list   { display: flex; flex-direction: column; gap: 10px; }
.doc-item   {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--admin-bg); border-radius: var(--radius-sm);
    padding: 11px 14px; border: 1px solid var(--border);
    gap: 12px;
}
.doc-icon       { font-size: 1.4rem; flex-shrink: 0; }
.doc-name       { font-weight: 700; font-size: .88rem; }
.doc-meta       { font-size: .75rem; color: var(--text-muted); margin-top: 2px; }
.doc-item-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ─── Notes feed ─────────────────────────────────────────────────────────────── */
.note-feed  { display: flex; flex-direction: column; gap: 12px; }
.note-item  {
    background: var(--admin-bg); border-radius: var(--radius-sm);
    padding: 13px 16px; border-left: 3px solid var(--primary);
}
.note-meta  { font-size: .75rem; color: var(--text-muted); font-weight: 700; margin-bottom: 5px; }
.note-text  { font-size: .9rem; line-height: 1.55; }

/* ─── Student profile header ─────────────────────────────────────────────────── */
.student-header {
    display: flex; align-items: center; gap: 20px;
    padding-bottom: 22px; margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
}
.student-avatar {
    width: 68px; height: 68px;
    background: linear-gradient(135deg, var(--primary), var(--green));
    border-radius: 18px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem; color: #fff; font-weight: 900; flex-shrink: 0;
}
.student-name { font-size: 1.5rem; font-weight: 900; line-height: 1.2; }
.student-sub  { color: var(--text-muted); font-size: .88rem; margin-top: 4px; }

/* ─── Two-col grid for detail page ──────────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: start; }

/* ─── Inbox message item ─────────────────────────────────────────────────────── */
.msg-item {
    display: flex; align-items: flex-start; gap: 14px;
    padding: 14px 18px; border-bottom: 1px solid var(--border);
    transition: background .15s; cursor: pointer;
}
.msg-item:hover  { background: var(--primary-light); }
.msg-item.unread { border-left: 3px solid var(--primary); }
.msg-dot    { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); flex-shrink: 0; margin-top: 5px; }
.msg-name   { font-weight: 800; font-size: .9rem; }
.msg-subj   { font-size: .84rem; color: var(--text-muted); margin-top: 2px; }
.msg-date   { font-size: .76rem; color: var(--text-muted); font-weight: 600; white-space: nowrap; }

/* ─── Login page ─────────────────────────────────────────────────────────────── */
.login-body {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--green) 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
}
.login-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 42px;
    width: 100%; max-width: 400px;
    box-shadow: 0 16px 64px rgba(0,0,0,.18);
}
.login-logo   { text-align: center; margin-bottom: 28px; }

/* Animated squid on login/setup */
.login-squid {
    position: relative;
    width: 84px; height: 84px;
    margin: 0 auto 10px;
    display: flex; align-items: center; justify-content: center;
}
.login-squid .sq { font-size: 3rem; display: block; animation: squid-bob 2.8s ease-in-out infinite; filter: drop-shadow(0 3px 10px rgba(0,0,0,.15)); }
.login-squid .sp { position: absolute; font-size: 1.05rem; animation: supply-float 3.2s ease-in-out infinite; }
.login-squid .s1 { top: -8px;   right:  -6px;  animation-delay: 0s;    }
.login-squid .s2 { top:  11px;  right: -18px;  animation-delay: .5s;   }
.login-squid .s3 { bottom: -4px; right: -12px; animation-delay: 1s;    }
.login-squid .s4 { bottom: -6px; left: -10px;  animation-delay: 1.5s;  }
.login-squid .s5 { top:  10px;  left:  -18px;  animation-delay: 2s;    }
.login-squid .s6 { top: -10px;  left:   -4px;  animation-delay: 2.5s;  }

@keyframes squid-bob {
    0%, 100% { transform: translateY(0) rotate(-3deg); }
    50%       { transform: translateY(-8px) rotate(3deg); }
}
@keyframes supply-float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50%       { transform: translateY(-6px) rotate(15deg); }
}
.login-title  { font-size: 1.5rem; font-weight: 900; }
.login-sub    { color: var(--text-muted); font-size: .88rem; margin-top: 4px; font-weight: 600; }

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
    .stats-grid  { grid-template-columns: repeat(2,1fr); }
    .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
    :root { --sidebar-w: 0px; }
    .sidebar       { display: none; }
    .admin-main    { margin-left: 0; }
    .admin-content { padding: 16px; }
    .stats-grid    { grid-template-columns: 1fr 1fr; }
    .admin-topbar  { padding: 12px 16px; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
}
