/* ============================================================
   OPTICAL SHOP MANAGEMENT SYSTEM
   Core stylesheet — Light/Dark theme via CSS variables
   ============================================================ */

:root {
  --font-main: 'Segoe UI', Roboto, -apple-system, BlinkMacSystemFont, sans-serif;

  /* Light theme (default) */
  --bg-body: #f4f6f9;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-topbar: #ffffff;
  --bg-input: #ffffff;
  --bg-hover: #f1f3f6;

  --text-primary: #1a1f2b;
  --text-secondary: #616a7a;
  --text-muted: #9aa2b1;

  --border-color: #e4e8ef;

  --accent: #2d6cdf;
  --accent-hover: #2559b8;
  --accent-soft: #e8f0fe;

  --success: #1fa971;
  --success-soft: #e5f8f0;
  --warning: #e0a800;
  --warning-soft: #fff6e0;
  --danger: #e0433a;
  --danger-soft: #fdecea;
  --info: #2d8fdf;
  --info-soft: #e7f4fd;

  --shadow-sm: 0 1px 3px rgba(20, 24, 33, 0.06);
  --shadow-md: 0 4px 16px rgba(20, 24, 33, 0.08);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

[data-theme="dark"] {
  --bg-body: #10131a;
  --bg-card: #171b24;
  --bg-sidebar: #141821;
  --bg-topbar: #171b24;
  --bg-input: #1e2330;
  --bg-hover: #202634;

  --text-primary: #eef1f6;
  --text-secondary: #a4acbd;
  --text-muted: #6b7386;

  --border-color: #262c3a;

  --accent: #5b8def;
  --accent-hover: #7ba1f2;
  --accent-soft: #1c2942;

  --success: #35c087;
  --success-soft: #123527;
  --warning: #f0bb3a;
  --warning-soft: #3a2f10;
  --danger: #f0625a;
  --danger-soft: #3a1917;
  --info: #4ea8f0;
  --info-soft: #112a3a;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-main);
  background: var(--bg-body);
  color: var(--text-primary);
  transition: background 0.2s ease, color 0.2s ease;
}

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

/* ---------------- Login Page ---------------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-body) 0%, var(--accent-soft) 100%);
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 40px 32px;
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 22px;
  font-weight: 700;
}

.login-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 13.5px;
  margin-bottom: 28px;
}

.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 11px 14px;
  font-size: 14.5px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  font-size: 14.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease, transform 0.05s ease;
}

.btn:active { transform: translateY(1px); }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-secondary { background: var(--bg-hover); color: var(--text-primary); border: 1px solid var(--border-color); }
.btn-danger { background: var(--danger); color: #fff; }

.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 18px;
  display: none;
}
.alert.show { display: block; }
.alert-danger { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger); }
.alert-success { background: var(--success-soft); color: var(--success); border: 1px solid var(--success); }

.theme-toggle-fixed {
  position: fixed;
  top: 20px;
  right: 20px;
}

.theme-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 13px;
  box-shadow: var(--shadow-sm);
}

/* ---------------- App Shell (dashboard layout) ---------------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  transition: transform 0.2s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  padding: 8px 10px 20px;
}

.sidebar-brand .brand-icon {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}

.nav-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 14px 10px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.nav-link:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-link.active { background: var(--accent-soft); color: var(--accent); }
.nav-link .icon { width: 18px; text-align: center; }

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

.topbar {
  height: 64px;
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title { font-size: 17px; font-weight: 700; }

.topbar-right { display: flex; align-items: center; gap: 14px; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  border-radius: 20px;
  background: var(--bg-hover);
  cursor: pointer;
}

.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}

.user-chip-name { font-size: 13.5px; font-weight: 600; }
.user-chip-role { font-size: 11px; color: var(--text-muted); }

.content { padding: 24px; flex: 1; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-header h1 { font-size: 20px; margin: 0; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.kpi-label {
  font-size: 12.5px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 8px;
}

.kpi-value { font-size: 24px; font-weight: 700; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
}
.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); }

.placeholder-note {
  color: var(--text-muted);
  font-size: 13.5px;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
}

@media (max-width: 880px) {
  .sidebar {
    position: fixed;
    left: 0; z-index: 30;
    transform: translateX(-100%);
    box-shadow: var(--shadow-md);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 20;
  }
  .sidebar-backdrop.show { display: block; }
  .mobile-menu-btn { display: inline-flex !important; }
}

.mobile-menu-btn {
  display: none;
  align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
}
