/* ============================================================
   YOLHESABI.COM — Global Components
   components.css
   ============================================================ */

/* ── Header ───────────────────────────────────────────────── */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  z-index: var(--z-sticky);
  background: rgba(250, 248, 255, 0.80);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--outline-variant);
  transition: background var(--duration-normal) var(--ease-out),
              border-color var(--duration-normal) var(--ease-out);
}

[data-theme="dark"] .app-header {
  background: rgba(17, 19, 24, 0.85);
  border-bottom-color: var(--outline-variant);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 var(--space-4);
  width: 100%;
  box-sizing: border-box;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: var(--text-lg);
  letter-spacing: -0.04em;
  color: var(--primary);
}

.brand-icon {
  font-size: 22px;
  color: var(--primary);
}

/* ── Bottom Navigation ────────────────────────────────────── */
.app-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 var(--space-4) var(--space-4);
  background: rgba(250, 248, 255, 0.90);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--outline-variant);
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
}

[data-theme="dark"] .app-nav {
  background: rgba(17, 19, 24, 0.92);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-spring);
  color: var(--outline);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  border: none;
  background: none;
}

.nav-item:active {
  transform: scale(0.90);
}

.nav-item.active {
  background: var(--primary-fixed);
  color: var(--primary);
}

[data-theme="dark"] .nav-item.active {
  background: color-mix(in srgb, var(--primary) 20%, transparent);
  color: var(--primary);
}

/* ── Page Wrapper ─────────────────────────────────────────── */
.page {
  padding-top: calc(var(--header-h) + var(--space-4));
  padding-left: var(--space-3);
  padding-right: var(--space-3);
  max-width: 1100px;
  margin: 0 auto;
  overflow-x: hidden;
  box-sizing: border-box;
  width: 100%;
}

@media (min-width: 480px) {
  .page { padding-left: var(--space-5); padding-right: var(--space-5); }
}
@media (min-width: 768px) {
  .page { padding-left: var(--space-6); padding-right: var(--space-6); }
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--surface-container-lowest);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--outline-variant);
}

.card-sm { padding: var(--space-4); }
.card-lg { padding: var(--space-8); }

.card-surface {
  background: var(--surface-container-low);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-lg);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-base);
  cursor: pointer;
  border: none;
  transition: all var(--duration-fast) var(--ease-out);
  white-space: nowrap;
  text-decoration: none;
}

.btn:active { transform: scale(0.96); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-container) 100%);
  color: var(--on-primary);
  box-shadow: 0 4px 16px rgba(12, 69, 200, 0.28);
}
.btn-primary:hover {
  box-shadow: 0 6px 24px rgba(12, 69, 200, 0.36);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--secondary-container);
  color: var(--on-secondary-container);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--outline-variant);
  color: var(--on-surface);
}
.btn-outline:hover {
  background: var(--surface-container-high);
}

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

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  border-radius: var(--radius-md);
}

.btn-lg {
  padding: var(--space-4) var(--space-10);
  font-size: var(--text-md);
}

.btn-icon {
  padding: var(--space-2);
  border-radius: var(--radius-full);
  width: 40px;
  height: 40px;
}

/* ── Input / Form Elements ────────────────────────────────── */
.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.input-label {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
  margin-left: var(--space-1);
}

.input-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--surface-container-high);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-4);
  border: 2px solid transparent;
  transition: all var(--duration-fast) var(--ease-out);
}

.input-wrap:focus-within {
  border-color: var(--primary);
  background: var(--surface-container-lowest);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 10%, transparent);
}

.input-wrap input,
.input-wrap select {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--on-surface);
}

.input-wrap input::placeholder {
  color: var(--outline);
  font-weight: 400;
}

.input-icon {
  color: var(--primary);
  flex-shrink: 0;
}

/* ── Toggle Switch ────────────────────────────────────────── */
.toggle-label {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--on-surface-variant);
  user-select: none;
}

.toggle-track {
  position: relative;
  width: 48px;
  height: 28px;
  background: var(--surface-container-highest);
  border-radius: var(--radius-full);
  transition: background var(--duration-fast) var(--ease-out);
  flex-shrink: 0;
}

.toggle-label input { display: none; }

