/* Pulse ring on active punch-in */

:root {
    --bg: #0a0f1e;
    --surface: #111827;
    --border: rgba(255,255,255,0.07);
    --text: #f1f5f9;
    --muted: #64748b;
    --in: #10b981;
    --in-glow: rgba(16,185,129,0.25);
    --out: #f43f5e;
    --out-glow: rgba(244,63,94,0.25);
    --warn: #f59e0b;
    --blue: #3b82f6;
    --radius: 16px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Syne', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

    /* Animated bg grid */
    body::before {
        content: '';
        position: fixed;
        inset: 0;
        background-image: linear-gradient(rgba(59,130,246,0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(59,130,246,0.03) 1px, transparent 1px);
        background-size: 40px 40px;
        pointer-events: none;
        z-index: 0;
    }

.app {
    position: relative;
    z-index: 1;
    max-width: 430px;
    margin: 0 auto;
    padding: 0 0 100px;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 0;
}

.header-brand {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--muted);
    text-transform: uppercase;
}

.header-time {
    font-family: 'DM Mono', monospace;
    font-size: 13px;
    color: var(--muted);
}

#liveClock {
    color: var(--text);
}

/* Hero clock */
.hero {
    text-align: center;
    padding: 40px 20px 20px;
}

.hero-date {
    font-size: 13px;
    color: var(--muted);
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.hero-clock {
    font-family: 'DM Mono', monospace;
    font-size: clamp(52px, 14vw, 72px);
    font-weight: 500;
    line-height: 1;
    background: linear-gradient(135deg, #f1f5f9 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -2px;
}

/* Status pill */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 100px;
    margin: 16px auto 0;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s;
}

    .status-pill .dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: var(--muted);
        animation: pulse-dot 2s ease-in-out infinite;
    }

    .status-pill.in .dot {
        background: var(--in);
        box-shadow: 0 0 8px var(--in);
    }

    .status-pill.out .dot {
        background: var(--out);
        box-shadow: 0 0 8px var(--out);
    }

@keyframes pulse-dot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

/* Location card */
.loc-card {
    margin: 24px 16px 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.3s;
}

    .loc-card.ok {
        border-color: rgba(16,185,129,0.3);
    }

    .loc-card.warn {
        border-color: rgba(245,158,11,0.3);
    }

    .loc-card.error {
        border-color: rgba(244,63,94,0.3);
    }

    .loc-card.loading {
        border-color: rgba(59,130,246,0.3);
    }

.loc-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.loc-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    background: rgba(255,255,255,0.05);
}

    .loc-icon.spin {
        animation: spin 1.5s linear infinite;
    }

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loc-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--muted);
}

.loc-value {
    font-size: 13px;
    color: var(--text);
    margin-top: 2px;
}

.loc-badge {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 100px;
}

    .loc-badge.inside {
        background: var(--in-glow);
        color: var(--in);
    }

    .loc-badge.outside {
        background: var(--out-glow);
        color: var(--out);
    }

    .loc-badge.warning {
        background: rgba(245,158,11,0.15);
        color: var(--warn);
    }

/* Map */
#map {
    height: 180px;
    background: #0a0f1e;
}

.map-hidden {
    display: none;
}

/* Geo-fence ring visual */
.fence-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 12px;
    color: var(--muted);
    border-top: 1px solid var(--border);
}

.fence-bar {
    flex: 1;
    height: 4px;
    background: rgba(255,255,255,0.06);
    border-radius: 100px;
    overflow: hidden;
}

.fence-bar-fill {
    height: 100%;
    border-radius: 100px;
    background: var(--in);
    transition: width 0.5s ease, background 0.3s;
}

.fence-dist {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    min-width: 50px;
    text-align: right;
}

/* Worked time */
.worked-card {
    margin: 12px 16px 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.worked-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
}

.worked-label {
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--muted);
}

.worked-value {
    font-family: 'DM Mono', monospace;
    font-size: 20px;
    font-weight: 500;
    margin-top: 4px;
}

    .worked-value.green {
        color: var(--in);
    }

    .worked-value.red {
        color: var(--out);
    }

