/* Gelir Gider Takip — UI */

:root {
  --bg: #0f1412;
  --bg-elevated: #171d1a;
  --bg-soft: #1c2420;
  --surface: #1f2924;
  --border: rgba(232, 224, 208, 0.08);
  --border-strong: rgba(232, 224, 208, 0.16);
  --text: #f0ebe3;
  --text-muted: #9aa89f;
  --text-dim: #6d7a72;
  --accent: #c4a35a;
  --accent-soft: rgba(196, 163, 90, 0.14);
  --income: #3dba8a;
  --income-soft: rgba(61, 186, 138, 0.12);
  --expense: #e07a5f;
  --expense-soft: rgba(224, 122, 95, 0.12);
  --info: #5b9fd4;
  --warning: #d4a017;
  --danger: #e07a5f;
  --success: #3dba8a;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  --font: "DM Sans", system-ui, sans-serif;
  --font-display: "Instrument Serif", Georgia, serif;
  --sidebar-w: 260px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(61, 186, 138, 0.08), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(196, 163, 90, 0.07), transparent 50%),
    linear-gradient(165deg, #0c110f 0%, #121816 45%, #0f1412 100%);
  background-attachment: fixed;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #d4b56e; }

img { max-width: 100%; }

/* Shell */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem;
  background: rgba(15, 20, 18, 0.92);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(12px);
  z-index: 40;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.5rem 0.65rem 1.4rem;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background:
    linear-gradient(135deg, var(--accent) 0%, #8f7340 100%);
  box-shadow: 0 0 0 1px rgba(196, 163, 90, 0.3), 0 8px 20px rgba(196, 163, 90, 0.2);
  flex-shrink: 0;
}

.brand-name {
  display: block;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.brand-sub {
  color: var(--text-dim);
  font-size: 0.75rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  overflow-y: auto;
}

.nav-section {
  margin: 1.1rem 0.65rem 0.4rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.nav-item svg,
.nav-item > i {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}
.nav-item > i {
  width: auto;
  height: auto;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-item:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.nav-item.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-item.is-soon {
  opacity: 0.78;
}

.badge-soon {
  margin-left: auto;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(196, 163, 90, 0.12);
  color: var(--accent);
  border: 1px solid rgba(196, 163, 90, 0.25);
}

.sidebar-footer {
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.35rem 0.5rem;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--accent);
}

.user-chip strong { display: block; font-size: 0.85rem; }
.user-chip small { color: var(--text-dim); font-size: 0.75rem; }

.main-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.1rem 1.75rem;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 20, 18, 0.55);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 30;
}

.page-heading {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  flex: 1;
}

.topbar-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.content {
  padding: 1.5rem 1.75rem 2.5rem;
  flex: 1;
}

.app-footer {
  padding: 0.85rem 1.75rem;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.8rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 550;
  font-size: 0.875rem;
  cursor: pointer;
  transition: transform 0.15s var(--ease), background 0.2s, border-color 0.2s, color 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: linear-gradient(180deg, #d0b26a, var(--accent));
  color: #1a1610;
  border-color: rgba(255, 255, 255, 0.1);
}

.btn-primary:hover { filter: brightness(1.05); color: #1a1610; }

.btn-income {
  background: var(--income-soft);
  color: var(--income);
  border-color: rgba(61, 186, 138, 0.3);
}
.btn-income:hover { background: rgba(61, 186, 138, 0.2); color: var(--income); }

.btn-expense {
  background: var(--expense-soft);
  color: var(--expense);
  border-color: rgba(224, 122, 95, 0.3);
}
.btn-expense:hover { background: rgba(224, 122, 95, 0.2); color: var(--expense); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border-strong);
}
.btn-ghost:hover { background: var(--bg-soft); color: var(--text); }

.btn-danger {
  background: var(--expense-soft);
  color: var(--expense);
  border-color: rgba(224, 122, 95, 0.35);
}

.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn-icon { padding: 0.45rem; }
.btn-icon svg { width: 18px; height: 18px; }

.sidebar-toggle { display: none; }

/* Cards / panels */
.grid {
  display: grid;
  gap: 1rem;
}

.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.stat-card {
  position: relative;
  padding: 1.15rem 1.2rem;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  overflow: hidden;
  animation: rise 0.5s var(--ease) both;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--accent);
}

.stat-card.income::before { background: var(--income); }
.stat-card.expense::before { background: var(--expense); }
.stat-card.balance::before { background: var(--info); }

.stat-label {
  margin: 0 0 0.35rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.stat-value {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.85rem;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.stat-value.positive { color: var(--income); }
.stat-value.negative { color: var(--expense); }

.stat-meta {
  margin-top: 0.45rem;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  animation: rise 0.55s var(--ease) both;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.panel-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.panel-sub {
  margin: 0.15rem 0 0;
  color: var(--text-dim);
  font-size: 0.8rem;
}

.chart-box {
  position: relative;
  height: 280px;
}

.chart-box.sm { height: 220px; }

/* Forms */
.form-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(2, 1fr);
}

.form-grid .full { grid-column: 1 / -1; }

.form-group { display: flex; flex-direction: column; gap: 0.35rem; position: relative; z-index: 1; }
.form-group:focus-within { z-index: 5; }
.form-control { position: relative; }

.form-group label {
  font-size: 0.8rem;
  font-weight: 550;
  color: var(--text-muted);
}

.form-control,
select.form-control,
textarea.form-control {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-soft);
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
  border-color: rgba(196, 163, 90, 0.55);
  box-shadow: 0 0 0 3px rgba(196, 163, 90, 0.12);
}

textarea.form-control { min-height: 90px; resize: vertical; }

.form-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: end;
  margin-bottom: 1rem;
}

.filters .form-group { min-width: 140px; }

/* Table */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

table.data th,
table.data td {
  padding: 0.75rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table.data th {
  color: var(--text-dim);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.2);
}

table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: rgba(255, 255, 255, 0.02); }

