/* ==========================================================================
   Studiora design system  –  flat, clean, academic.  No gradients.
   Font: Poppins (self-hosted).  One palette, one set of components.
   ========================================================================== */

@font-face { font-family:'Poppins'; font-weight:400; font-style:normal; font-display:swap; src:url("../fonts/poppins-400.9212f6f9860f.woff2") format('woff2'); }
@font-face { font-family:'Poppins'; font-weight:500; font-style:normal; font-display:swap; src:url("../fonts/poppins-500.a09f2fccfee3.woff2") format('woff2'); }
@font-face { font-family:'Poppins'; font-weight:600; font-style:normal; font-display:swap; src:url("../fonts/poppins-600.72993dddf88a.woff2") format('woff2'); }
@font-face { font-family:'Poppins'; font-weight:700; font-style:normal; font-display:swap; src:url("../fonts/poppins-700.25b0e113ca7c.woff2") format('woff2'); }

/* ---- Tokens ------------------------------------------------------------ */
:root {
  --primary:        #4f46e5;
  --primary-dark:   #4338ca;
  --primary-soft:   #eef2ff;
  --navy:           #14213d;   /* headings, sidebar */
  --navy-soft:      #1d2d52;
  --bg:             #eef4fb;   /* page background */
  --card:           #ffffff;
  --border:         #dbe6f5;
  --text:           #14213d;
  --muted:          #5f6368;
  --success:        #15803d;  --success-soft: #dcfce7;
  --warning:        #b45309;  --warning-soft: #fef3c7;
  --danger:         #b91c1c;  --danger-soft:  #fee2e2;
  --info:           #1d4ed8;  --info-soft:    #dbeafe;
  --radius:         12px;
  --radius-sm:      8px;
  --shadow:         0 1px 2px rgba(20,33,61,.05), 0 4px 12px rgba(20,33,61,.05);
}

/* ---- Base -------------------------------------------------------------- */
body {
  font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px; line-height: 1.7;
  background: var(--bg); color: var(--text);
}
input, select, textarea, button { font-family: inherit; }

/* ---- Typography -------------------------------------------------------- */
.page-title    { font-size: 1.75rem; font-weight: 700; line-height: 1.3; color: var(--navy); }
.page-subtitle { font-size: .95rem; color: var(--muted); margin-top: .25rem; }
.section-title { font-size: 1.25rem; font-weight: 600; line-height: 1.4; color: var(--navy); }
.text-muted    { color: var(--muted); }
.text-small    { font-size: .875rem; }

/* ---- Buttons ----------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .6rem 1.1rem; border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 600; line-height: 1.4;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn:disabled, .btn[disabled] { opacity: .6; cursor: not-allowed; }
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled)   { background: var(--primary-dark); }
.btn-secondary { background: #fff; color: var(--primary); border-color: #c7d2fe; }
.btn-secondary:hover:not(:disabled) { background: var(--primary-soft); }
.btn-danger    { background: #dc2626; color: #fff; }
.btn-danger:hover:not(:disabled)    { background: #b91c1c; }
.btn-ghost     { background: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled)     { background: var(--primary-soft); color: var(--primary); }
.btn-sm        { padding: .35rem .75rem; font-size: .8rem; }
.btn-block     { width: 100%; }

/* ---- Cards ------------------------------------------------------------- */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-body   { padding: 1.25rem; }
.card-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); font-weight: 600; color: var(--navy); }
.card-link   { display: block; text-decoration: none; color: inherit; transition: border-color .15s ease, box-shadow .15s ease; }
.card-link:hover { border-color: #a5b4fc; box-shadow: 0 6px 18px rgba(79,70,229,.12); }

/* ---- Forms ------------------------------------------------------------- */
.label { display: block; font-size: .875rem; font-weight: 500; color: var(--navy); margin-bottom: .25rem; }
.input, select.input, textarea.input {
  width: 100%; padding: .6rem .8rem;
  background: #fff; color: var(--text);
  border: 1px solid #c9d6ea; border-radius: var(--radius-sm);
  font-size: .9rem; line-height: 1.5;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.15); }
.field-error { color: var(--danger); font-size: .8rem; margin-top: .25rem; }
.field-help  { color: var(--muted); font-size: .8rem; margin-top: .25rem; }

