/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* UI aksanı — siyah (butonlar, header, login) */
  --accent:       #1a1a1a;
  --accent-light: #333333;
  --accent-pale:  #ebebeb;

  /* Gelir — yeşil */
  --income:       #1e7d45;
  --income-pale:  #e6f4ec;

  /* Gider — kırmızı */
  --red:          #c0392b;
  --red-pale:     #fdecea;

  --gray-50:      #f8f9fa;
  --gray-100:     #f0f2f4;
  --gray-200:     #e2e6ea;
  --gray-500:     #8a9299;
  --gray-700:     #444e5a;
  --gray-900:     #1c2128;
  --white:        #ffffff;
  --shadow-sm:    0 1px 4px rgba(0,0,0,.08);
  --shadow-md:    0 4px 16px rgba(0,0,0,.10);
  --radius:       14px;
  --radius-sm:    8px;
  --font-base:    18px;
}

html { font-size: var(--font-base); -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  line-height: 1.5;
  min-height: 100dvh;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
input, select { font-family: inherit; }

/* ===== LOGIN PAGE ===== */
.login-page {
  background: linear-gradient(145deg, #000000 0%, #1a1a1a 50%, #333333 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 24px 16px;
}

.login-container {
  background: var(--white);
  border-radius: 24px;
  padding: 40px 28px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.logo-icon {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, #000 0%, #333 100%);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
  color: var(--white);
  margin: 0 auto 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}

.login-logo h1 {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.login-logo p {
  font-size: 0.9rem;
  color: var(--gray-500);
  margin-top: 4px;
}

.login-form { display: flex; flex-direction: column; gap: 16px; }

/* ===== APP LAYOUT ===== */
.app { display: flex; flex-direction: column; min-height: 100dvh; }

.app-header {
  background: linear-gradient(135deg, #000000 0%, #1a1a1a 100%);
  color: var(--white);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}

.header-logo {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.header-logout {
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255,255,255,.9);
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  padding: 6px 14px;
  border-radius: 20px;
  transition: background .15s;
}

.app-main {
  flex: 1;
  padding: 16px 16px 100px;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  display: flex;
  z-index: 200;
  box-shadow: 0 -4px 20px rgba(0,0,0,.08);
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 0;
  color: var(--gray-500);
  transition: color .15s;
  gap: 3px;
}

.nav-item svg { width: 24px; height: 24px; }
.nav-item span { font-size: 0.7rem; font-weight: 500; }
.nav-item.active { color: var(--accent); position: relative; }
.nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 3px;
  background: var(--accent);
  border-radius: 0 0 3px 3px;
}
.nav-item.active svg { stroke: var(--accent); }
.nav-item.active span { font-weight: 700; }

/* ===== PAGE TITLES ===== */
.page-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.page-title h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
}

.date-badge {
  font-size: 0.8rem;
  color: var(--gray-500);
  background: var(--gray-100);
  padding: 3px 10px;
  border-radius: 20px;
}

.page-subtitle {
  font-size: 1rem;
  color: var(--gray-700);
  margin-bottom: 12px;
  padding: 0 4px;
}

/* ===== CARDS ===== */
.section-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.section-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 16px;
}

.section-card h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 8px;
}

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

.section-header h3 { margin-bottom: 0; }

.link-btn {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
}

/* ===== SUMMARY CARDS ===== */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.summary-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.summary-card {
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.card-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  opacity: 0.75;
}

.card-amount {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.2;
}

.card-amount.sm { font-size: 1.05rem; }

.card-green   { background: var(--income-pale); color: var(--income); }
.card-red     { background: var(--red-pale);    color: var(--red); }
.card-primary { background: linear-gradient(135deg, #000000 0%, #2a2a2a 100%); color: var(--white); }
.card-primary .card-label { opacity: 0.8; }
.card-neutral { background: var(--gray-100); color: var(--gray-700); }

/* ===== FORMS ===== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-group:last-child { margin-bottom: 0; }

.form-group label, .big-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
}

.big-label { font-size: 1rem; margin-bottom: 8px; display: block; }

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
select {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  color: var(--gray-900);
  background: var(--white);
  transition: border-color .15s;
  -webkit-appearance: none;
  appearance: none;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,0,0,.10);
}

.input-disabled {
  background: var(--gray-100) !important;
  color: var(--gray-500) !important;
  border-color: var(--gray-200) !important;
}

.form-row { display: flex; gap: 12px; }
.flex-1 { flex: 1; }

/* ===== TYPE TOGGLE ===== */
.type-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.type-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .15s;
  font-size: 1rem;
  font-weight: 600;
}

.type-btn input[type="radio"] { display: none; }

.type-btn:has(input:checked).gelir-btn {
  background: var(--income-pale);
  border-color: var(--income);
  color: var(--income);
}

.type-btn:has(input:checked).gider-btn {
  background: var(--red-pale);
  border-color: var(--red);
  color: var(--red);
}

.gelir-btn span::before { content: "+ "; }
.gider-btn span::before { content: "- "; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  text-align: center;
}

.btn-full { width: 100%; }

.btn-primary {
  background: linear-gradient(135deg, #000000 0%, #333333 100%);
  color: var(--white);
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
}

.btn-primary:active { transform: scale(.98); }

.btn-danger {
  background: var(--red-pale);
  color: var(--red);
  border: 2px solid var(--red);
}

.btn-delete {
  background: none;
  border: none;
  color: var(--red);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  opacity: 0.7;
  transition: opacity .15s;
}

.btn-delete:hover { opacity: 1; background: var(--red-pale); }

/* ===== ALERTS ===== */
.alert {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.95rem;
  font-weight: 500;
}

.alert-error   { background: var(--red-pale);    color: var(--red);    border-left: 4px solid var(--red); }
.alert-success { background: var(--income-pale);  color: var(--income); border-left: 4px solid var(--income); }

/* ===== TRANSACTION LIST ===== */
.transaction-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.transaction-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--gray-50);
  border-left: 4px solid transparent;
  gap: 8px;
}

.transaction-item.gelir { border-left-color: var(--income); }
.transaction-item.gider { border-left-color: var(--red); }

.tx-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.tx-type-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 20px;
  display: inline-block;
  width: fit-content;
}

