/* LumiPlan v2 — Light Analog Theme */

:root {
    --primary: #3b82f6;
    --secondary: #22c55e;
    --bg: #f3f4f6;
    --card-bg: #ffffff;
    --text: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border: #e5e7eb;
}

* { box-sizing: border-box; }

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
    padding: 16px;
    padding-bottom: 80px;
    max-width: 448px;
    margin: 0 auto;
}

/* ── Auth Overlay ─────────────────────────────────── */

#auth-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

#auth-overlay.hidden { display: none; }

.auth-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 1.25rem;
    border: 1px solid var(--border);
    max-width: 384px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* ── Input / Button ───────────────────────────────── */

.input-field {
    width: 100%;
    background: #f9fafb;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 12px;
    outline: none;
    color: var(--text);
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s;
}

.input-field:focus {
    border-color: var(--primary);
}

.btn-primary {
    background: #0f172a;
    color: white;
    padding: 14px;
    border-radius: 0.75rem;
    font-weight: 700;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    font-family: 'Inter', sans-serif;
}

.btn-primary:hover { background: #000; }
.btn-primary:active { transform: scale(0.98); }

/* ── Watch Case — Silver Bezel ────────────────────── */

.watch-case {
    position: relative;
    width: 340px;
    height: 340px;
    margin: 6px auto;
    border-radius: 50%;
    background: linear-gradient(145deg, #e5e7eb, #9ca3af);
    box-shadow:
        0 15px 35px rgba(0, 0, 0, 0.15),
        inset 0 2px 4px rgba(255, 255, 255, 0.8);
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #9ca3af;
}

.watch-face {
    position: relative;
    width: 100%;
    height: 100%;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
}

/* ── Tick Marks ───────────────────────────────────── */

.tick-wrap {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0;
    height: 0;
    pointer-events: none;
    z-index: 10;
}

.tick-hour {
    width: 5px;
    height: 5px;
    background: #000;
    border-radius: 50%;
    transform: translate(-50%, -130px);
}

.tick-half {
    width: 1px;
    height: 7px;
    background: #9ca3af;
    transform: translate(-50%, -130px);
}

/* ── Hour Labels ──────────────────────────────────── */

.hour-label {
    position: absolute;
    font-size: 0.7rem;
    font-weight: 700;
    color: #1a1a1a;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 20;
    text-shadow: 0 0 4px white;
}

/* ── Segments ─────────────────────────────────────── */

.segment {
    position: absolute;
    width: 50%;
    height: 6px;
    left: 50%;
    top: calc(50% - 3px);
    transform-origin: left center;
    pointer-events: none;
    z-index: 5;
}

.segment-visual {
    position: absolute;
    right: 2px;
    width: 12px;
    height: 100%;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 1px;
    pointer-events: auto;
    cursor: pointer;
    transition: all 0.15s ease;
}

.segment-visual:hover {
    background: rgba(0, 0, 0, 0.08);
}

.zone-1 .segment-visual.active {
    background: var(--primary);
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.5);
}

.zone-2 .segment-visual.active {
    background: var(--secondary);
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}

/* ── Clock Hands ──────────────────────────────────── */

.hand {
    position: absolute;
    left: 50%;
    bottom: 50%;
    transform-origin: bottom center;
    pointer-events: none;
    z-index: 25;
}

.hour-hand {
    width: 6px;
    height: 70px;
    background: #000;
    border-radius: 4px 4px 0 0;
    margin-left: -3px;
}

.minute-hand {
    width: 4px;
    height: 105px;
    background: #000;
    border-radius: 3px 3px 0 0;
    margin-left: -2px;
}

.second-hand {
    width: 1.5px;
    height: 125px;
    background: #ef4444;
    margin-left: -0.75px;
    z-index: 26;
}

.center-pin {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    background: #000;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 30;
    border: 2px solid #ef4444;
}

/* ── Glass Card ───────────────────────────────────── */

.glass-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

/* ── Swipe Container ──────────────────────────────── */

.swipe-container {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 0;
}

.swipe-container::-webkit-scrollbar {
    display: none;
}

.swipe-page {
    min-width: 100%;
    scroll-snap-align: start;
    flex-shrink: 0;
}

/* ── Swipe Dots ───────────────────────────────────── */

.swipe-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #d1d5db;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    padding: 0;
}

.swipe-dot.active {
    background: var(--primary);
    box-shadow: 0 0 8px var(--primary);
    width: 24px;
    border-radius: 5px;
}

/* ── Bottom Navigation ────────────────────────────── */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 6px 0;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
    z-index: 40;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
}

.bottom-nav.hidden { display: none; }

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 16px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    transition: color 0.2s;
}

.nav-btn i { font-size: 1.2rem; }
.nav-btn span { font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }

.nav-btn.active { color: var(--primary); }

/* ── Status Indicators ────────────────────────────── */

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e5e7eb;
    transition: all 0.3s;
}

.connection-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #9ca3af;
    transition: all 0.3s;
}

.connection-dot.connected {
    background: #22c55e;
    box-shadow: 0 0 8px #22c55e;
}

/* ── Toast ────────────────────────────────────────── */

.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: white;
    padding: 10px 24px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 100;
    text-transform: uppercase;
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
}

/* ── Logs ─────────────────────────────────────────── */

.log-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: white;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    font-size: 0.8rem;
}

.log-item .log-time {
    color: var(--text-secondary);
    font-size: 0.7rem;
}

.log-success { color: #16a34a; }
.log-fail { color: #dc2626; }

/* ── Schedule Badges ──────────────────────────────── */

.sched-badge {
    display: inline-block;
    font-size: 0.6rem;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 700;
}

.sched-badge-1 {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.sched-badge-2 {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.sched-badge-sys {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
}

/* ── Range Cards (Table view) ─────────────────────── */

.range-card {
    background: #f9fafb;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 10px 12px 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.range-delete-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #d1d5db;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.range-delete-btn:hover {
    background: #fef2f2;
    color: #ef4444;
}

.add-range-btn {
    width: 38px;
    height: 38px;
    border-radius: 0.75rem;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    font-size: 0.875rem;
}

.add-range-btn:hover { filter: brightness(1.1); }
.add-range-btn:active { transform: scale(0.95); }

/* ── Responsive ───────────────────────────────────── */

@media (max-width: 374px) {
    .watch-case {
        width: 290px;
        height: 290px;
    }
    .tick-hour { transform: translate(-50%, -110px); }
    .tick-half { transform: translate(-50%, -110px); }
    .hour-hand { height: 58px; }
    .minute-hand { height: 87px; }
    .second-hand { height: 105px; }
}
