:root {
  --bg-page: #f5f7fa;
  --bg-surface: #ffffff;
  --bg-subtle: #eef2f6;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-color: #cbd5e1;
  --border-light: #e2e8f0;

  --primary: #0f766e;
  --primary-hover: #115e59;
  --primary-light: #ccfbf1;

  --need-bg: #fef3c7;
  --need-text: #92400e;
  --need-border: #fde68a;

  --deal-bg: #dcfce7;
  --deal-text: #166534;
  --deal-border: #86efac;

  --bought-bg: #e2e8f0;
  --bought-text: #475569;
  --bought-border: #cbd5e1;

  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;

  --info-bg: #eff6ff;
  --info-border: #bfdbfe;
  --info-text: #1e3a8a;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  padding-bottom: 88px;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */
.app-header {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-badge {
  font-size: 1.6rem;
  line-height: 1;
  background: var(--primary-light);
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.app-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.app-subtitle {
  margin: 2px 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.btn-add-header {
  width: 100%;
}

/* Main Content */
.app-main {
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Storage Notice */
.storage-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background-color: var(--info-bg);
  border: 1px solid var(--info-border);
  color: var(--info-text);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
}

.storage-notice-icon {
  font-size: 1.1rem;
  line-height: 1.3;
  flex-shrink: 0;
}

.storage-notice code {
  background: rgba(255, 255, 255, 0.7);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.8rem;
}

/* Summary Bar */
.summary-bar {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.summary-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: var(--shadow-sm);
}

.summary-card.summary-need {
  border-left: 4px solid #f59e0b;
}

.summary-card.summary-deal {
  border-left: 4px solid #16a34a;
}

.summary-card.summary-bought {
  border-left: 4px solid #64748b;
}

.summary-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.summary-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Filters Panel */
.filters-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

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

.section-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

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

/* Dar telefonda (375 px) iki sütunda seçim yazıları kesiliyordu ("Tüm Kategorile…") → tek sütun */
@media (max-width: 459px) {
  .filters-grid {
    grid-template-columns: 1fr;
  }
}

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

.filter-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Form Controls */
.form-control {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text-main);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.18);
}

.form-control[aria-invalid="true"] {
  border-color: var(--danger);
  background-color: #fffafb;
}

textarea.form-control {
  min-height: 68px;
  resize: vertical;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 16px;
  font-size: 0.92rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
}

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

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: var(--bg-subtle);
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background-color: #e2e8f0;
}

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

.btn-danger-outline {
  background-color: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  min-height: 38px;
  padding: 6px 12px;
  font-size: 0.84rem;
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
  text-decoration: underline;
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-light);
  background: var(--bg-subtle);
  color: var(--text-main);
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Product Cards */
.product-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.product-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.product-card[data-status="alındı"] {
  background-color: #fafbfc;
  opacity: 0.88;
}

.product-card[data-status="fırsat bulundu"] {
  border-color: var(--deal-border);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

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

.card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
}

.badge-category {
  background-color: var(--bg-subtle);
  color: var(--text-main);
  text-transform: capitalize;
}

.badge-child {
  background-color: #f3e8ff;
  color: #6b21a8;
}

.badge-status-need {
  background-color: var(--need-bg);
  color: var(--need-text);
  border: 1px solid var(--need-border);
}

.badge-status-deal {
  background-color: var(--deal-bg);
  color: var(--deal-text);
  border: 1px solid var(--deal-border);
}

.badge-status-bought {
  background-color: var(--bought-bg);
  color: var(--bought-text);
  border: 1px solid var(--bought-border);
}

.card-title {
  margin: 2px 0 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  word-break: break-word;
}

.product-card[data-status="alındı"] .card-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* Meta Grid inside Card */
.card-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 12px;
  background: var(--bg-page);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.meta-item {
  display: flex;
  flex-direction: column;
}

.meta-label {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.meta-value {
  font-weight: 600;
  color: var(--text-main);
  word-break: break-word;
}

.card-note {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-muted);
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
  padding: 7px 10px;
  border-radius: 4px;
}

/* Deal Box inside Product Card */
.card-deal-box {
  background-color: #f0fdf4;
  border: 1px solid var(--deal-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.deal-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}

.deal-store {
  font-weight: 700;
  color: var(--deal-text);
  font-size: 0.9rem;
}

.deal-prices {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.deal-current-price {
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--deal-text);
}

.deal-old-price {
  font-size: 0.84rem;
  color: var(--text-muted);
  text-decoration: line-through;
}

.deal-discount-pill {
  background-color: #16a34a;
  color: #ffffff;
  font-size: 0.73rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
}

.deal-extra {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.82rem;
  color: #166534;
  align-items: center;
}

.deal-link {
  color: #0f766e;
  font-weight: 600;
  text-decoration: underline;
}

/* Card Status & Action Controls */
.card-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 6px;
  border-top: 1px solid var(--border-light);
}

.status-switcher {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.status-btn {
  min-height: 38px;
  padding: 6px 8px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.status-btn.active[data-status-val="ihtiyaç var"] {
  background: var(--need-bg);
  color: var(--need-text);
  border-color: #f59e0b;
}

.status-btn.active[data-status-val="fırsat bulundu"] {
  background: var(--deal-bg);
  color: var(--deal-text);
  border-color: #16a34a;
}

.status-btn.active[data-status-val="alındı"] {
  background: var(--bought-bg);
  color: var(--bought-text);
  border-color: #64748b;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.card-actions .btn {
  flex: 1;
}

/* Empty State */
.empty-state {
  background: var(--bg-surface);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 36px 20px;
  text-align: center;
}

.empty-icon {
  font-size: 2.4rem;
  margin-bottom: 8px;
}

.empty-title {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.empty-desc {
  margin: 0 0 16px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* Mobile Bottom Action Bar */
.mobile-fab-bar {
  max-width: 820px;
  margin: 16px auto 0;
  padding: 0 16px;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.modal-sheet {
  background: var(--bg-surface);
  width: 100%;
  max-width: 600px;
  max-height: 92vh;
  overflow-y: auto;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 18px 16px 24px;
  box-shadow: var(--shadow-md);
}

.modal-sheet-sm {
  max-width: 440px;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}

.modal-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-subtitle {
  margin: 2px 0 0;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.form-required-hint {
  margin: 0 0 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.req-star {
  color: var(--danger);
  font-weight: 700;
}

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

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

.form-label {
  font-size: 0.86rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.req-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--danger);
  background: var(--danger-bg);
  padding: 1px 6px;
  border-radius: 4px;
}

.opt-badge {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-subtle);
  padding: 1px 6px;
  border-radius: 4px;
}

.field-error {
  font-size: 0.8rem;
  color: var(--danger);
  font-weight: 600;
}

.form-error-banner {
  background-color: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.inline-deal-box {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: #f8fafc;
}

.inline-deal-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.inline-deal-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.inline-deal-grid {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.modal-actions-split {
  justify-content: space-between;
  flex-wrap: wrap;
}

.modal-actions-right {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

.delete-confirm-text {
  margin: 8px 0 4px;
  font-size: 0.95rem;
}

/* Header Actions */
.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.header-actions .btn-add-header {
  flex: 1 1 100%;
}

/* Giriş (Erişim Koruması) Kartı */
.auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  max-width: 440px;
  margin: 24px auto;
  box-shadow: var(--shadow-md);
}

.auth-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.auth-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.auth-desc {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Yerel Veri Taşıma ve Yedekleme Paneli */
.migration-panel {
  background-color: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.migration-header strong {
  color: #92400e;
  font-size: 0.92rem;
}

.migration-desc {
  margin: 4px 0 0;
  font-size: 0.83rem;
  color: #78350f;
}

.migration-status-msg {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #166534;
  font-size: 0.84rem;
  font-weight: 600;
}

.migration-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Tablet & Desktop Breakpoint */
@media (min-width: 640px) {
  body {
    padding-bottom: 32px;
  }

  .header-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .header-actions {
    flex-wrap: nowrap;
  }

  .header-actions .btn-add-header {
    flex: 0 0 auto;
    width: auto;
  }

  .btn-add-header {
    width: auto;
  }

  .mobile-fab-bar {
    display: none;
  }

  .summary-bar {
    grid-template-columns: repeat(4, 1fr);
  }

  .filters-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .form-group-full {
    grid-column: 1 / -1;
  }

  .card-meta {
    grid-template-columns: repeat(4, 1fr);
  }

  .card-controls {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .modal-backdrop {
    align-items: center;
    padding: 16px;
  }

  .modal-sheet {
    border-radius: var(--radius-lg);
    padding: 22px 24px;
  }
}

/* Mağazalarda ara: sitenin kendi arama sayfasını açan düğmeler (sunucu siteye istek atmaz) */
.store-search {
  margin-top: 10px;
  border-top: 1px solid var(--border-color);
  padding-top: 8px;
}

.store-search > summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
}

.store-search-note {
  margin: 4px 0 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.store-search-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}

.store-search-grid .btn {
  min-height: 44px;
  justify-content: center;
  text-decoration: none;
}