.tx-type-badge.gelir { background: var(--income-pale); color: var(--income); }
.tx-type-badge.gider { background: var(--red-pale);    color: var(--red); }

.tx-desc {
  font-size: 0.95rem;
  color: var(--gray-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-user {
  font-size: 0.72rem;
  color: var(--gray-500);
}

.tx-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.tx-amount {
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
}

.tx-amount.gelir { color: var(--income); }
.tx-amount.gider { color: var(--red); }

/* ===== MINI CHART ===== */
.mini-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 100px;
  padding-bottom: 8px;
}

.chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}

.chart-bars {
  display: flex;
  gap: 2px;
  align-items: flex-end;
}

.bar {
  width: 10px;
  border-radius: 3px 3px 0 0;
  min-height: 3px;
  transition: height .3s;
}

.bar-gelir { background: var(--income); opacity: 0.85; }
.bar-gider { background: var(--red);    opacity: 0.7; }

.chart-label {
  font-size: 0.62rem;
  color: var(--gray-500);
  text-align: center;
  white-space: nowrap;
}

.chart-legend {
  display: flex;
  gap: 16px;
  margin-top: 8px;
}

.legend-gelir, .legend-gider {
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend-gelir::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--income); }
.legend-gider::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--red); }
.legend-gelir { color: var(--income); }
.legend-gider { color: var(--red); }

/* ===== DATA TABLE ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th {
  text-align: left;
  padding: 8px 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--gray-500);
  border-bottom: 2px solid var(--gray-200);
}

.data-table td {
  padding: 10px 6px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: top;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.total-row td {
  padding-top: 12px;
  border-top: 2px solid var(--gray-200);
  border-bottom: none;
}

.text-green { color: var(--income); }
.text-red   { color: var(--red); }
.text-muted { color: var(--gray-500); }
.bold { font-weight: 700; }

.date-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ===== STATS BARS ===== */
.stats-bar-chart { display: flex; flex-direction: column; gap: 14px; }

.stats-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stats-bar-label {
  width: 52px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-700);
  flex-shrink: 0;
}

.stats-bar-track {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stats-bar-fill {
  height: 22px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  min-width: 4px;
  transition: width .4s ease;
}

.stats-bar-fill span {
  font-size: 0.7rem;
  font-weight: 700;
  color: white;
  white-space: nowrap;
}

.stats-bar-fill.gelir { background: var(--income); }
.stats-bar-fill.gider { background: var(--red); }

.stats-kar {
  width: 72px;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: right;
  flex-shrink: 0;
}

/* ===== DATE PICKER ===== */
.date-form { margin-bottom: 12px; }

.date-input-row input[type="date"] { max-width: 100%; }

.quick-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  align-items: center;
}

.quick-dates-label {
  font-size: 0.75rem;
  color: var(--gray-500);
  font-weight: 600;
}

.quick-date-btn {
  padding: 6px 14px;
  border-radius: 20px;
  border: 2px solid var(--gray-200);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-700);
  background: var(--white);
  cursor: pointer;
  transition: all .15s;
}

.quick-date-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-pale);
}

/* ===== FILTER FORM ===== */
.filter-row { display: flex; gap: 12px; }

/* ===== WEEK BADGE ===== */
.week-badge {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gray-700);
}

/* ===== MISC ===== */
.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--gray-500);
  font-size: 0.95rem;
}

