/* ============================================================
   Faculty Classroom Observation & Evaluation System
   Design tokens: institutional, documentation-grade, calm.
   Display face: Fraunces (certificate/seal gravitas, used sparingly)
   Body face: Inter (clarity for dense data & forms)
   Utility face: IBM Plex Mono (IDs, scores, codes)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  /* --- Color: named academic palette --- */
  --ink:        #16233F;   /* primary navy - brand, headings */
  --ink-2:      #24365C;   /* secondary navy - gradients, hover */
  --paper:      #F3F5F8;   /* app background */
  --surface:    #FFFFFF;   /* card surfaces */
  --border:     #DFE3EA;
  --border-2:   #EDEFF3;
  --muted:      #66738C;
  --muted-2:    #94A0B8;
  --brass:      #B8863B;   /* accent: seals, active nav, highlights */
  --brass-soft: #F3E7D2;
  --rust:       #A34B33;   /* needs improvement */
  --amber:      #C08A28;   /* satisfactory */
  --sage:       #3C7A5E;   /* good/very good */
  --sage-deep:  #2A5C45;   /* excellent/outstanding */
  --sky:        #2E6E9E;   /* links, info */

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(22,35,63,0.06);
  --shadow: 0 4px 16px rgba(22,35,63,0.08);
  --shadow-lg: 0 12px 32px rgba(22,35,63,0.14);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; margin: 0 0 4px; color: var(--ink); }
a { color: var(--sky); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

/* ============================================================
   Layout shell
   ============================================================ */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--ink) 0%, var(--ink-2) 100%);
  color: #E9EDF5;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.brand-mark {
  width: 34px; height: 34px; border-radius: 8px;
  background: conic-gradient(from 220deg, var(--brass), #E4C77C, var(--brass));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--ink);
  flex-shrink: 0;
}

.brand-text { line-height: 1.2; }
.brand-text .name { font-family: var(--font-display); font-weight: 600; font-size: 14.5px; color: #fff; }
.brand-text .sub { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: rgba(255,255,255,0.55); }

.sidebar-role {
  margin: 14px 20px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
}
.sidebar-role .who { font-weight: 600; color: #fff; display: block; margin-bottom: 2px; }
.sidebar-role .what { color: rgba(255,255,255,0.6); font-size: 11.5px; }

.nav-group { padding: 6px 12px; flex: 1; overflow-y: auto; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,0.38); padding: 14px 10px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.78); font-size: 13.5px; font-weight: 500;
  margin-bottom: 2px; transition: background .15s ease, color .15s ease;
}
.nav-link:hover { background: rgba(255,255,255,0.08); color: #fff; text-decoration: none; }
.nav-link.active { background: rgba(184,134,59,0.22); color: #F3E1BC; }
.nav-link .ic { width: 16px; text-align: center; opacity: .9; }

.sidebar-foot { padding: 14px 20px 18px; border-top: 1px solid rgba(255,255,255,0.1); }
.logout-btn {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 9px 12px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.85);
  border: 1px solid rgba(255,255,255,0.1); font-size: 13px; font-family: var(--font-body);
  cursor: pointer;
}
.logout-btn:hover { background: rgba(163,75,51,0.35); color: #fff; }

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar .crumb { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.topbar h1 { font-size: 21px; margin: 2px 0 0; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }

.bell-btn {
  position: relative; width: 36px; height: 36px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: var(--ink);
}
.bell-dot { position: absolute; top: 6px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--rust); border: 2px solid #fff; }

.content { padding: 26px 28px 60px; }

/* ============================================================
   Cards & grids
   ============================================================ */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 20px;
}
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-head h3 { font-size: 16px; }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 18px 16px; box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; width: 3px; height: 100%;
  background: var(--brass);
}
.stat-card .label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; }
.stat-card .value { font-family: var(--font-display); font-size: 30px; font-weight: 600; color: var(--ink); line-height: 1; }
.stat-card .foot { margin-top: 8px; font-size: 12px; color: var(--muted-2); }

.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 1000px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ============================================================
   Rating rosette — signature element.
   A seal-like badge that stamps a grade onto faculty cards,
   observation results, and reports, echoing accreditation seals.
   ============================================================ */
