/* ===== Kur Takip – Shared Stylesheet ===== */

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --brand:       #1a56db;
  --brand-dark:  #1e429f;
  --brand-light: #e8f0fe;
  --accent:      #16a34a;
  --danger:      #dc2626;
  --bg:          #f3f4f6;
  --surface:     #ffffff;
  --border:      #e5e7eb;
  --text:        #111827;
  --muted:       #6b7280;
  --radius:      8px;
  --shadow:      0 2px 8px rgba(0,0,0,.08);
  --nav-h:       60px;
}

html { font-size: 16px; }

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

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

/* ---------- Navbar ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-h);
  padding: 0 1.5rem;
  background: var(--brand);
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}

.navbar__brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
}

.navbar__brand svg {
  width: 1.6rem;
  height: 1.6rem;
  fill: #fff;
}

.navbar__brand:hover { text-decoration: none; opacity: .9; }

.navbar__links {
  display: flex;
  align-items: center;
  gap: .25rem;
  list-style: none;
}

.navbar__links a {
  display: block;
  padding: .45rem .85rem;
  border-radius: var(--radius);
  color: rgba(255,255,255,.88);
  font-size: .9rem;
  font-weight: 500;
  transition: background .15s, color .15s;
}

.navbar__links a:hover,
.navbar__links a.active {
  background: rgba(255,255,255,.18);
  color: #fff; /* NOSONAR */
  text-decoration: none;
}

/* ---------- Page wrapper ---------- */
.page {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1.25rem;
}

/* ---------- Card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem;
}

/* ---------- Auth forms (login / register) ---------- */
.auth-wrapper {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: calc(100vh - var(--nav-h));
  padding: 3rem 1rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.25rem 2rem;
}

.auth-card h2 {
  font-size: 1.4rem;
  margin-bottom: 1.5rem;
  color: var(--text);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  margin-bottom: 1rem;
}

.form-group label {
  font-size: .875rem;
  font-weight: 600;
  color: var(--muted);
}

.form-group input {
  width: 100%;
  padding: .6rem .85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .95rem;
  transition: border-color .15s, box-shadow .15s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .65rem 1.4rem;
  border: none;
  border-radius: var(--radius);
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s, background .15s;
}

.btn:hover { opacity: .9; }

.btn-primary {
  background: var(--brand);
  color: #fff;
}

.btn-sm {
  padding: .45rem .8rem;
  font-size: .82rem;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-block { width: 100%; margin-top: .5rem; }

.auth-footer {
  margin-top: 1.25rem;
  font-size: .875rem;
  color: var(--muted);
  text-align: center;
}

.error-msg {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  color: var(--danger);
  padding: .6rem .9rem;
  font-size: .875rem;
  margin-bottom: 1rem;
}

/* ---------- Hero (home page) ---------- */
.hero {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  border-radius: var(--radius);
  color: #fff;
  padding: 3rem 2.5rem;
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.hero__title {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.2;
}

.hero__sub {
  font-size: 1.05rem;
  opacity: .88;
  max-width: 520px;
}

.hero__actions {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  margin-top: .5rem;
}

.btn-white {
  background: #fff;
  color: var(--brand);
}

.btn-outline-white {
  background: transparent;
  color: #fff;
  border: 2px solid rgba(255,255,255,.7);
}

.btn-outline-white:hover {
  background: rgba(255,255,255,.12);
  opacity: 1;
}

/* ---------- Summary cards row ---------- */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.summary-card__label {
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}

.summary-card__value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
}

.summary-card__change {
  font-size: .8rem;
  font-weight: 600;
}

.summary-card__change.up   { color: var(--accent); }
.summary-card__change.down { color: var(--danger); }

/* ---------- Section headers ---------- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.section-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.month-loader {
  display: flex;
  gap: .5rem;
  align-items: center;
}

.range-loader {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
}

.range-label {
  font-size: .8rem;
  color: var(--muted);
  font-weight: 600;
}

.month-loader input[type="month"] {
  padding: .45rem .55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .85rem;
}

.range-loader input[type="month"],
.range-loader input[type="date"],
.range-loader select {
  padding: .45rem .55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .85rem;
  background: #fff;
}

.chart-meta {
  min-height: 1.25rem;
}

.chart-meta--error {
  color: var(--danger);
  font-weight: 600;
}

.chart-meta--info {
  color: var(--muted);
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  margin-top: .75rem;
}

.chart-legend__item {
  --legend-color: var(--brand);
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .38rem .65rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--legend-color);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-size: .82rem;
  font-weight: 600;
  box-shadow: 0 1px 0 rgba(15, 23, 42, .02);
}

.chart-legend__item:hover {
  background: #f8fbff;
}

.chart-legend__checkbox {
  width: .95rem;
  height: .95rem;
  margin: 0;
  accent-color: var(--legend-color);
}

.chart-legend__checkbox:focus-visible {
  outline: 2px solid var(--legend-color);
  outline-offset: 2px;
  border-radius: 2px;
}

.chart-wrap {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
  padding: .75rem;
}

#range-chart {
  width: 100%;
  height: 280px;
  display: block;
}

.currency-table-wrap {
  overflow-x: auto;
}

.currency-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
  background: #fff;
}

.currency-table th,
.currency-table td {
  border-bottom: 1px solid var(--border);
  padding: 14px 12px;
  text-align: left;
  white-space: nowrap;
}

.currency-table th {
  color: #6b7280;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid #e5e7eb;
}

.currency-table td {
  font-size: 0.98rem;
  border-bottom: 1px solid #eef2f7;
}

.currency-table tbody tr:nth-child(2n) td {
  background: #fcfdff;
}

.currency-group-row td {
  border-bottom: 1px solid var(--border);
  background: #eef4ff;
  color: #1d4ed8;
  font-weight: 700;
  font-size: 1rem;
  border-left: 5px solid #2563eb;
  padding: 18px 12px;
}

.currency-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-weight: 700;
  color: var(--brand-dark);
}

.currency-group__name {
  font-size: .95rem;
}

.currency-group__info {
  font-size: .82rem;
  color: var(--muted);
}

.currency-table td.up,
.currency-table td.down {
  font-weight: 700;
}

.currency-table td.up { color: var(--accent); }
.currency-table td.down { color: var(--danger); }

.currency-table td:nth-child(2) {
  min-width: 130px;
}

@media (max-width: 900px) {
  .currency-table th,
  .currency-table td {
    padding: .7rem .55rem;
  }
}

/* ---------- Placeholder / coming-soon ---------- */
.placeholder-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  min-height: 160px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: .9rem;
  background: #fafafa;
}

