/* =====================
   Design Tokens
   ===================== */
:root {
    --bg-primary: #111;
    --bg-surface: #1c1c1e;
    --bg-elevated: #2c2c2e;
    --border-divider: #2c2c2e;
    --text-primary: #e5e5e7;
    --text-secondary: #666;
    --text-muted: #555;
    --accent: #81c784;
    --danger: #ff6b6b;
    --warning: #ffb74d;
    --radius-card: 14px;
    --radius-button: 12px;
}

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

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app {
    height: 100dvh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* =====================
   Screens
   ===================== */
.screen {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    padding-bottom: 80px;
}

.screen.active {
    display: block;
}

/* =====================
   Tab Bar
   ===================== */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-divider);
    display: flex;
    align-items: stretch;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 100;
}

.tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 0;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 10px;
    cursor: pointer;
    transition: color 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.tab svg {
    width: 20px;
    height: 20px;
    stroke-width: 1.75;
}

.tab.active,
.tab:focus-visible {
    color: var(--accent);
    outline: none;
}

.tab:active {
    transform: scale(0.95);
}

/* =====================
   Cards
   ===================== */
.card {
    background: var(--bg-elevated);
    border-radius: var(--radius-card);
    padding: 14px;
    transition: transform 0.1s, background 0.15s;
}

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

/* =====================
   Buttons
   ===================== */
.btn-primary {
    background: var(--accent);
    color: #111;
    border: none;
    border-radius: var(--radius-button);
    padding: 10px 16px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.1s, background 0.15s;
    -webkit-tap-highlight-color: transparent;
}

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

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: none;
    border-radius: var(--radius-button);
    padding: 10px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.1s, background 0.15s;
    -webkit-tap-highlight-color: transparent;
}

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

/* =====================
   Status Dots
   ===================== */
.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.dot-ok       { background: var(--accent); }
.dot-warning  { background: var(--warning); }
.dot-danger   { background: var(--danger); }
.dot-inactive { background: var(--text-muted); }

/* =====================
   Form Elements
   ===================== */
input,
select,
textarea {
    background: var(--bg-elevated);
    border: 1px solid var(--border-divider);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text-primary);
    font-size: 14px;
    width: 100%;
    font-family: inherit;
    transition: border-color 0.15s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

/* =====================
   Typography
   ===================== */
.page-title {
    font-size: 22px;
    font-weight: 600;
}

.page-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}

.section-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* =====================
   Toast
   ===================== */
.toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-elevated);
    color: var(--text-primary);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 13px;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
    transition: opacity 0.3s;
}

.toast.show {
    opacity: 1;
}

/* =====================
   Utility
   ===================== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.font-semibold { font-weight: 600; }

/* =====================
   Spinner
   ===================== */
.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-divider);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* =====================
   Screen Transitions
   ===================== */
.screen {
    animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* =====================
   Notification Prompt
   ===================== */
.notification-prompt {
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-divider);
    border-radius: 0 0 var(--radius-card) var(--radius-card);
    padding: 14px 16px;
    z-index: 100;
    position: relative;
}

/* =====================
   iOS Install Banner
   ===================== */
.ios-install-banner {
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-divider);
    border-radius: 0 0 var(--radius-card) var(--radius-card);
    padding: 10px 12px 10px 16px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    z-index: 100;
    position: relative;
}

.ios-install-banner__content {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    flex: 1;
}

.ios-install-banner__close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    flex-shrink: 0;
    line-height: 1;
}

/* =====================
   Setup Screen
   ===================== */
.setup-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    gap: 24px;
    text-align: center;
    padding: 0 8px;
}

.setup-form {
    width: 100%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.setup-room-prompt {
    width: 100%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--border-divider);
}
