/* =============================================================
   EduTrack SDO Hub — Shared Stylesheet
   Division of General Trias City — Department of Education
   Clean, Professional, Government-Appropriate
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Source+Sans+3:wght@400;600;700&display=swap');

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px;
    background-color: #f3f4f6;
    color: #1f2937;
    min-height: 100vh;
    line-height: 1.55;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5 { font-weight: 700; color: #111827; line-height: 1.3; }
h1 { font-size: 1.3rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
h4 { font-size: 0.875rem; }
p  { color: #374151; }
a  { color: #1d4ed8; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.sdo-wrapper { display: flex; flex-direction: column; min-height: 100vh; }
.sdo-main { flex: 1; max-width: 1440px; width: 100%; margin: 0 auto; padding: 1.25rem 1rem; }

/* ---------- Topbar ---------- */
.sdo-topbar {
    background: #1e3a5f;
    color: #fff;
    border-bottom: 3px solid #f59e0b;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}
.sdo-topbar-inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.sdo-brand { display: flex; align-items: center; gap: 0.6rem; }
.sdo-brand img.logo { height: 38px; width: 38px; object-fit: contain; }
.sdo-brand-text small { display: block; font-size: 0.62rem; font-weight: 600; color: #fcd34d; text-transform: uppercase; letter-spacing: 0.05em; }
.sdo-brand-text strong { display: block; font-size: 0.9rem; font-weight: 700; color: #fff; line-height: 1.2; }

/* ---------- Nav ---------- */
.sdo-nav { display: flex; align-items: center; gap: 0.15rem; flex-wrap: wrap; }
.sdo-nav a {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.28rem 0.6rem; border-radius: 4px;
    font-size: 0.75rem; font-weight: 600; color: #bfdbfe;
    transition: background 0.15s, color 0.15s; text-decoration: none;
}
.sdo-nav a:hover { background: rgba(255,255,255,0.12); color: #fff; text-decoration: none; }
.sdo-nav a.active { background: #f59e0b; color: #1e3a5f; }
.sdo-nav a i { font-size: 0.72rem; }

/* ---------- User Badge ---------- */
.sdo-user-badge { display: flex; align-items: center; gap: 0.45rem; }
.sdo-user-badge .avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: #f59e0b; color: #1e3a5f;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.68rem; flex-shrink: 0;
}
.sdo-user-badge .info .name { font-weight: 600; color: #fff; font-size: 0.72rem; }
.sdo-user-badge .info .role { font-size: 0.62rem; color: #fcd34d; }
.btn-logout {
    background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.18);
    color: #fff; padding: 0.22rem 0.55rem; border-radius: 4px;
    font-size: 0.7rem; cursor: pointer; display: inline-flex;
    align-items: center; gap: 0.25rem; text-decoration: none; transition: background 0.15s;
}
.btn-logout:hover { background: rgba(239,68,68,0.3); text-decoration: none; color: #fff; }

/* ---------- Subbar ---------- */
.sdo-subbar { background: #fff; border-bottom: 1px solid #e5e7eb; padding: 0.45rem 1rem; }
.sdo-subbar-inner {
    max-width: 1440px; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap;
}

/* ---------- Dev Bar ---------- */
.sdo-devbar {
    background: linear-gradient(90deg, #92400e, #b45309, #92400e);
    color: #fef3c7; font-size: 0.7rem; font-weight: 600;
    padding: 0.28rem 1rem; display: flex; align-items: center;
    justify-content: space-between; gap: 0.5rem; flex-wrap: wrap;
}
.sdo-devbar .sim-badge { background: rgba(0,0,0,0.3); padding: 0.1rem 0.45rem; border-radius: 3px; font-family: monospace; color: #fcd34d; }
.sdo-devbar a { padding: 0.12rem 0.4rem; border-radius: 3px; background: rgba(0,0,0,0.2); color: #fef3c7; font-size: 0.67rem; text-decoration: none; transition: background 0.1s; }
.sdo-devbar a:hover { background: rgba(0,0,0,0.45); text-decoration: none; }
.sdo-devbar a.active-sim { background: rgba(255,255,255,0.25); font-weight: 700; color: #fff; }

/* ---------- Cards ---------- */
.card {
    background: #fff; border: 1px solid #e5e7eb;
    border-radius: 8px; padding: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.card-header {
    border-bottom: 1px solid #f3f4f6; padding-bottom: 0.6rem; margin-bottom: 0.75rem;
    display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
}
.card-title {
    font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.04em; color: #374151; display: flex; align-items: center; gap: 0.35rem;
}
.card-title i { color: #6b7280; font-size: 0.75rem; }

/* ---------- Stat Cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 0.65rem; }
.stat-card {
    background: #fff; border: 1px solid #e5e7eb; border-left: 4px solid #3b82f6;
    border-radius: 6px; padding: 0.7rem 0.85rem; box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.stat-card .label {
    font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.05em; color: #6b7280; margin-bottom: 0.25rem;
    display: flex; align-items: center; justify-content: space-between;
}
.stat-card .label i { font-size: 0.7rem; color: #9ca3af; }
.stat-card .value { font-size: 1.55rem; font-weight: 700; color: #111827; line-height: 1; }
.stat-card .sub { font-size: 0.65rem; color: #9ca3af; margin-top: 0.2rem; }
.stat-card.green  { border-left-color: #16a34a; }
.stat-card.blue   { border-left-color: #2563eb; }
.stat-card.amber  { border-left-color: #d97706; }
.stat-card.red    { border-left-color: #dc2626; }
.stat-card.purple { border-left-color: #7c3aed; }
.stat-card.slate  { border-left-color: #64748b; }
.stat-card.teal   { border-left-color: #0d9488; }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 0.22rem;
    font-size: 0.65rem; font-weight: 700; padding: 0.12rem 0.5rem;
    border-radius: 999px; text-transform: uppercase; letter-spacing: 0.04em;
}
.badge-green  { background: #dcfce7; color: #166534; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-amber  { background: #fef3c7; color: #92400e; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-gray   { background: #f3f4f6; color: #4b5563; }
.badge-purple { background: #ede9fe; color: #5b21b6; }

/* ---------- Alerts ---------- */
.alert {
    padding: 0.6rem 0.85rem; border-radius: 6px; border-left: 4px solid;
    font-size: 0.78rem; display: flex; align-items: flex-start;
    gap: 0.55rem; margin-bottom: 0.75rem;
}
.alert i { margin-top: 0.1rem; flex-shrink: 0; }
.alert-danger  { background: #fef2f2; border-color: #dc2626; color: #7f1d1d; }
.alert-warning { background: #fffbeb; border-color: #d97706; color: #78350f; }
.alert-info    { background: #eff6ff; border-color: #2563eb; color: #1e3a8a; }
.alert-success { background: #f0fdf4; border-color: #16a34a; color: #14532d; }

/* ---------- Tables ---------- */
.sdo-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.sdo-table th {
    background: #f8fafc; border: 1px solid #d1d5db;
    padding: 0.42rem 0.6rem; text-align: left;
    font-size: 0.67rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.04em; color: #374151; white-space: nowrap;
}
.sdo-table td { border: 1px solid #e5e7eb; padding: 0.42rem 0.6rem; vertical-align: middle; color: #1f2937; }
.sdo-table tbody tr:hover { background: #f9fafb; }
.sdo-table tfoot td, .sdo-table tfoot th { background: #f1f5f9; font-weight: 700; border-top: 2px solid #94a3b8; }
.sdo-table td.center, .sdo-table th.center { text-align: center; }
.sdo-table td.mono { font-family: monospace; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 0.28rem;
    padding: 0.38rem 0.85rem; border-radius: 5px; font-size: 0.77rem;
    font-weight: 600; cursor: pointer; border: 1px solid transparent;
    text-decoration: none; transition: all 0.15s; white-space: nowrap; font-family: inherit;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: #1e3a5f; color: #fff; border-color: #1e3a5f; }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
.btn-secondary { background: #fff; color: #374151; border-color: #d1d5db; }
.btn-secondary:hover { background: #f9fafb; color: #111827; }
.btn-success { background: #15803d; color: #fff; border-color: #15803d; }
.btn-success:hover { background: #166534; color: #fff; }
.btn-danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-amber { background: #d97706; color: #fff; border-color: #d97706; }
.btn-amber:hover { background: #b45309; color: #fff; }
.btn-sm { padding: 0.22rem 0.55rem; font-size: 0.7rem; }
.btn-lg { padding: 0.52rem 1.2rem; font-size: 0.85rem; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 0.85rem; }
.form-label { display: block; font-size: 0.7rem; font-weight: 700; color: #374151; margin-bottom: 0.28rem; text-transform: uppercase; letter-spacing: 0.03em; }
.form-control {
    width: 100%; padding: 0.38rem 0.6rem;
    border: 1px solid #d1d5db; border-radius: 5px;
    font-size: 0.8rem; color: #1f2937; background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s; font-family: inherit;
}
.form-control:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,0.12); }
textarea.form-control { resize: vertical; min-height: 90px; }

/* ---------- School Card ---------- */
.school-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; transition: box-shadow 0.18s; }
.school-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.school-card-header { background: #1e3a5f; color: #fff; padding: 0.6rem 0.85rem; display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.school-card-header .school-name { font-size: 0.8rem; font-weight: 700; line-height: 1.3; }
.school-card-header .school-meta { font-size: 0.62rem; color: #93c5fd; margin-top: 0.1rem; }
.school-card-body { padding: 0.7rem 0.85rem; }
.school-stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.45rem; margin-bottom: 0.55rem; }
.school-stat { text-align: center; padding: 0.35rem; background: #f9fafb; border-radius: 5px; border: 1px solid #f3f4f6; }
.school-stat .s-val { font-size: 1rem; font-weight: 700; color: #111827; display: block; }
.school-stat .s-lbl { font-size: 0.58rem; color: #6b7280; text-transform: uppercase; letter-spacing: 0.03em; display: block; margin-top: 0.1rem; }
.school-card-footer { padding: 0.45rem 0.85rem; border-top: 1px solid #f3f4f6; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; background: #f9fafb; }

/* ---------- Modal ---------- */
.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(17,24,39,0.5); z-index: 200; align-items: center; justify-content: center; padding: 1rem; }
.modal-backdrop.open { display: flex; }
.modal-box { background: #fff; border-radius: 10px; width: 100%; max-width: 640px; max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 20px 40px rgba(0,0,0,0.18); }
.modal-header { padding: 0.8rem 1rem; border-bottom: 1px solid #e5e7eb; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; background: #f8fafc; border-radius: 10px 10px 0 0; }
.modal-title { font-size: 0.88rem; font-weight: 700; color: #1e3a5f; }
.modal-close { background: none; border: none; cursor: pointer; color: #6b7280; font-size: 1rem; padding: 0.18rem; line-height: 1; border-radius: 4px; transition: color 0.1s; }
.modal-close:hover { color: #111827; }
.modal-body { padding: 1rem; overflow-y: auto; flex: 1; }
.modal-footer { padding: 0.7rem 1rem; border-top: 1px solid #e5e7eb; display: flex; align-items: center; justify-content: flex-end; gap: 0.5rem; background: #f8fafc; border-radius: 0 0 10px 10px; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ---------- Print Styles (DepEd Official Format) ---------- */
@media print {
    * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    body { background: #fff !important; color: #000 !important; font-family: 'Times New Roman', Times, serif; font-size: 11pt; margin: 0; }
    .no-print, .sdo-topbar, .sdo-subbar, .sdo-devbar, .sdo-nav, .btn-logout, button { display: none !important; }
    .print-page { margin: 0 !important; padding: 0 !important; box-shadow: none !important; border: none !important; width: 100% !important; max-width: 100% !important; border-radius: 0 !important; }
    table { border-collapse: collapse !important; width: 100% !important; }
    th, td { border: 1px solid #000 !important; padding: 4pt 5pt !important; color: #000 !important; }
    th { background: #e0e0e0 !important; font-weight: bold !important; }
    tfoot td, tfoot th { background: #ccc !important; font-weight: bold !important; }
    .print-page-break { page-break-before: always; }
    .deped-letterhead, .signatory-block { page-break-inside: avoid; }
}

/* ---------- Utilities ---------- */
.text-muted { color: #6b7280; }
.text-small { font-size: 0.72rem; }
.d-flex { display: flex; align-items: center; }
.gap-1 { gap: 0.35rem; }
.gap-2 { gap: 0.65rem; }
.mb-1 { margin-bottom: 0.35rem; }
.mb-2 { margin-bottom: 0.75rem; }
.mb-3 { margin-bottom: 1.25rem; }
.mt-1 { margin-top: 0.35rem; }
.mt-2 { margin-top: 0.75rem; }
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.grid-3 { grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.grid-4 { grid-template-columns: repeat(4, 1fr); gap: 0.75rem; }

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .sdo-nav { display: none; }
    .sdo-main { padding: 0.75rem; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