.placeholder-box svg {
  width: 2.5rem;
  height: 2.5rem;
  opacity: .35;
}

/* ---------- Stacked full-width layout (home) ---------- */
.home-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .hero__title { font-size: 1.5rem; }
}

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: .8rem;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(17, 24, 39, .35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.loading-overlay.hidden {
  display: none;
}

.loading-popup {
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  min-width: 220px;
  max-width: 90vw;
  padding: 1rem 1.1rem;
  display: flex;
  align-items: center;
  gap: .7rem;
}

.loading-popup p {
  font-size: .92rem;
  color: var(--text);
}

.spinner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 3px solid #dbeafe;
  border-top-color: var(--brand);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Navbar logout form ---------- */
.navbar__logout-form { display: inline; }

.btn-nav {
  font-size: .9rem;
  padding: .45rem .85rem;
}

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.text-muted  { color: var(--muted); }
.mt-3  { margin-top: .75rem; }
.mt-5  { margin-top: 1.25rem; }


.col-fav {
  width: 40px;
  text-align: center;
  color: #94a3b8;
}

.fav-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: #94a3b8;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: transform .15s ease, color .15s ease, background .15s ease;
}

.fav-btn:hover {
  background: #eff6ff;
  color: #1d4ed8;
  transform: scale(1.06);
}

.fav-btn.is-active {
  color: #f59e0b;
}

.fav-btn:disabled {
  opacity: .6;
  cursor: wait;
}

.group-star {
  margin-right: 10px;
  color: #94a3b8;
}

.group-title {
  font-weight: 700;
}

.bank-row:hover {
  background: #f8fafc;
}


.change-positive {
  color: #16a34a;
  font-weight: 600;
}

.change-negative {
  color: #dc2626;
  font-weight: 600;
}

.change-neutral {
  color: #6b7280;
  font-weight: 600;
}

/* Sortable header */
.th-sortable { cursor: pointer; user-select: none; }
.th-sortable .sort-indicator { display: none; }

/* explicit sort button */
.sort-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-left: .35rem;
  font-size: .95rem;
  color: var(--muted);
  line-height: 1;
}
.sort-btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 2px;
}
.fav-btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 2px;
}
.th-sortable.asc .sort-btn { color: var(--brand); }
.th-sortable.desc .sort-btn { color: var(--muted); }

/* ---------- Freshness indicator (last-updated) ---------- */
.freshness-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.freshness-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #9ca3af; /* fallback grey */
  flex: 0 0 10px;
  box-shadow: 0 0 0 4px rgba(156,163,175,0.06);
}

.freshness-text {
  font-size: 0.95rem;
  color: var(--muted);
}

.freshness--fresh .freshness-dot {
  background: #16a34a;
}
.freshness--fresh .freshness-text {
  color: #065f46;
}

.freshness--warn .freshness-dot {
  background: #f59e0b;
}
.freshness--warn .freshness-text {
  color: #92400e;
}

.freshness--stale .freshness-dot {
  background: #ef4444;
}
.freshness--stale .freshness-text {
  color: #7f1d1d;
}

.freshness--unknown .freshness-dot {
  background: #9ca3af;
}
.freshness--unknown .freshness-text {
  color: var(--muted);
}

/* ---------- Favorites toolbar + undo ---------- */
.favs-toolbar {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: .25rem;
  text-decoration: none;
}

.favs-toolbar input,
.favs-toolbar select {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .5rem .65rem;
  font-size: .9rem;
  background: #fff;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  box-shadow: none;
  outline: none;
  text-decoration: none;
}

.favs-toolbar input {
  min-width: 220px;
  flex: 1 1 240px;
}

.favs-toolbar input:focus,
.favs-toolbar select:focus,
.favs-toolbar .btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}

.favs-toolbar .btn {
  white-space: nowrap;
  text-decoration: none;
}

.favs-meta {
  text-decoration: none;
}

.favs-toolbar,
.favs-toolbar * {
  text-decoration: none;
}

.favs-undo {
  margin-top: .9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .65rem .8rem;
  border-radius: var(--radius);
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1e3a8a;
}

.hidden {
  display: none !important;
}

/* Compatibility */
main {
    display: block;
}