/* ---- Badges ------------------------------------------------------------ */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .15rem .6rem; border-radius: 999px;
  font-size: .72rem; font-weight: 600; letter-spacing: .02em;
  background: #e2e8f0; color: #334155;
}
.badge-primary { background: var(--primary-soft); color: var(--primary-dark); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger); }
.badge-info    { background: var(--info-soft);    color: var(--info); }

/* ---- Alerts ------------------------------------------------------------ */
.alert { padding: .75rem 1rem; border-radius: var(--radius-sm); font-size: .875rem; margin-bottom: 1rem; border: 1px solid transparent; }
.alert-success { background: var(--success-soft); color: var(--success); border-color: #bbf7d0; }
.alert-error   { background: var(--danger-soft);  color: var(--danger);  border-color: #fecaca; }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: #fde68a; }
.alert-info    { background: var(--info-soft);    color: var(--info);    border-color: #bfdbfe; }

/* ---- Tables ------------------------------------------------------------ */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-weight: 600; color: var(--navy); background: #f4f8fd; padding: .7rem 1rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: .7rem 1rem; border-bottom: 1px solid #edf2fa; color: var(--text); }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #f8fbff; }

/* ---- Empty state & modal ----------------------------------------------- */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty-state .empty-icon { font-size: 2rem; color: #a5b4fc; margin-bottom: .75rem; }
.empty-state h3 { font-size: 1.05rem; font-weight: 600; color: var(--navy); margin-bottom: .25rem; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(20,33,61,.5); display: none; align-items: center; justify-content: center; z-index: 60; padding: 1rem; }
.modal-backdrop.open { display: flex; }
.modal-box { background: #fff; border-radius: var(--radius); box-shadow: 0 20px 40px rgba(20,33,61,.25); width: 100%; max-width: 28rem; padding: 1.5rem; max-height: 90vh; overflow-y: auto; }

/* ---- Footer ------------------------------------------------------------ */
.site-footer     { text-align: center; font-size: .75rem; padding: 1rem; color: #64748b; }
.app-footer      { background: var(--navy); color: #a9b6d3; text-align: center; font-size: .75rem; padding: 1rem; }

/* ==========================================================================
   App shell (sidebar + top bar)
   ========================================================================== */
.app-sidebar { background: var(--navy); color: #fff; }
.app-sidebar .sidebar-head { border-bottom: 1px solid var(--navy-soft); }
.sidebar-sub { color: #a9b6d3; font-size: .75rem; }
.sidebar-toggle-btn { color: #a9b6d3; }
.sidebar-toggle-btn:hover { background: var(--navy-soft); color: #fff; }

.nav-link {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem .75rem; border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 500; color: #c3cde3; text-decoration: none;
  transition: background-color .15s ease, color .15s ease;
}
.nav-link:hover  { background: var(--navy-soft); color: #fff; }
.nav-link.active { background: var(--primary); color: #fff; }

.app-header { background: #fff; border-bottom: 1px solid var(--border); }
.profile-btn:hover { background: #f4f8fd; }
.avatar { background: var(--primary); color: #fff; }
.dropdown-menu { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.dropdown-item { display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem; font-size: .875rem; color: var(--text); text-decoration: none; width: 100%; background: none; border: 0; text-align: left; cursor: pointer; }
.dropdown-item:hover { background: #f4f8fd; }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: var(--danger-soft); }

/* sidebar collapse (desktop) */
#sidebar { width: 16rem; transition: width .2s ease, transform .2s ease; }
#sidebar.collapsed { width: 4.5rem; }
#sidebar.collapsed .sidebar-label,
#sidebar.collapsed .sidebar-brand-text { display: none; }
#sidebar .sidebar-label { white-space: nowrap; }
#sidebar.collapsed .nav-link { justify-content: center; }

/* mobile drawer */
#mobile-menu-btn { display: none; }
#sidebar-backdrop { display: none; }
@media (max-width: 768px) {
  #sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 50; width: 16rem !important; transform: translateX(-100%); }
  #sidebar.mobile-open { transform: translateX(0); }
  #sidebar.collapsed .sidebar-label,
  #sidebar.collapsed .sidebar-brand-text { display: block; }
  #sidebar.collapsed .nav-link { justify-content: flex-start; }
  #mobile-menu-btn { display: flex; position: fixed; top: 14px; left: 14px; z-index: 40; }
  #sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 45; }
  main { padding-left: 16px !important; padding-right: 16px !important; padding-top: 60px !important; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
