/* ============================================
   Brauciens Aptauja — Apple iOS Dark Style
   Shared Stylesheet
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ---- Design Tokens ---- */
:root {
  color-scheme: dark;

  --bg-primary:    #000000;
  --bg-secondary:  #1C1C1E;
  --bg-tertiary:   #2C2C2E;
  --bg-elevated:   #3A3A3C;

  --glass-bg:      rgba(28, 28, 30, 0.80);
  --glass-border:  rgba(255,255,255,0.10);
  --glass-blur:    20px;

  --text-primary:   #FFFFFF;
  --text-secondary: rgba(235,235,245,0.80);
  --text-tertiary:  rgba(235,235,245,0.60);
  --text-placeholder: #636366;

  --accent-blue:   #0A84FF;
  --accent-blue-hover: #409CFF;
  --accent-green:  #30D158;
  --accent-red:    #FF453A;
  --accent-yellow: #FFD60A;
  --accent-orange: #FF9F0A;

  --star-color:    #FFD700;
  --star-empty:    #3A3A3C;

  --separator:     rgba(84, 84, 88, 0.65);

  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  18px;
  --radius-xl:  22px;
  --radius-pill: 100px;

  --shadow-card: 0 4px 30px rgba(0,0,0,0.6);
  --shadow-btn:  0 2px 12px rgba(10,132,255,0.35);

  --transition: 0.22s cubic-bezier(0.34,1.56,0.64,1);
  --transition-fast: 0.15s ease;
}

/* ---- Reset ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100dvh;
  line-height: 1.5;
  overscroll-behavior: none;
  accent-color: var(--accent-blue);
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 2px; }

/* ---- Typography ---- */
h1 { font-size: clamp(1.5rem, 5vw, 2rem); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
h2 { font-size: 1.125rem; font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: 0.9375rem; font-weight: 500; }
p  { font-size: 0.9375rem; }

/* ---- Layout helpers ---- */
.container {
  max-width: 500px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---- Glass Card ---- */
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.card-section {
  padding: 20px;
  border-bottom: 1px solid var(--separator);
}
.card-section:last-child { border-bottom: none; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  font-size: 1rem;
  border-radius: var(--radius-pill);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  text-decoration: none;
  -webkit-user-select: none;
  user-select: none;
}

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

.btn-primary {
  background: var(--accent-blue);
  color: #fff;
  padding: 15px 28px;
  width: 100%;
  box-shadow: var(--shadow-btn);
  font-size: 1.0625rem;
}

.btn-primary:hover { background: var(--accent-blue-hover); }
.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  padding: 10px 20px;
  font-size: 0.9rem;
}

.btn-ghost:hover { background: var(--bg-elevated); }

.btn-danger {
  background: var(--accent-red);
  color: #fff;
  padding: 8px 16px;
  font-size: 0.85rem;
}

.btn-success {
  background: var(--accent-green);
  color: #fff;
  padding: 10px 20px;
}

/* ---- Inputs & Textarea ---- */
input[type="text"],
input[type="number"],
input[type="password"],
textarea,
select {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--separator);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  padding: 14px 16px;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  -webkit-appearance: none;
  appearance: none;
  resize: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(10,132,255,0.25);
}

::placeholder { color: var(--text-placeholder); }

/* ---- Badge ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-blue   { background: rgba(10,132,255,0.2);   color: var(--accent-blue); }
.badge-green  { background: rgba(48,209,88,0.2);    color: var(--accent-green); }
.badge-red    { background: rgba(255,69,58,0.2);     color: var(--accent-red); }
.badge-yellow { background: rgba(255,214,10,0.2);   color: var(--accent-yellow); }
.badge-orange { background: rgba(255,159,10,0.2);   color: var(--accent-orange); }

/* ---- Star Display (read-only) ---- */
.stars-display {
  display: inline-flex;
  gap: 2px;
  font-size: 1rem;
}

/* ---- Utility ---- */
.sr-only {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important; height: 1px !important;
  margin: -1px !important;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-center { text-align: center; }
.text-sm { font-size: 0.85rem; }
.text-muted { color: var(--text-tertiary); }
.text-secondary { color: var(--text-secondary); }
.w-full { width: 100%; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }

/* ---- Divider ---- */
.divider {
  height: 1px;
  background: var(--separator);
  margin: 0;
}

/* ---- Toast ---- */
.toast-container {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 500;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  animation: toastIn 0.35s cubic-bezier(0.34,1.56,0.64,1) forwards;
  pointer-events: auto;
  white-space: nowrap;
}

.toast.success { border-color: rgba(48,209,88,0.4); color: var(--accent-green); }
.toast.error   { border-color: rgba(255,69,58,0.4);  color: var(--accent-red); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(8px) scale(0.95); }
}

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  z-index: 900;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.modal-backdrop.open {
  opacity: 1;
  pointer-events: all;
}
.modal-sheet {
  background: var(--bg-secondary);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  border: 1px solid var(--glass-border);
  border-bottom: none;
  padding: 24px 20px 40px;
  width: 100%;
  max-width: 500px;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}
.modal-backdrop.open .modal-sheet {
  transform: translateY(0);
}
.modal-handle {
  width: 36px; height: 5px;
  background: var(--bg-elevated);
  border-radius: 3px;
  margin: 0 auto 20px;
}
