/* ============================================================
   School Communication System — Main Stylesheet
   ============================================================ */

:root {
    --sidebar-width: 250px;
    --sidebar-bg: #1a3c5e;
    --sidebar-text: #c8d8e8;
    --sidebar-hover: rgba(255,255,255,0.08);
    --sidebar-active-bg: #27ae60;
    --sidebar-active-text: #fff;
    --topbar-h: 60px;
    --body-bg: #f0f4f8;
    --card-shadow: 0 1px 4px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.04);
    --accent-blue: #1a5276;
    --accent-green: #27ae60;
    --accent-red: #e74c3c;
    --accent-yellow: #f39c12;
    --accent-info: #2980b9;
}

/* ---- Reset / base ---- */
*, *::before, *::after { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--body-bg);
    color: #2d3436;
    font-size: 14px;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform .25s ease;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.1) transparent;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-icon {
    width: 38px; height: 38px;
    background: var(--accent-green);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: #fff; flex-shrink: 0;
}
.brand-name { color: #fff; font-weight: 700; font-size: 15px; line-height: 1.2; display: block; }
.brand-sub  { color: var(--sidebar-text); font-size: 11px; opacity: .7; display: block; }

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(255,255,255,.04);
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.user-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--accent-green);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.user-name { color: #fff; font-weight: 600; font-size: 13px; line-height: 1.2; }

.sidebar-nav {
    list-style: none;
    padding: 8px 0;
    margin: 0;
    flex: 1;
}
.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 13.5px;
    transition: background .15s, color .15s;
    border-radius: 0;
}
.sidebar-nav li a:hover {
    background: var(--sidebar-hover);
    color: #fff;
}
.sidebar-nav li a.active {
    background: var(--accent-green);
    color: #fff;
    font-weight: 600;
}
.sidebar-nav li a.text-danger-soft {
    color: #f87171;
}
.sidebar-nav li a.text-danger-soft:hover {
    background: rgba(248,113,113,.15);
    color: #f87171;
}
.nav-section-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,.35);
    padding: 12px 18px 4px;
    font-weight: 600;
}

/* ============================================================
   MAIN WRAPPER & TOPBAR
   ============================================================ */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left .25s ease;
}

