/* ============================================================
   Midilli Harcama Takibi - Styles
   ============================================================ */

:root {
  --navy:    #1a3a5c;
  --blue:    #2563eb;
  --teal:    #0891b2;
  --gold:    #d97706;
  --red:     #dc2626;
  --green:   #16a34a;
  --bg:      #f0f4f8;
  --card:    #ffffff;
  --border:  #e2e8f0;
  --text:    #1e293b;
  --muted:   #64748b;
  --radius:  12px;
  --shadow:  0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 40px;
}

/* ---- Header ---- */
header {
  background: linear-gradient(135deg, var(--navy) 0%, #2a5298 100%);
  color: white;
  padding: 16px 20px 0;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
}

.header-title h1 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header-title .subtitle {
  font-size: 0.75rem;
  opacity: 0.75;
  margin-top: 2px;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.rate-badge {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background .15s;
}
.rate-badge:hover { background: rgba(255,255,255,.25); }

/* ---- Settings Panel ---- */
.settings-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.settings-overlay.open { display: flex; }

.settings-box {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  width: min(360px, 90vw);
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.settings-box h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--navy);
}

/* ---- Tabs ---- */
.tabs {
  display: flex;
  background: var(--navy);
  border-top: 1px solid rgba(255,255,255,.1);
}

.tab-btn {
  flex: 1;
  padding: 10px;
  background: none;
  border: none;
  color: rgba(255,255,255,.6);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  position: relative;
}
.tab-btn.active {
  color: #fff;
}
.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 10%;
  right: 10%;
  height: 2px;
  background: #60a5fa;
  border-radius: 2px 2px 0 0;
}

/* ---- Balance Bar ---- */
.balance-bar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  padding: 12px 20px;
  gap: 0;
}

.balance-item {
  flex: 1;
  text-align: center;
  padding: 0 8px;
}
.balance-item:not(:last-child) {
  border-right: 1px solid var(--border);
}

.balance-label {
  display: block;
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 2px;
}

.balance-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--navy);
}
.balance-value.owe-murat { color: var(--teal); }
.balance-value.owe-elif  { color: var(--gold); }
.balance-value.settled   { color: var(--green); }

/* ---- Content Tabs ---- */
.tab-content { display: none; padding: 16px 20px; }
.tab-content.active { display: block; }

/* ---- Form ---- */
.expense-form { display: flex; flex-direction: column; gap: 12px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group { display: flex; flex-direction: column; gap: 4px; }

label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

input, select, textarea {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--card);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
input:focus, select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.amount-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}
.amount-row select { width: 100px; }

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}
.checkbox-group input[type=checkbox] {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
  cursor: pointer;
}
.checkbox-group span {
  font-size: 0.85rem;
  color: var(--text);
}

.btn-primary {
  background: var(--blue);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s;
  margin-top: 4px;
}
.btn-primary:hover   { background: #1d4ed8; }
.btn-primary:active  { transform: scale(.98); }
.btn-primary:disabled { background: #94a3b8; cursor: not-allowed; }

.btn-secondary {
  background: none;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}
.btn-secondary:hover { background: var(--bg); color: var(--text); }

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1e293b;
  color: white;
  padding: 10px 18px;
  border-radius: 24px;
  font-size: 0.85rem;
  z-index: 999;
  transition: transform .25s ease;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }

/* ---- Filters ---- */
.filters {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.filters select { font-size: 0.8rem; padding: 7px 10px; }

/* ---- Expense List ---- */
.expense-list { display: flex; flex-direction: column; gap: 8px; }

.expense-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: start;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity:0; transform:translateY(4px); } to { opacity:1; } }

.expense-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.expense-info .desc {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
}

.expense-info .meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 3px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.meta-chip {
  background: var(--bg);
  border-radius: 4px;
  padding: 1px 6px;
}

.expense-right { text-align: right; }

.expense-amount {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--navy);
}

.expense-payer {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 3px;
}
.payer-murat { color: var(--teal); font-weight: 600; }
.payer-elif  { color: var(--gold); font-weight: 600; }

.expense-actions {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  justify-content: flex-end;
}

.btn-delete {
  background: none;
  border: none;
  cursor: pointer;
  color: #cbd5e1;
  font-size: 0.8rem;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color .15s;
}
.btn-delete:hover { color: var(--red); }

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: 0.9rem; }

/* ---- Summary ---- */
.summary-section { margin-bottom: 20px; }
.summary-section h3 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin-bottom: 10px;
}

.summary-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

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

.summary-card .card-label {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 4px;
}

.summary-card .card-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy);
}

.summary-card .card-sub {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 2px;
}

.balance-card {
  background: linear-gradient(135deg, var(--navy), #2a5298);
  color: white;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
}

.balance-card .bc-label { font-size: 0.75rem; opacity: .75; margin-bottom: 4px; }
.balance-card .bc-value { font-size: 1.6rem; font-weight: 800; }
.balance-card .bc-sub   { font-size: 0.8rem; opacity: .8; margin-top: 4px; }

.category-row {
  background: var(--card);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  box-shadow: var(--shadow);
}

.category-row .cat-icon { font-size: 1.1rem; }
.category-row .cat-name { flex: 1; font-size: 0.85rem; font-weight: 500; }
.category-row .cat-bar-wrap {
  flex: 2;
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
}
.category-row .cat-bar {
  height: 100%;
  background: var(--blue);
  border-radius: 3px;
  transition: width .4s ease;
}
.category-row .cat-amount { font-size: 0.8rem; font-weight: 600; color: var(--navy); min-width: 60px; text-align: right; }

/* ---- Loading ---- */
.loading-state {
  text-align: center;
  padding: 40px;
  color: var(--muted);
  font-size: 0.9rem;
}
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Responsive ---- */
@media (max-width: 380px) {
  .form-row { grid-template-columns: 1fr; }
  .summary-cards { grid-template-columns: 1fr; }
  .balance-bar { padding: 10px 12px; }
}