.toggle-label input:checked ~ .toggle-track {
  background: var(--secondary);
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background: #fff;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-xs);
  transition: transform var(--duration-normal) var(--ease-spring);
}

.toggle-label input:checked ~ .toggle-track .toggle-thumb {
  transform: translateX(20px);
}

/* ── Badge / Chip ─────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.badge-primary { background: var(--primary-fixed); color: var(--primary); }
.badge-secondary { background: var(--secondary-container); color: var(--on-secondary-container); }
.badge-tertiary { background: var(--clr-tertiary-50); color: var(--clr-tertiary-600); }
.badge-success { background: #e6f4ea; color: #1b6c3a; }
.badge-warning { background: #fff8e1; color: #b45309; }
.badge-error { background: var(--error-container); color: var(--error); }

[data-theme="dark"] .badge-success { background: #003d1e; color: #5ddfa1; }
[data-theme="dark"] .badge-warning { background: #2e2000; color: #f9cb42; }

/* ── Progress Bar ─────────────────────────────────────────── */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--surface-container-highest);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--secondary);
  transition: width var(--duration-slow) var(--ease-out);
}

.progress-fill-primary { background: var(--primary); }
.progress-fill-tertiary { background: var(--tertiary); }

/* ── Divider ──────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--outline-variant);
  border: none;
  margin: var(--space-4) 0;
}

/* ── Avatar ───────────────────────────────────────────────── */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--primary-fixed);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 700;
  font-size: var(--text-base);
  color: var(--primary);
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg  { width: 56px; height: 56px; font-size: var(--text-xl); }
.avatar-xl  { width: 80px; height: 80px; font-size: var(--text-2xl); }

/* ── Toast / Snackbar ─────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--space-4));
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  background: var(--inverse-surface, #2e3037);
  color: var(--inverse-on-surface, #f0f0f9);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-lg);
  font-size: var(--text-base);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  animation: toast-in var(--duration-normal) var(--ease-spring);
  white-space: nowrap;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Skeleton Loader ──────────────────────────────────────── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-container-high) 25%,
    var(--surface-container-highest) 50%,
    var(--surface-container-high) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes skeleton-shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ── Map Container ────────────────────────────────────────── */
.map-container {
  width: 100%;
  border-radius: var(--radius-xl);
  overflow: hidden;
  position: relative;
  background: var(--surface-container);
}

/* ── Utilities ────────────────────────────────────────────── */
.text-primary   { color: var(--primary); }
.text-secondary { color: var(--secondary); }
.text-muted     { color: var(--on-surface-variant); }
.text-outline   { color: var(--outline); }

.font-display   { font-family: var(--font-display); }
.font-bold      { font-weight: 700; }
.font-black     { font-weight: 900; }

.rounded-full   { border-radius: var(--radius-full); }

.flex           { display: flex; }
.flex-col       { flex-direction: column; }
.items-center   { align-items: center; }
.justify-between{ justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2          { gap: var(--space-2); }
.gap-3          { gap: var(--space-3); }
.gap-4          { gap: var(--space-4); }

.w-full         { width: 100%; }
.relative       { position: relative; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Modal (global) ───────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: var(--z-modal);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: var(--space-4);
  backdrop-filter: blur(4px);
}
@media (min-width: 480px) {
  .modal-overlay { align-items: center; }
}
.modal-card {
  background: var(--surface-container-lowest);
  border-radius: var(--radius-2xl);
  padding: var(--space-8) var(--space-6);
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-3);
  animation: modal-slide-up 280ms var(--ease-spring);
}
@keyframes modal-slide-up {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.modal-icon {
  width: 56px; height: 56px;
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: var(--space-1);
}
.modal-icon .material-symbols-outlined { font-size: 28px; }
.modal-title {
  font-family: var(--font-display); font-weight: 800;
  font-size: var(--text-xl); color: var(--on-surface); margin: 0;
}
.modal-desc {
  font-size: var(--text-base); color: var(--on-surface-variant);
  max-width: 300px; line-height: 1.5;
}
.modal-actions {
  display: flex; flex-direction: column;
  gap: var(--space-3); width: 100%; margin-top: var(--space-2);
}
.modal-actions .btn { width: 100%; justify-content: center; }