.topbar {
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid #e8ecf0;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 12px;
    position: sticky; top: 0; z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.topbar-title {
    font-size: 16px;
    font-weight: 700;
    color: #1a3c5e;
    flex: 1;
}
.topbar-right {
    display: flex; align-items: center; gap: 12px; color: #6c757d; font-size: 13px;
}
.sidebar-toggle {
    background: none; border: none; color: #666; padding: 6px 8px;
    border-radius: 6px; cursor: pointer;
    display: none;  /* shown on mobile via media query */
}

.page-content {
    padding: 24px;
    flex: 1;
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 18px 16px;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    gap: 14px;
    height: 100%;
}
.stat-icon {
    width: 46px; height: 46px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0;
}
.stat-label { font-size: 12px; color: #6c757d; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 22px; font-weight: 700; line-height: 1.2; color: #1a3c5e; }

/* Soft badge backgrounds */
.bg-primary-soft  { background: rgba(26,92,180,.1);  }
.bg-success-soft  { background: rgba(39,174,96,.1);  }
.bg-danger-soft   { background: rgba(231,76,60,.1);  }
.bg-warning-soft  { background: rgba(243,156,18,.1); }
.bg-info-soft     { background: rgba(41,128,185,.1); }
.bg-secondary-soft{ background: rgba(108,117,125,.1);}
.bg-orange-soft   { background: rgba(230,126,34,.1); }
.text-orange { color: #e67e22; }
.border-success-soft { border-left: 3px solid var(--accent-green); }

/* ============================================================
   MINI STATS (logs page)
   ============================================================ */
.mini-stat {
    background: #fff;
    border-radius: 8px;
    padding: 8px 12px;
    box-shadow: var(--card-shadow);
    font-size: 13px;
    white-space: nowrap;
}

/* ============================================================
   FORMS / CARDS
   ============================================================ */
.card { border-radius: 12px; }
.card-header {
    background: #fff;
    border-bottom: 1px solid #eef2f7;
    border-radius: 12px 12px 0 0 !important;
    padding: 14px 18px;
    font-size: 14px;
    color: #1a3c5e;
}
.form-control, .form-select {
    border: 1.5px solid #dde3ea;
    border-radius: 8px;
    font-size: 13.5px;
    transition: border-color .15s;
}
.form-control:focus, .form-select:focus {
    border-color: #1a5276;
    box-shadow: 0 0 0 3px rgba(26,82,118,.1);
}
.form-label { font-size: 13px; color: #374151; margin-bottom: 4px; }
.input-group-text { background: #f8fafc; border: 1.5px solid #dde3ea; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn { border-radius: 8px; font-size: 13.5px; font-weight: 500; }
.btn-primary   { background: #1a5276; border-color: #1a5276; }
.btn-primary:hover { background: #15406a; border-color: #15406a; }
.btn-success   { background: #27ae60; border-color: #27ae60; }
.btn-success:hover { background: #219a52; border-color: #219a52; }
.btn-xs        { padding: 2px 7px; font-size: 12px; border-radius: 5px; }

/* ============================================================
   TABLES
   ============================================================ */
.table th {
    font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
    font-weight: 700; color: #6c757d; white-space: nowrap;
}
.table td { vertical-align: middle; }
.table-hover tbody tr:hover { background: #f7fafc; }

/* ============================================================
   BADGES
   ============================================================ */
.badge { font-weight: 600; border-radius: 6px; }
.badge.bg-primary-soft { background: rgba(26,82,118,.12) !important; color: #1a5276; }
.badge.bg-info-soft    { background: rgba(41,128,185,.12) !important; color: #2980b9; }

/* ============================================================
   SMS COUNTER BAR
   ============================================================ */
.sms-counter-bar {
    background: #f8fafc;
    border: 1px solid #eef2f7;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12px;
    color: #6c757d;
    font-family: monospace;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-body {
    background: linear-gradient(135deg, #1a3c5e 0%, #1a5276 50%, #27ae60 100%);
    min-height: 100vh;
}
.login-wrapper {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 20px;
}
.login-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    width: 100%; max-width: 420px;
    overflow: hidden;
}
.login-header {
    background: linear-gradient(135deg, #1a3c5e, #1a5276);
    color: #fff;
    text-align: center;
    padding: 32px 24px 24px;
}
.login-icon {
    width: 60px; height: 60px;
    background: var(--accent-green);
    border-radius: 16px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 26px;
    margin-bottom: 12px;
}
.login-body-inner { padding: 28px 24px 20px; }
.login-footer {
    text-align: center;
    padding: 12px 24px 20px;
    border-top: 1px solid #f0f4f8;
}

/* ============================================================
   NAV TABS
   ============================================================ */
.nav-tabs { border-bottom: 2px solid #eef2f7; }
.nav-tabs .nav-link {
    border: none; border-bottom: 2px solid transparent;
    border-radius: 0; color: #6c757d; font-weight: 500; font-size: 13.5px;
    padding: 10px 16px; margin-bottom: -2px;
    transition: color .15s;
}
.nav-tabs .nav-link:hover    { color: #1a5276; }
.nav-tabs .nav-link.active   { color: #1a5276; border-bottom-color: #1a5276; background: none; }

/* ============================================================
   LINK HELPERS
   ============================================================ */
.link-sm { font-size: 12px; text-decoration: none; color: #1a5276; }
.link-sm:hover { text-decoration: underline; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-content { border-radius: 12px; border: none; box-shadow: 0 8px 32px rgba(0,0,0,.18); }
.modal-header  { border-bottom: 1px solid #eef2f7; padding: 18px 20px 14px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.sidebar-open {
        transform: translateX(0);
    }
    .main-wrapper {
        margin-left: 0;
    }
    .sidebar-toggle {
        display: inline-block;
    }
    .page-content {
        padding: 16px;
    }
    .stat-card {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }
    .topbar-date { display: none; }
}
