/* =========================================================
   CATATKU — STYLE.CSS
   Variabel desain, reset, dan layout struktural utama.
   ========================================================= */

:root {
  /* --- Brand & fungsi warna --- */
  --color-primary: #16a34a;
  --color-primary-dark: #15803d;
  --color-primary-light: #dcfce7;
  --color-primary-gradient: linear-gradient(135deg, #16a34a 0%, #0d9488 100%);

  --color-income: #2563eb;
  --color-income-bg: #dbeafe;
  --color-expense: #dc2626;
  --color-expense-bg: #fee2e2;
  --color-info: #3b82f6;
  --color-info-bg: #dbeafe;
  --color-warning: #f59e0b;
  --color-warning-bg: #fef3c7;

  /* --- Netral / permukaan (Light mode) --- */
  --bg-page: #f4f5f7;
  --bg-card: #ffffff;
  --bg-sidebar: #16202c;
  --bg-sidebar-hover: #1f2c3a;
  --bg-input: #ffffff;
  --bg-hover: #f3f4f6;

  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --text-on-dark: #e5e7eb;
  --text-on-dark-muted: #8a97a6;

  --border-color: #e5e7eb;
  --border-color-strong: #d1d5db;

  /* --- Metrik layout --- */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.14);

  --sidebar-width: 264px;
  --header-height: 68px;
  --bottom-nav-height: 64px;

  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  --transition-fast: 150ms ease;
  --transition-base: 220ms ease;
}

/* --- Dark mode --- */
html[data-theme='dark'] {
  --bg-page: #0f1520;
  --bg-card: #171f2b;
  --bg-sidebar: #0b1119;
  --bg-sidebar-hover: #16202c;
  --bg-input: #1c2531;
  --bg-hover: #1c2531;

  --text-primary: #f3f4f6;
  --text-secondary: #a3acb9;
  --text-muted: #74808f;

  --border-color: #263140;
  --border-color-strong: #34404f;

  --color-primary-light: #123324;
  --color-income-bg: #142238;
  --color-expense-bg: #301418;
  --color-info-bg: #142238;
  --color-warning-bg: #332512;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.5);
}

/* --- Reset dasar --- */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-family);
  background: var(--bg-page);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition-base), color var(--transition-base);
}

h1, h2, h3, h4, p {
  margin: 0;
}

button {
  font-family: inherit;
  cursor: pointer;
}

select,
input,
textarea {
  font-family: inherit;
}

a {
  color: inherit;
}

svg {
  display: block;
}

/* Visible focus state untuk aksesibilitas */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.is-hidden {
  display: none !important;
}

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

/* ---------------------------------------------------------
   SIDEBAR
   --------------------------------------------------------- */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-sidebar);
  color: var(--text-on-dark);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-logo-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--color-primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.app-logo-icon svg {
  width: 20px;
  height: 20px;
}

.app-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.app-name {
  font-weight: 700;
  font-size: 17px;
  color: #fff;
}

.app-tagline {
  font-size: 11.5px;
  color: var(--text-on-dark-muted);
}

.sidebar-close-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-on-dark-muted);
  padding: 6px;
  border-radius: var(--radius-sm);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  overflow-y: auto;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  border: none;
  background: none;
  color: var(--text-on-dark-muted);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-item:hover {
  background: var(--bg-sidebar-hover);
  color: #fff;
}

.nav-item.is-active {
  background: var(--color-primary);
  color: #fff;
}

.sidebar-footer {
  padding: 14px 16px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.theme-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.theme-toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-on-dark-muted);
}

.theme-toggle-label svg {
  width: 16px;
  height: 16px;
}

.sidebar-balance-card {
  background: var(--color-primary-gradient);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #fff;
}

.sidebar-balance-label {
  font-size: 12px;
  opacity: 0.85;
}

.sidebar-balance-value {
  font-size: 19px;
  font-weight: 700;
}

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

.app-header {
  height: var(--header-height);
  flex-shrink: 0;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.icon-btn:hover {
  background: var(--bg-hover);
}

#menuToggleBtn {
  display: none;
}

.month-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  background: var(--bg-card);
}

.month-picker svg {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
}

.month-picker select {
  border: none;
  background: none;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
}

.header-notification {
  position: relative;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: var(--bg-card);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-avatar svg {
  width: 15px;
  height: 15px;
}

.user-name {
  font-size: 13.5px;
  font-weight: 600;
}

.app-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

.page {
  max-width: 1280px;
  margin: 0 auto;
}

/* ---------------------------------------------------------
   Bottom nav (mobile) — hidden by default, shown in responsive.css
   --------------------------------------------------------- */
.bottom-nav {
  display: none;
}

/* ---------------------------------------------------------
   Sidebar overlay (mobile drawer backdrop)
   --------------------------------------------------------- */
.sidebar-overlay {
  display: none;
}
