/* ============================================================
 * eMitra Management - Core Theme
 * Light blue (#2563EB), light sidebar, cards + icons, soft shadows.
 * All UI text English only.
 * ============================================================ */

:root {
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --primary-light: #DBEAFE;
  --primary-soft: #EFF6FF;
  --bg: #F1F5F9;
  --surface: #FFFFFF;
  --sidebar-bg: #FFFFFF;
  --text: #1E293B;
  --text-muted: #64748B;
  --border: #E2E8F0;
  --success: #16A34A;
  --danger: #DC2626;
  --warning: #D97706;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow: 0 4px 14px rgba(15,23,42,.08);
  --shadow-lg: 0 12px 32px rgba(37,99,235,.16);
  --sidebar-w: 256px;
  --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }

/* ---------- Auth (login / password) pages ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(1200px 500px at 50% -10%, var(--primary-light), transparent),
    linear-gradient(180deg, #F8FAFF 0%, var(--bg) 100%);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 38px 34px;
  animation: rise .5s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.auth-logo {
  width: 56px; height: 56px; border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 26px; margin: 0 auto 16px;
  box-shadow: var(--shadow);
}
.auth-title { text-align: center; font-size: 22px; font-weight: 700; letter-spacing: -.3px; }
.auth-sub { text-align: center; color: var(--text-muted); font-size: 14px; margin-top: 4px; margin-bottom: 26px; }

/* ---------- Forms ---------- */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 7px; }
.input-icon { position: relative; }
.input-icon > i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 16px; }
.form-control {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  font-family: var(--font);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: #FBFCFE;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input-icon .form-control { padding-left: 42px; }
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(37,99,235,.12);
}
.form-control::placeholder { color: #94A3B8; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px;
  font-size: 15px; font-weight: 600; font-family: var(--font);
  border: none; border-radius: var(--radius-sm);
  cursor: pointer; transition: transform .12s, box-shadow .15s, background .15s;
}
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.btn-primary:active { transform: translateY(0); }
.btn-block { width: 100%; }
.btn-ghost { background: var(--primary-soft); color: var(--primary); }
.btn-ghost:hover { background: var(--primary-light); }

/* ---------- Alerts ---------- */
.alert { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 18px; display: flex; gap: 9px; align-items: flex-start; }
.alert i { margin-top: 2px; }
.alert-danger { background: #FEF2F2; color: var(--danger); border: 1px solid #FECACA; }
.alert-success { background: #F0FDF4; color: var(--success); border: 1px solid #BBF7D0; }
.alert-info { background: var(--primary-soft); color: var(--primary-dark); border: 1px solid var(--primary-light); }

/* ---------- App shell (sidebar + topbar) ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  position: fixed; top: 0; left: 0; bottom: 0;
  display: flex; flex-direction: column;
  z-index: 40;
  transition: transform .25s ease;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
}
.sidebar-brand .logo {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 18px;
}
.sidebar-brand .name { font-weight: 700; font-size: 16px; letter-spacing: -.2px; }
.sidebar-brand .name small { display: block; font-size: 11px; color: var(--text-muted); font-weight: 500; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 12px 20px; }
.nav-group-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: #94A3B8; padding: 14px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-weight: 600; font-size: 14.5px;
  transition: background .14s, color .14s; margin-bottom: 2px;
}
.nav-item i { font-size: 18px; width: 22px; text-align: center; }
.nav-item:hover { background: var(--primary-soft); color: var(--primary); }
.nav-item.active { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; box-shadow: var(--shadow); }

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }
.topbar {
  height: 64px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 22px;
  position: sticky; top: 0; z-index: 30;
}
.topbar .left { display: flex; align-items: center; gap: 14px; }
.topbar .page-title { font-size: 17px; font-weight: 700; letter-spacing: -.2px; }
.menu-toggle { display: none; background: var(--primary-soft); color: var(--primary); border: none; width: 40px; height: 40px; border-radius: 10px; font-size: 19px; cursor: pointer; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; cursor: pointer; }
.user-chip:hover { background: var(--primary-soft); }
.user-chip .avatar { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.user-chip .uname { font-size: 14px; font-weight: 600; }
.user-chip .urole { font-size: 11.5px; color: var(--text-muted); }

.content { padding: 24px 22px 40px; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px 22px; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px 20px; transition: transform .14s, box-shadow .14s; }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat-card .ic { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 21px; margin-bottom: 12px; }
.stat-card .label { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.stat-card .value { font-size: 24px; font-weight: 800; letter-spacing: -.5px; margin-top: 2px; }
.ic-blue { background: var(--primary-light); color: var(--primary); }
.ic-green { background: #DCFCE7; color: var(--success); }
.ic-amber { background: #FEF3C7; color: var(--warning); }
.ic-red { background: #FEE2E2; color: var(--danger); }

/* ---------- Modal (popup) - matches theme ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.5); backdrop-filter: blur(2px); display: none; align-items: center; justify-content: center; z-index: 60; padding: 20px; }
.modal-overlay.open { display: flex; }
.modal {
  width: 100%; max-width: 460px; background: var(--surface);
  border-radius: 18px; box-shadow: var(--shadow-lg);
  animation: rise .3s ease; overflow: hidden;
}
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.modal-head h3 i { color: var(--primary); }
.modal-close { background: none; border: none; font-size: 22px; color: var(--text-muted); cursor: pointer; line-height: 1; }
.modal-body { padding: 22px; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- Ad / promo banner (company ads) ---------- */
.promo {
  background: linear-gradient(120deg, var(--primary-dark), var(--primary));
  color: #fff; border-radius: var(--radius); padding: 16px 20px;
  display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow);
  margin-bottom: 20px; position: relative; overflow: hidden;
}
.promo .pic { font-size: 26px; opacity: .95; }
.promo .ptext { flex: 1; }
.promo .ptext b { font-size: 15px; }
.promo .ptext span { display: block; font-size: 13px; opacity: .9; margin-top: 1px; }
.promo .pbtn { background: #fff; color: var(--primary-dark); padding: 8px 14px; border-radius: 9px; font-weight: 700; font-size: 13px; white-space: nowrap; }
.promo-close { position: absolute; top: 8px; right: 10px; background: none; border: none; color: rgba(255,255,255,.8); cursor: pointer; font-size: 16px; }

.muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; }

/* ---------- Responsive ---------- */
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 35; }
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.open { display: block; }
  .main { margin-left: 0; }
  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
}