.rosette {
  --rosette-color: var(--sage);
  width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0;
  background: conic-gradient(var(--rosette-color) calc(var(--pct, 70) * 1%), var(--border-2) 0);
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.rosette::after {
  content: ''; position: absolute; inset: 6px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border-2);
}
.rosette .rosette-inner {
  position: relative; z-index: 1; text-align: center; font-family: var(--font-display);
}
.rosette .rosette-inner .pct { font-size: 15px; font-weight: 700; line-height: 1; color: var(--ink); }
.rosette .rosette-inner .lbl { font-size: 7.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.rosette.sm { width: 42px; height: 42px; }
.rosette.sm .rosette-inner .pct { font-size: 11px; }
.rosette.sm .rosette-inner .lbl { display: none; }
.rosette.lg { width: 96px; height: 96px; }
.rosette.lg .rosette-inner .pct { font-size: 22px; }
.rosette.lg .rosette-inner .lbl { font-size: 9px; }

.grade-outstanding { --rosette-color: var(--sage-deep); }
.grade-excellent { --rosette-color: var(--sage); }
.grade-verygood { --rosette-color: var(--sky); }
.grade-good { --rosette-color: var(--brass); }
.grade-satisfactory { --rosette-color: var(--amber); }
.grade-needsimprovement { --rosette-color: var(--rust); }

.grade-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  border: 1px solid transparent;
}
.grade-outstanding.grade-pill { background: #E4EFE9; color: var(--sage-deep); border-color: #C7DFD3; }
.grade-excellent.grade-pill { background: #E9F3ED; color: var(--sage); border-color: #CFE6DA; }
.grade-verygood.grade-pill { background: #E7F0F6; color: var(--sky); border-color: #C9DEEB; }
.grade-good.grade-pill { background: var(--brass-soft); color: var(--brass); border-color: #E6D3A8; }
.grade-satisfactory.grade-pill { background: #F5E9D2; color: var(--amber); border-color: #E8D2A0; }
.grade-needsimprovement.grade-pill { background: #F3E0DA; color: var(--rust); border-color: #E5C2B5; }

/* ============================================================
   Tables
   ============================================================ */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data td { padding: 11px 12px; border-bottom: 1px solid var(--border-2); vertical-align: middle; }
table.data tr:hover td { background: #FAFBFD; }
table.data .mono { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); }

.avatar-name { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: var(--ink); color: #F3E1BC; font-family: var(--font-display); font-weight: 600;
  display: flex; align-items: center; justify-content: center; font-size: 13px;
}
.avatar-name .name { font-weight: 600; color: var(--ink); }
.avatar-name .meta { font-size: 12px; color: var(--muted); }

.status-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; }
.status-dot::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--sage); }
.status-dot.inactive::before { background: var(--muted-2); }
.status-dot.inactive { color: var(--muted); }

/* ============================================================
   Forms
   ============================================================ */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .form-grid, .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: 1fr 1fr; } }

.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.field .hint { font-size: 11.5px; color: var(--muted); font-weight: 400; }

input[type=text], input[type=date], input[type=number], input[type=password],
input[type=email], select, textarea {
  font-family: var(--font-body); font-size: 13.5px; color: var(--ink);
  padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); width: 100%;
}
textarea { resize: vertical; min-height: 72px; }
input:focus, select:focus, textarea:focus { border-color: var(--brass); outline: none; box-shadow: 0 0 0 3px rgba(184,134,59,0.15); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; font-family: var(--font-body);
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-2); }
.btn-brass { background: var(--brass); color: #fff; }
.btn-brass:hover { background: #A47530; }
.btn-outline { background: var(--surface); color: var(--ink); border-color: var(--border); }
.btn-outline:hover { background: var(--paper); }
.btn-danger { background: #fff; color: var(--rust); border-color: #E5C2B5; }
.btn-danger:hover { background: #FBF0EC; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-row { display: flex; gap: 10px; margin-top: 6px; }

/* Rating scale widget (5-point) */
.rating-param { border-bottom: 1px solid var(--border-2); padding: 16px 0; display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; }
.rating-param:last-child { border-bottom: none; }
.rating-param .rp-label { font-weight: 600; font-size: 13.5px; }
.rating-param .rp-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }
.scale-5 { display: flex; gap: 6px; }
.scale-5 label {
  display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer;
  width: 52px; padding: 8px 4px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 10.5px; color: var(--muted); text-align: center; transition: all .12s ease;
}
.scale-5 input { display: none; }
.scale-5 .num { font-family: var(--font-display); font-size: 15px; font-weight: 600; color: var(--ink); }
.scale-5 input:checked + .opt { border-color: var(--brass); background: var(--brass-soft); }
.scale-5 label:has(input:checked) { border-color: var(--brass); background: var(--brass-soft); color: var(--brass); }
.scale-5 label:has(input:checked) .num { color: var(--brass); }

/* Alerts */
.alert { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; border: 1px solid transparent; }
.alert-error { background: #FBF0EC; color: var(--rust); border-color: #E5C2B5; }
.alert-success { background: #E9F3ED; color: var(--sage-deep); border-color: #CFE6DA; }
.alert-info { background: #E7F0F6; color: var(--sky); border-color: #C9DEEB; }

/* Badges/pills for department/misc */
.pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--paper); border: 1px solid var(--border); color: var(--muted); }

.empty-state { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty-state .ic { font-size: 34px; margin-bottom: 10px; }
.empty-state h4 { color: var(--ink); margin-bottom: 4px; }

/* Filter bar */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 18px; }
.filter-bar .field { min-width: 150px; }

/* Login page */
.login-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 20% 20%, rgba(184,134,59,0.10), transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(46,110,158,0.10), transparent 45%),
    var(--ink);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 400px; background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 36px 32px 30px; text-align: center;
}
.login-seal {
  width: 62px; height: 62px; margin: 0 auto 16px; border-radius: 50%;
  background: conic-gradient(from 220deg, var(--brass), #E4C77C, var(--brass));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 22px; color: var(--ink);
}
.login-card h1 { font-size: 19px; margin-bottom: 4px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 26px; }
.role-toggle { display: flex; gap: 8px; margin-bottom: 18px; background: var(--paper); padding: 4px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.role-toggle label { flex: 1; }
.role-toggle input { display: none; }
.role-toggle .opt {
  display: block; text-align: center; padding: 9px 6px; border-radius: 6px; font-size: 13px; font-weight: 600;
  color: var(--muted); cursor: pointer;
}
.role-toggle input:checked + .opt { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.login-form .field { text-align: left; margin-bottom: 14px; }
.login-hint { margin-top: 18px; font-size: 11.5px; color: var(--muted-2); line-height: 1.5; }

.divider { height: 1px; background: var(--border); margin: 20px 0; border: none; }

@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .content { padding: 0; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}

/* Avatar Dropdown Styles */
.avatar-dropdown {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.avatar {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary, #4f46e5);
    color: white;
    font-weight: 600;
    font-size: 14px;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.avatar:hover {
    opacity: 0.85;
    transform: scale(1.05);
}

.dropdown-arrow {
    font-size: 10px;
    opacity: 0.7;
    margin-left: 2px;
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    min-width: 240px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    border: 1px solid var(--border, #e5e7eb);
    z-index: 1000;
    overflow: hidden;
    animation: slideDown 0.2s ease;
}

.dropdown-menu.show {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-header {
    padding: 16px 16px 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg, #f9fafb);
}

.dropdown-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary, #4f46e5);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0;
}

.dropdown-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text, #111827);
}

.dropdown-role {
    font-size: 12px;
    color: var(--muted, #6b7280);
}

.dropdown-divider {
    height: 1px;
    background: var(--border, #e5e7eb);
    margin: 4px 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text, #111827);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.15s;
}

.dropdown-item:hover {
    background: var(--bg, #f3f4f6);
}

.dropdown-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.logout-item {
    color: #ef4444;
}

.logout-item:hover {
    background: #fef2f2;
}

/* Bell button */
.bell-btn {
    position: relative;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.bell-btn:hover {
    background: var(--bg, #f3f4f6);
}

.bell-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid white;
}

/* Topbar actions */
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Responsive */
@media (max-width: 768px) {
    .dropdown-menu {
        right: -10px;
        min-width: 200px;
    }
    
    .dropdown-header {
        padding: 12px;
    }
    
    .dropdown-item {
        padding: 8px 12px;
        font-size: 13px;
    }
}