.divider {
  height: 1px;
  background: var(--gray-200);
  margin: 20px 0;
}

.help-text {
  font-size: 0.82rem;
  color: var(--gray-500);
  margin-bottom: 12px;
}

.quick-form { display: flex; flex-direction: column; }

/* ===== SNACKBAR ===== */
.snackbar {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1a1a1a;
  color: #fff;
  padding: 13px 22px;
  border-radius: 30px;
  font-size: 0.92rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  z-index: 9999;
  opacity: 0;
  transition: opacity .25s, transform .25s;
  pointer-events: none;
  white-space: nowrap;
  max-width: calc(100vw - 32px);
}

.snackbar.snackbar-success {
  background: var(--income);
}

.snackbar.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== CUSTOM CONFIRM MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 9000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 0 env(safe-area-inset-bottom);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.modal-box {
  background: var(--white);
  border-radius: 20px 20px 0 0;
  padding: 28px 24px 32px;
  width: 100%;
  max-width: 480px;
  transform: translateY(40px);
  transition: transform .25s;
}

.modal-overlay.show .modal-box {
  transform: translateY(0);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 8px;
}

.modal-message {
  font-size: 0.95rem;
  color: var(--gray-700);
  margin-bottom: 24px;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-btn {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.modal-btn-cancel {
  background: var(--gray-100);
  color: var(--gray-700);
}

.modal-btn-confirm {
  background: var(--red);
  color: white;
}

/* ===== STATS PAGE ===== */
.stats-year-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-500);
  margin-bottom: 8px;
  padding: 0 4px;
}

.stats-filter-card { padding: 16px 20px; }
.stats-filter-form .filter-row { gap: 12px; }

/* Monthly card grid */
.month-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.month-card {
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  padding: 14px;
  border: 1px solid var(--gray-200);
}

.month-card-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 10px;
}

.month-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.month-label-g { font-size: 0.72rem; color: var(--gray-500); font-weight: 600; }
.month-label-r { font-size: 0.72rem; color: var(--gray-500); font-weight: 600; }
.month-val-g   { font-size: 0.78rem; color: var(--income); font-weight: 700; }
.month-val-r   { font-size: 0.78rem; color: var(--red);    font-weight: 700; }

.month-card-divider { height: 1px; background: var(--gray-200); margin: 8px 0; }

.month-kar {
  font-size: 0.9rem;
  font-weight: 800;
  text-align: right;
  margin-bottom: 8px;
}

.kar-pos { color: var(--income); }
.kar-neg { color: var(--red); }

.month-minibar { display: flex; flex-direction: column; gap: 3px; }
.month-minibar-g, .month-minibar-r {
  height: 5px;
  border-radius: 3px;
  min-width: 4px;
}
.month-minibar-g { background: var(--income); opacity: 0.7; }
.month-minibar-r { background: var(--red);    opacity: 0.6; }

/* Weekly cards */
.week-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.week-card {
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  border: 1px solid var(--gray-200);
}

.week-card-total {
  background: var(--accent-pale);
  border-color: var(--gray-200);
}

.week-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}

.week-num-badge {
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--accent);
  color: white;
  padding: 3px 10px;
  border-radius: 20px;
}

.total-badge { background: var(--gray-700); }

.week-dates {
  font-size: 0.75rem;
  color: var(--gray-500);
}

.week-card-body {
  display: flex;
  gap: 0;
}

.week-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.week-stat-kar {
  text-align: right;
  align-items: flex-end;
}

.week-stat-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--gray-500);
}

.week-stat-val {
  font-size: 0.88rem;
  font-weight: 700;
}

.week-stat-val.income  { color: var(--income); }
.week-stat-val.expense { color: var(--red); }

/* ===== ŞİFRE SAYFASI ===== */
.sifre-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--gray-200);
}

.sifre-icon {
  width: 52px;
  height: 52px;
  background: var(--accent-pale);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sifre-icon svg {
  width: 24px;
  height: 24px;
  stroke: var(--accent);
}

.sifre-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-900);
}

.sifre-sub {
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-top: 2px;
}

.pw-match-msg {
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 4px;
  min-height: 18px;
}

.pw-match-msg.match   { color: var(--income); }
.pw-match-msg.no-match { color: var(--red); }

/* ===== RESPONSIVE ===== */
@media (min-width: 480px) {
  .summary-grid      { grid-template-columns: repeat(4, 1fr); }
  .summary-grid-2    { grid-template-columns: repeat(4, 1fr); }
  .card-amount       { font-size: 1.1rem; }
  .modal-overlay     { align-items: center; padding: 16px; }
  .modal-box         { border-radius: 20px; }
}

@media (max-width: 360px) {
  :root { --font-base: 16px; }
  .card-amount  { font-size: 1rem; }
  .header-logo  { font-size: 1.2rem; }
}