/* Punch buttons */
.punch-area {
    padding: 24px 16px 0;
}

.btn-punch {
    width: 100%;
    border: none;
    cursor: pointer;
    border-radius: var(--radius);
    padding: 20px;
    font-family: 'Syne', sans-serif;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

    .btn-punch:active {
        transform: scale(0.97);
    }

    .btn-punch:disabled {
        opacity: 0.35;
        cursor: not-allowed;
        transform: none;
    }

.btn-in {
    background: linear-gradient(135deg, #059669, #10b981);
    color: white;
    box-shadow: 0 8px 32px var(--in-glow), 0 2px 8px rgba(0,0,0,0.4);
    margin-bottom: 12px;
}

    .btn-in:not(:disabled):hover {
        box-shadow: 0 12px 40px rgba(16,185,129,0.4), 0 2px 8px rgba(0,0,0,0.4);
    }

.btn-out {
    background: linear-gradient(135deg, #e11d48, #f43f5e);
    color: white;
    box-shadow: 0 8px 32px var(--out-glow), 0 2px 8px rgba(0,0,0,0.4);
}

    .btn-out:not(:disabled):hover {
        box-shadow: 0 12px 40px rgba(244,63,94,0.4), 0 2px 8px rgba(0,0,0,0.4);
    }

.btn-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    width: 10px;
    height: 10px;
    transform: scale(0);
    animation: ripple 0.6s linear;
    pointer-events: none;
}

@keyframes ripple {
    to {
        transform: scale(40);
        opacity: 0;
    }
}

/* Loading spinner on button */
.btn-spinner {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white;
    animation: spin 0.6s linear infinite;
    display: none;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    max-width: 360px;
    text-align: center;
    display: flex;
    align-items: center;
    gap: 10px;
}

    .toast.show {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    .toast.success {
        border-color: rgba(16,185,129,0.4);
    }

    .toast.error {
        border-color: rgba(244,63,94,0.4);
    }

    .toast.warning {
        border-color: rgba(245,158,11,0.4);
    }

/* Punch history */
.section {
    margin: 24px 16px 0;
}

.section-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 12px;
}

.punch-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.punch-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.punch-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

    .punch-item-icon.in {
        background: var(--in-glow);
    }

    .punch-item-icon.out {
        background: var(--out-glow);
    }

.punch-item-body {
    flex: 1;
    min-width: 0;
}

.punch-item-type {
    font-size: 13px;
    font-weight: 700;
}

    .punch-item-type.in {
        color: var(--in);
    }

    .punch-item-type.out {
        color: var(--out);
    }

.punch-item-addr {
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.punch-item-time {
    font-family: 'DM Mono', monospace;
    font-size: 13px;
    color: var(--text);
    flex-shrink: 0;
}

.punch-item-fence {
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 100px;
    background: var(--in-glow);
    color: var(--in);
    margin-top: 3px;
    display: inline-block;
}

    .punch-item-fence.out-fence {
        background: var(--out-glow);
        color: var(--out);
    }

/* Bottom nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(10,15,30,0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    display: flex;
    z-index: 100;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 0 14px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--muted);
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s;
}

    .nav-item.active {
        color: var(--blue);
    }

    .nav-item svg {
        margin-bottom: 4px;
    }

/* Shimmer skeleton */
@keyframes shimmer {
    0% {
        background-position: -400px 0;
    }

    100% {
        background-position: 400px 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, var(--surface) 25%, rgba(255,255,255,0.05) 50%, var(--surface) 75%);
    background-size: 800px 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

/* Pulse ring on active punch-in */
.pulse-ring {
    position: absolute;
    inset: -4px;
    border-radius: 20px;
    border: 2px solid var(--in);
    animation: ring-pulse 2s ease-out infinite;
    pointer-events: none;
}

@keyframes ring-pulse {
    0% {
        opacity: 0.6;
        transform: scale(1);
    }

    100% {
        opacity: 0;
        transform: scale(1.05);
    }
}