/*
  theme.css – iOS-style frosted glass theme
  - Global variables, light/dark support, accessibility, and mobile-first layout
  - Pairs with index.php (buttons use .btn / .btn.secondary, container uses .container, .glass, .logo)
*/

/* ------------------ CSS Variables ------------------ */
:root {
  --bg: #e9eef5;
  --bg-accent: #dbe5f3;
  --fg: #0b0b0f;
  --muted: #6b7280;

  --tint: #0a84ff;      /* iOS system blue */
  --success: #34c759;   /* iOS system green */
  --danger: #ff3b30;    /* iOS system red */

  --glass: rgba(255,255,255,0.18);
  --card: rgba(255,255,255,0.22);
  --border: rgba(255,255,255,0.35);
  --shadow: rgba(15, 23, 42, 0.25);

  --radius: 18px;
  --radius-lg: 24px;
  --blur: 20px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b10;
    --bg-accent: #0f1118;
    --fg: #f4f6fa;
    --muted: #9aa3b2;
    --glass: rgba(20, 20, 25, 0.35);
    --card: rgba(20, 20, 25, 0.45);
    --border: rgba(255,255,255,0.08);
    --shadow: rgba(0,0,0,0.55);
  }
}

/* ------------------ Reset & Base ------------------ */
* { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--fg);
  background:
    radial-gradient(60% 60% at 20% 20%, #a9c6ff 0%, transparent 60%),
    radial-gradient(50% 50% at 80% 30%, #ffd1e3 0%, transparent 55%),
    radial-gradient(45% 45% at 30% 80%, #d4ffea 0%, transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-accent) 100%);
  background-attachment: fixed;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 16px;
}

/*************************** Layout ***************************/
.container {
  width: min(520px, 100%);
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
           max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
  backdrop-filter: blur(var(--blur)) saturate(180%);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: 0 30px 80px var(--shadow);
  padding: 32px 20px;
  text-align: center;
}

.logo {
  width: 96px;
  height: 96px;
  margin: 0 auto 16px auto;
  background: url('../img/logo.png') no-repeat center/contain;
}

h1 {
  font-size: clamp(24px, 5vw, 32px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 24px 0;
}

/* ------------------ Buttons ------------------ */
.btn {
  -webkit-tap-highlight-color: transparent;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin: 12px 0;
  padding: 16px 18px;
  border: 1px solid rgba(255,255,255,0.45);
  border-radius: 9999px;
  font-weight: 700;
  font-size: clamp(16px, 4vw, 18px);
  color: #0c1320;
  background: linear-gradient(180deg, rgba(255,255,255,0.75), rgba(255,255,255,0.55));
  box-shadow: 0 6px 16px var(--shadow), inset 0 0 0 0 rgba(255,255,255,.2);
  cursor: pointer;
  transition: transform .08s ease, box-shadow .2s ease, background-color .2s ease, opacity .2s ease;
}

.btn.secondary {
  color: #fff;
  border-color: rgba(52,199,89,0.8);
  background: linear-gradient(180deg, rgba(52,199,89,0.95), rgba(36,138,61,0.85));
}

.btn:active { transform: scale(0.98); }
.btn:hover { box-shadow: 0 10px 22px var(--shadow); }

.btn-icon { font-size: 1.35em; line-height: 1; }

/* ------------------ Focus & Accessibility ------------------ */
:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(10,132,255,0.25), 0 0 0 1px rgba(10,132,255,0.85);
  border-radius: 14px;
}

/*************************** Cards & Inputs (optional reuse) ***************************/
.card {
  background: var(--card);
  -webkit-backdrop-filter: blur(calc(var(--blur) * 0.7)) saturate(180%);
  backdrop-filter: blur(calc(var(--blur) * 0.7)) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 10px 30px var(--shadow);
}

.input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.6);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--fg);
  outline: none;
  transition: box-shadow .2s ease, border-color .2s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 0 8px 20px var(--shadow);
}
.input:focus { border-color: rgba(10,132,255,0.8); box-shadow: 0 0 0 4px rgba(10,132,255,0.2), inset 0 1px 0 rgba(255,255,255,0.3); }

/* ------------------ Motion & Reduce Motion ------------------ */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ------------------ Utilities ------------------ */
.hidden { display: none !important; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
