/* ============================================================
   Leo Martin Company — Modification Portal
   Shared Stylesheet
   ============================================================ */

:root {
  --primary:      #1B3A6B;
  --primary-light:#2563EB;
  --accent:       #2563EB;
  --success:      #10B981;
  --warning:      #F59E0B;
  --danger:       #EF4444;
  --neutral:      #6B7280;
  --bg:           #F1F5F9;
  --card:         #FFFFFF;
  --border:       #E2E8F0;
  --text:         #0F172A;
  --text-muted:   #64748B;
  --sidebar-w:    260px;
  --header-h:     64px;
  --radius:       10px;
  --shadow:       0 2px 12px rgba(15,23,42,.08);
  --shadow-md:    0 4px 24px rgba(15,23,42,.13);
}

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

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── TYPOGRAPHY ─────────────────────────────────────────── */
h1 { font-size: 1.75rem; font-weight: 700; line-height: 1.2; }
h2 { font-size: 1.3rem;  font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 600; }
p  { line-height: 1.6; color: var(--text-muted); }

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 20px; border-radius: var(--radius);
  font-size: .875rem; font-weight: 600; cursor: pointer;
  border: none; transition: all .15s ease; white-space: nowrap;
}
.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover  { background: #1d4ed8; }
.btn-success  { background: var(--success); color: #fff; }
.btn-success:hover  { background: #059669; }
.btn-danger   { background: var(--danger);  color: #fff; }
.btn-danger:hover   { background: #dc2626; }
.btn-outline  { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn-outline:hover  { background: #eff6ff; }
.btn-ghost    { background: transparent; color: var(--text-muted); border: 1.5px solid var(--border); }
.btn-ghost:hover    { background: var(--bg); }
.btn-sm { padding: 6px 14px; font-size: .8rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── LAYOUT SHELL ───────────────────────────────────────── */
.app-shell   { display: flex; min-height: 100vh; }
.sidebar     {
  width: var(--sidebar-w); background: var(--primary);
  min-height: 100vh; display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; z-index: 100;
  transition: transform .25s ease;
}
.main-area   { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; }

/* ── SIDEBAR ─────────────────────────────────────────────── */
.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-logo-img {
  height: 40px;
  width: auto;
  display: block;
  margin-bottom: 10px;
  /* Make SVG white on the dark sidebar */
  filter: brightness(0) invert(1);
  opacity: 0.92;
}
.sidebar-logo .company { font-size: .65rem; font-weight: 600; color: rgba(255,255,255,.5); letter-spacing: .12em; text-transform: uppercase; }
.sidebar-logo .product { font-size: .7rem; font-weight: 500; color: rgba(255,255,255,.5); margin-top: 4px; letter-spacing: .1em; text-transform: uppercase; }

.sidebar-nav   { flex: 1; padding: 16px 12px; }
.nav-section   { margin-bottom: 24px; }
.nav-label     { font-size: .65rem; font-weight: 600; color: rgba(255,255,255,.4); letter-spacing: .1em; text-transform: uppercase; padding: 0 8px; margin-bottom: 6px; }
.nav-item      {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px; cursor: pointer;
  color: rgba(255,255,255,.75); font-size: .875rem; font-weight: 500;
  transition: all .15s;
}
.nav-item:hover   { background: rgba(255,255,255,.1); color: #fff; }
.nav-item.active  { background: rgba(255,255,255,.15); color: #fff; }
.nav-item svg     { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
}
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; flex-shrink: 0;
}
.user-info .name  { font-size: .875rem; font-weight: 600; color: #fff; }
.user-info .role  { font-size: .72rem; color: rgba(255,255,255,.5); }
.logout-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; margin-top: 6px; border-radius: 8px; width: 100%;
  background: transparent; border: none; cursor: pointer;
  color: rgba(255,255,255,.6); font-size: .8rem; font-weight: 500;
  transition: all .15s;
}
.logout-btn:hover { background: rgba(255,255,255,.1); color: #fff; }

/* ── TOPBAR ──────────────────────────────────────────────── */
.topbar {
  height: var(--header-h); background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; position: sticky; top: 0; z-index: 90;
}
.topbar-title { font-size: 1.1rem; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

/* ── PAGE CONTENT ───────────────────────────────────────── */
.page-content { padding: 28px; }

/* ── CARDS ───────────────────────────────────────────────── */
.card {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-body { padding: 22px; }

/* ── STAT CARDS ──────────────────────────────────────────── */
.stats-row   { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px; margin-bottom: 28px; }
.stat-card   {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 20px 22px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow);
}
.stat-icon   {
  width: 46px; height: 46px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
}
.stat-icon.blue   { background: #EFF6FF; }
.stat-icon.green  { background: #ECFDF5; }
.stat-icon.amber  { background: #FFFBEB; }
.stat-icon.red    { background: #FEF2F2; }
.stat-value  { font-size: 1.75rem; font-weight: 800; line-height: 1; }
.stat-label  { font-size: .78rem; color: var(--text-muted); margin-top: 2px; }

/* ── TABLE ───────────────────────────────────────────────── */
.table-wrap   { overflow-x: auto; }
table         { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead th      {
  padding: 11px 16px; text-align: left;
  font-size: .72rem; font-weight: 600; color: var(--text-muted);
  letter-spacing: .06em; text-transform: uppercase;
  background: #F8FAFC; border-bottom: 1px solid var(--border);
}
tbody td      { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #F8FAFC; }

/* ── BADGES ──────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px; font-size: .72rem; font-weight: 600;
}
.badge-pending  { background: #FEF3C7; color: #92400E; }
.badge-approved { background: #D1FAE5; color: #065F46; }
.badge-rejected { background: #FEE2E2; color: #991B1B; }
.badge-review   { background: #DBEAFE; color: #1E40AF; }

/* ── FORMS ───────────────────────────────────────────────── */
.form-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: .82rem; font-weight: 600; color: var(--text); }
.required::after { content: ' *'; color: var(--danger); }
input, select, textarea {
  padding: 9px 13px; border: 1.5px solid var(--border); border-radius: 8px;
  font-size: .875rem; color: var(--text); background: #fff;
  transition: border-color .15s;
  font-family: inherit; width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
textarea { min-height: 90px; resize: vertical; }
.form-hint { font-size: .75rem; color: var(--text-muted); }
.input-prefix-wrap { position: relative; }
.input-prefix { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: .9rem; }
.input-prefix ~ input { padding-left: 26px; }

/* ── LOGIN PAGE ──────────────────────────────────────────── */
.login-bg {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1B3A6B 0%, #2563EB 100%);
}
.login-card {
  background: #fff; border-radius: 16px; padding: 44px 40px;
  width: 100%; max-width: 420px; box-shadow: var(--shadow-md);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo-img {
  height: 70px;
  width: auto;
  display: block;
  margin: 0 auto 18px;
  /* Dark logo on white card — no filter needed, SVG renders black by default */
}
.login-logo .company-name { font-size: .75rem; font-weight: 700; color: var(--text-muted); letter-spacing: .1em; text-transform: uppercase; }
.login-logo .portal-name  { font-size: 1.25rem; font-weight: 700; color: var(--primary); margin-top: 6px; }
.login-logo .portal-sub   { font-size: .85rem; color: var(--text-muted); margin-top: 4px; }
.login-logo .logo-icon {
  width: 56px; height: 56px; background: var(--primary); border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px; font-size: 1.6rem;
}
.login-card h2 { margin-bottom: 6px; font-size: 1.3rem; }
.login-card p  { font-size: .875rem; margin-bottom: 24px; }
.login-card .form-group { margin-bottom: 16px; }
.login-btn { width: 100%; justify-content: center; padding: 11px; font-size: 1rem; margin-top: 8px; border-radius: 10px; }
.login-error { color: var(--danger); font-size: .82rem; margin-top: 10px; text-align: center; display: none; }

/* ── SECTION HEADER ──────────────────────────────────────── */
.section-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 22px; gap: 16px; flex-wrap: wrap;
}
.section-header h1 { font-size: 1.4rem; }
.breadcrumb { font-size: .8rem; color: var(--text-muted); margin-bottom: 4px; }
.breadcrumb span { color: var(--accent); }

/* ── DETAIL VIEW ──────────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 1fr 340px; gap: 22px; align-items: start; }
.info-row { display: flex; flex-direction: column; gap: 4px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.info-row:last-child { border-bottom: none; }
.info-label { font-size: .72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.info-value { font-size: .9rem; color: var(--text); font-weight: 500; }

.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: flex; gap: 12px; padding-bottom: 20px; position: relative; }
.timeline-item::before {
  content: ''; position: absolute; left: 15px; top: 28px;
  bottom: 0; width: 2px; background: var(--border);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; z-index: 1;
}
.timeline-dot.submitted { background: #DBEAFE; }
.timeline-dot.review    { background: #FEF3C7; }
.timeline-dot.approved  { background: #D1FAE5; }
.timeline-dot.rejected  { background: #FEE2E2; }
.timeline-dot.emailed   { background: #F3E8FF; }
.timeline-body .tl-title { font-size: .85rem; font-weight: 600; }
.timeline-body .tl-date  { font-size: .75rem; color: var(--text-muted); margin-top: 2px; }
.timeline-body .tl-note  { font-size: .8rem; color: var(--text-muted); margin-top: 4px; }

.approval-box { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 8px; }
.approval-box textarea { min-height: 80px; }

/* ── FILTERS BAR ─────────────────────────────────────────── */
.filters-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.filter-select { padding: 7px 12px; border: 1.5px solid var(--border); border-radius: 8px; font-size: .82rem; background: #fff; cursor: pointer; }
.search-wrap { position: relative; flex: 1; min-width: 200px; max-width: 300px; }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.search-input { padding-left: 34px; }

/* ── EMPTY STATE ─────────────────────────────────────────── */
.empty-state { text-align: center; padding: 56px 24px; }
.empty-state .es-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state h3 { font-size: 1.1rem; margin-bottom: 6px; color: var(--text); }
.empty-state p { font-size: .875rem; margin-bottom: 18px; }

/* ── NOTIFICATION TOAST ──────────────────────────────────── */
#toast {
  position: fixed; bottom: 28px; right: 28px; z-index: 9999;
  background: var(--text); color: #fff; padding: 12px 20px;
  border-radius: 10px; font-size: .875rem; font-weight: 500;
  box-shadow: var(--shadow-md); display: none;
  max-width: 320px; line-height: 1.4;
}
#toast.success { background: var(--success); }
#toast.error   { background: var(--danger); }
#toast.show    { display: block; animation: slideUp .25s ease; }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ── MODAL ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.45);
  z-index: 200; display: flex; align-items: center; justify-content: center;
  display: none;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff; border-radius: 14px; padding: 32px;
  width: 100%; max-width: 460px; box-shadow: var(--shadow-md);
}
.modal h3 { margin-bottom: 10px; }
.modal p  { margin-bottom: 20px; font-size: .875rem; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .detail-grid { grid-template-columns: 1fr; }
  .form-grid  { grid-template-columns: 1fr; }
  .form-grid.cols-3 { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .page-content { padding: 16px; }
  .login-card { padding: 28px 20px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
}

/* ── PRINT ───────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .btn, .approval-box { display: none !important; }
  .main-area { margin-left: 0; }
}