.amount-income { color: var(--income); font-weight: 600; }
.amount-expense { color: var(--expense); font-weight: 600; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.badge-cat {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.row-actions {
  display: flex;
  gap: 0.35rem;
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
}

.empty-state h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.4rem;
  color: var(--text);
  margin: 0 0 0.4rem;
}

/* Alerts */
.alert {
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  animation: rise 0.35s var(--ease);
}

.alert-success { background: var(--income-soft); border-color: rgba(61, 186, 138, 0.3); color: var(--income); }
.alert-error, .alert-danger { background: var(--expense-soft); border-color: rgba(224, 122, 95, 0.3); color: var(--expense); }
.alert-warning { background: rgba(212, 160, 23, 0.12); border-color: rgba(212, 160, 23, 0.3); color: #e0b84a; }
.alert-info { background: rgba(91, 159, 212, 0.12); border-color: rgba(91, 159, 212, 0.3); color: var(--info); }

/* Auth / Install */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  background:
    radial-gradient(800px 400px at 20% 10%, rgba(61, 186, 138, 0.1), transparent 55%),
    radial-gradient(700px 380px at 90% 80%, rgba(196, 163, 90, 0.08), transparent 50%),
    var(--bg);
}

.auth-card {
  width: min(420px, 100%);
  padding: 2rem 1.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  animation: rise 0.55s var(--ease);
}

.auth-card h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 2rem;
  margin: 0 0 0.35rem;
}

.auth-card .lead {
  color: var(--text-muted);
  margin: 0 0 1.5rem;
  font-size: 0.92rem;
}

.auth-card .form-grid { grid-template-columns: 1fr; }

/* Module placeholder */
.module-hero {
  position: relative;
  padding: 2.5rem 2rem;
  border-radius: var(--radius);
  border: 1px dashed var(--border-strong);
  background:
    linear-gradient(135deg, rgba(196, 163, 90, 0.06), transparent 55%),
    var(--bg-elevated);
  text-align: center;
  margin-bottom: 1.25rem;
}

.module-hero h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 2rem;
  margin: 0 0 0.5rem;
}

.module-hero p {
  max-width: 520px;
  margin: 0 auto 1.25rem;
  color: var(--text-muted);
}

.feature-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  text-align: left;
}

.feature-item {
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.feature-item h4 {
  margin: 0 0 0.35rem;
  font-size: 0.92rem;
}

.feature-item p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-dim);
}

.schema-preview {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  background: #0a0e0c;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  overflow-x: auto;
  color: #a8b5ad;
  line-height: 1.6;
}

.pagination {
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  display: inline-block;
  vertical-align: middle;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }
.gap-2 { gap: 1rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-right { text-align: right; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .feature-list { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(280px, 86vw);
    transform: translateX(-105%);
    transition: transform 0.28s var(--ease);
    box-shadow: var(--shadow);
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-toggle { display: inline-flex; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .content, .topbar, .app-footer { padding-left: 1rem; padding-right: 1rem; }
  .page-heading { font-size: 1.35rem; }
}
