/* ─── Design Tokens ─────────────────────────────────── */
:root {
    --bg-deep:        #0f172a;
    --bg-mid:         #1e293b;
    --bg-soft:        #334155;
    --glass:          rgba(15, 23, 42, 0.62);
    --card:           rgba(30, 41, 59, 0.80);
    --text-main:      #e2e8f0;
    --text-soft:      #94a3b8;
    --accent:         #22d3ee;
    --accent-dim:     rgba(34, 211, 238, 0.18);
    --accent-border:  rgba(34, 211, 238, 0.35);
    --danger:         #ef4444;
    --warning:        #f59e0b;
    --success:        #10b981;
    --border:         rgba(148, 163, 184, 0.18);
    --shadow:         0 4px 24px rgba(2, 8, 23, 0.40);
    --shadow-xl:      0 20px 60px rgba(2, 8, 23, 0.50);
    --radius-sm:      10px;
    --radius-md:      14px;
    --radius-lg:      20px;

    /* Touch target minimum */
    --touch:          44px;
}

/* ─── Reset ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

/* ─── Body ──────────────────────────────────────────── */
body {
    margin: 0;
    min-height: 100vh;
    color: var(--text-main);
    font-family: "Space Grotesk", "Segoe UI", Tahoma, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    background:
        radial-gradient(circle at 10% 10%, #164e63 0%, transparent 40%),
        radial-gradient(circle at 90% 20%, #0f766e 0%, transparent 40%),
        linear-gradient(135deg, var(--bg-deep) 0%, var(--bg-mid) 60%, #111827 100%);
    -webkit-font-smoothing: antialiased;
}

/* ─── Orbs (decorative) ─────────────────────────────── */
.bg-orb {
    position: fixed;
    border-radius: 999px;
    filter: blur(70px);
    opacity: 0.22;
    pointer-events: none;
    z-index: 0;
}
.orb-left  { width: 240px; height: 240px; left: -80px;  top: 30px;    background: #0ea5e9; }
.orb-right { width: 280px; height: 280px; right: -80px; bottom: 30px; background: #10b981; }

/* ─── Brand Chip ─────────────────────────────────────── */
.brand-chip {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.8px;
    color: #67e8f9;
    background: rgba(8, 145, 178, 0.22);
    border: 1px solid var(--accent-border);
    border-radius: 999px;
    padding: 5px 12px;
    margin-bottom: 12px;
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════
   AUTH / LOGIN PAGE
══════════════════════════════════════════════════════ */
.auth-page { position: relative; }

.wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    position: relative;
    z-index: 1;
}

.form-signin {
    width: 100%;
    max-width: 420px;
    padding: 28px 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow-xl);
}

.form-signin-heading {
    margin: 0 0 4px;
    font-family: "Sora", "Space Grotesk", sans-serif;
    font-weight: 700;
    font-size: 28px;
}

.form-caption {
    margin: 6px 0 20px;
    color: var(--text-soft);
    font-size: 14px;
}

.form-control {
    display: block;
    width: 100%;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.72);
    color: var(--text-main);
    font-size: 15px;
    padding: 12px 14px;
    margin-bottom: 10px;
    min-height: var(--touch);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    font-family: inherit;
}
.form-control::placeholder { color: #64748b; }
.form-control:focus {
    border-color: rgba(34, 211, 238, 0.55);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12);
    background: rgba(15, 23, 42, 0.92);
    color: var(--text-main);
}

.auth-btn {
    display: block;
    width: 100%;
    min-height: var(--touch);
    margin-top: 8px;
    border: 0;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    color: #052e16;
    font-weight: 700;
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    background: linear-gradient(120deg, #5eead4 0%, #2dd4bf 55%, #22d3ee 100%);
    transition: filter .2s, transform .1s;
}
.auth-btn:active { transform: scale(0.98); }
.auth-btn:hover  { filter: brightness(1.06); }

.auth-error {
    margin: 14px 0 0;
    color: #fecaca;
    background: rgba(220, 38, 38, 0.16);
    border: 1px solid rgba(239, 68, 68, 0.35);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 13.5px;
}

/* ═══════════════════════════════════════════════════════
   PANEL / DASHBOARD — MOBILE FIRST
══════════════════════════════════════════════════════ */
.panel-page { position: relative; z-index: 1; }

.panel-shell {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px 12px 32px;
}

/* ── Header ── */
.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.panel-title {
    margin: 0;
    font-family: "Sora", "Space Grotesk", sans-serif;
    font-weight: 700;
    font-size: 26px;
    line-height: 1.15;
}

.panel-subtitle {
    margin: 6px 0 0;
    color: var(--text-soft);
    font-size: 13px;
    line-height: 1.5;
}

.logout-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--touch);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(248, 113, 113, 0.40);
    color: #fecaca;
    background: rgba(127, 29, 29, 0.32);
    padding: 0 14px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    transition: background .2s;
}
.logout-btn:hover {
    color: #ffe4e6;
    text-decoration: none;
    background: rgba(153, 27, 27, 0.50);
}
.logout-btn:active { opacity: .85; }

/* ── Cards ── */
.panel-card {
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
    padding: 14px 12px;
    margin-bottom: 12px;
}

.panel-section-title {
    margin: 0 0 10px;
    font-family: "Sora", "Space Grotesk", sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: #a5f3fc;
    letter-spacing: .3px;
}

/* ── Template Links ── */
.template-list { display: flex; flex-direction: column; gap: 8px; }

.template-card {
    display: flex;
    flex-direction: column;
    gap: 7px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.70);
    padding: 10px;
}

.template-url-input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.72);
    color: #93c5fd;
    padding: 9px 10px;
    font-size: 13px;
    font-family: "Courier New", monospace;
    min-height: var(--touch);
    outline: none;
    /* truncate long URLs */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.copy-btn {
    width: 100%;
    min-height: var(--touch);
    border-radius: 8px;
    border: 1px solid var(--accent-border);
    color: #67e8f9;
    background: var(--accent-dim);
    padding: 0 14px;
    font-weight: 600;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: background .2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.copy-btn::before { content: "⎘"; font-size: 16px; }
.copy-btn:hover  { background: rgba(8, 145, 178, 0.32); }
.copy-btn:active { opacity: .80; }

/* ── Log Box ── */
.log-box {
    min-height: 200px;
    max-height: 340px;
    font-family: "Courier New", monospace;
    font-size: 12.5px;
    line-height: 1.55;
    resize: vertical;
}

/* ── Action Buttons ── */
.panel-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.panel-actions .btn {
    width: 100%;
    min-height: var(--touch);
    border: 0;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: filter .15s, transform .1s;
    padding: 0 16px;
}
.panel-actions .btn:active { transform: scale(0.97); }
.panel-actions .btn:hover  { filter: brightness(1.08); }

/* Bootstrap colour overrides */
.btn-danger  { background: #dc2626; color: #fff; }
.btn-success { background: #059669; color: #fff; }
.btn-warning { background: #d97706; color: #fff; }

/* ── Log Section Header ── */
.log-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 8px;
    flex-wrap: wrap;
}
.log-section-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.log-section-left .panel-section-title { margin: 0; }

.log-counter-badge {
    font-size: 11px;
    color: var(--text-soft);
    background: rgba(148,163,184,0.10);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 3px 10px;
    white-space: nowrap;
}

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.2px;
    color: #4ade80;
    background: rgba(74,222,128,0.12);
    border: 1px solid rgba(74,222,128,0.28);
    border-radius: 999px;
    padding: 4px 10px;
    white-space: nowrap;
    transition: color .3s, background .3s, border-color .3s;
}
.live-badge.stopped {
    color: #64748b;
    background: rgba(100,116,139,0.10);
    border-color: rgba(100,116,139,0.20);
}
.live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ade80;
    animation: pulseDot 1.4s ease-in-out infinite;
    flex-shrink: 0;
}
.live-badge.stopped .live-dot { background: #475569; animation: none; }
@keyframes pulseDot {
    0%, 100% { opacity: 1;   transform: scale(1);    }
    50%       { opacity: 0.4; transform: scale(0.75); }
}

/* ════════════════════════════════════════════════════
   LOG FEED  — 2-column card grid  (lf-* classes)
════════════════════════════════════════════════════ */

/* ── Feed Container ── */
.log-feed {
    min-height: 200px;
    max-height: 640px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    align-items: start;
    margin-bottom: 16px;
    padding-right: 2px;
    scrollbar-width: thin;
    scrollbar-color: #1e293b transparent;
}
.log-feed::-webkit-scrollbar       { width: 4px; }
.log-feed::-webkit-scrollbar-track { background: transparent; }
.log-feed::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 99px; }

/* ── Empty State ── */
.log-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 56px 24px;
    gap: 10px;
    text-align: center;
    color: var(--text-soft);
    grid-column: 1 / -1;
}
.log-empty-icon { font-size: 40px; line-height: 1; }
.log-empty p    { margin: 0; font-size: 14px; color: #64748b; }
.log-empty small{ font-size: 12px; color: #334155; }

/* ── Card Shell ── */
.lf-card {
    border-radius: 16px;
    border: 1px solid rgba(148,163,184,0.11);
    background: linear-gradient(160deg, rgba(22,33,53,0.97) 0%, rgba(15,23,42,0.99) 100%);
    overflow: hidden;
    box-shadow: 0 4px 28px rgba(0,0,0,0.32), 0 1px 6px rgba(0,0,0,0.20);
    animation: lfSlideIn .28s cubic-bezier(0.16,1,0.3,1);
    transition: box-shadow .2s, border-color .2s, transform .15s;
    display: flex;
    flex-direction: column;
}
.lf-card:hover {
    box-shadow: 0 10px 44px rgba(0,0,0,0.42), 0 2px 10px rgba(0,0,0,0.26);
    border-color: rgba(148,163,184,0.24);
    transform: translateY(-2px);
}
@keyframes lfSlideIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

.lf-card--device   { border-left: 3px solid #22d3ee; }
.lf-card--location { border-left: 3px solid #4ade80; }
.lf-card--image    { border-left: 3px solid #a78bfa; }
.lf-card--audio    { border-left: 3px solid #fb923c; }
.lf-card--unknown  { border-left: 3px solid #475569; }

/* ── Card Header ── */
.lf-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 20px;
    background: rgba(0,0,0,0.26);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    flex-shrink: 0;
}
.lf-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-radius: 6px;
    padding: 4px 10px;
    white-space: nowrap;
}
.lf-badge--device   { background: rgba(34,211,238,.13); color: #67e8f9; border: 1px solid rgba(34,211,238,.25); }
.lf-badge--location { background: rgba(74,222,128,.13);  color: #86efac; border: 1px solid rgba(74,222,128,.25); }
.lf-badge--image    { background: rgba(167,139,250,.13); color: #c4b5fd; border: 1px solid rgba(167,139,250,.25); }
.lf-badge--audio    { background: rgba(251,146,60,.13);  color: #fdba74; border: 1px solid rgba(251,146,60,.25); }
.lf-badge--unknown  { background: rgba(100,116,139,.13); color: #94a3b8; border: 1px solid rgba(100,116,139,.22); }

.lf-time {
    font-size: 11px;
    color: #475569;
    font-family: "Courier New", monospace;
    letter-spacing: .4px;
    white-space: nowrap;
}

/* ── Card Body ── */
.lf-body { flex: 1; display: flex; flex-direction: column; }

/* ── IP Hero (device cards) ── */
.lf-ip-block {
    padding: 20px 24px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    background: rgba(34,211,238,0.03);
}
.lf-ip {
    font-family: "Courier New", monospace;
    font-size: 20px;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: 1.5px;
    line-height: 1.2;
}
.lf-isp {
    font-size: 12px;
    color: #64748b;
    margin-top: 5px;
}

/* ── Info Section ── */
.lf-section { padding: 18px 24px; }

.lf-section-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    color: #475569;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(148,163,184,0.07);
}

/* ── Divider ── */
.lf-divider {
    height: 1px;
    background: rgba(255,255,255,0.04);
    margin: 0 24px;
    flex-shrink: 0;
}

/* ── Field Rows ── */
.lf-field {
    display: flex;
    align-items: baseline;
    gap: 12px;
    line-height: 1.7;
}
.lf-field + .lf-field { margin-top: 7px; }

.lf-key {
    flex-shrink: 0;
    width: 88px;
    font-size: 12px;
    color: #475569;
    font-weight: 500;
}
.lf-val {
    font-size: 13px;
    color: #cbd5e1;
    font-family: "Courier New", monospace;
    word-break: break-word;
    line-height: 1.6;
    flex: 1;
}
.lf-val--accent { color: #93c5fd; }

/* ── Location Card ── */
.lf-loc-coords {
    padding: 22px 24px 8px;
    font-family: "Courier New", monospace;
    font-size: 18px;
    font-weight: 700;
    color: #86efac;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.4;
}

/* ── Media Card ── */
.lf-media-path {
    margin: 20px 24px 10px;
    font-family: "Courier New", monospace;
    font-size: 13px;
    color: #94a3b8;
    word-break: break-all;
    padding: 10px 14px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    border: 1px solid rgba(148,163,184,0.08);
    line-height: 1.5;
}

/* ── CTA Buttons inside cards ── */
.lf-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 600;
    border-radius: 8px;
    padding: 8px 16px;
    margin: 6px 24px 22px;
    text-decoration: none;
    white-space: nowrap;
    transition: background .18s, transform .1s;
    cursor: pointer;
    align-self: flex-start;
}
.lf-btn:active { transform: scale(0.97); }
.lf-btn--green  { color: #4ade80; background: rgba(74,222,128,.12);  border: 1px solid rgba(74,222,128,.25); }
.lf-btn--purple { color: #c4b5fd; background: rgba(167,139,250,.12); border: 1px solid rgba(167,139,250,.25); }
.lf-btn--orange { color: #fdba74; background: rgba(251,146,60,.12);  border: 1px solid rgba(251,146,60,.25); }
.lf-btn--green:hover  { background: rgba(74,222,128,.22);  color: #4ade80;  text-decoration: none; }
.lf-btn--purple:hover { background: rgba(167,139,250,.22); color: #c4b5fd; text-decoration: none; }
.lf-btn--orange:hover { background: rgba(251,146,60,.22);  color: #fdba74; text-decoration: none; }

/* ── Raw Fallback ── */
.lf-raw {
    font-family: "Courier New", monospace;
    font-size: 12px;
    color: #64748b;
    white-space: pre-wrap;
    word-break: break-all;
    margin: 0;
    padding: 20px 24px;
    line-height: 1.65;
}

/* ═══════════════════════════════════════════════════════
   TABLET  ≥ 600px
══════════════════════════════════════════════════════ */
@media (min-width: 600px) {
    .panel-shell { padding: 20px 20px 36px; }

    .panel-title { font-size: 30px; }
    .panel-subtitle { font-size: 14px; }

    .panel-card { padding: 18px 16px; }

    .template-card {
        flex-direction: row;
        align-items: center;
    }
    .template-url-input { min-height: 40px; }
    .copy-btn {
        width: auto;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .panel-actions {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .panel-actions .btn {
        width: auto;
        flex: 1 1 auto;
    }

    .log-feed { max-height: 560px; }
}

/* ═══════════════════════════════════════════════════════
   DESKTOP  ≥ 960px
══════════════════════════════════════════════════════ */
@media (min-width: 960px) {
    .panel-shell { padding: 32px 24px 40px; }

    .panel-title { font-size: clamp(32px, 3.5vw, 44px); }

    .panel-card { padding: 24px 22px; border-radius: var(--radius-lg); }
    .panel-section-title { font-size: 17px; }

    .template-url-input { font-size: 14px; }

    .panel-actions { flex-direction: row; }
    .panel-actions .btn { flex: 0 0 auto; width: auto; }

    .log-feed {
        grid-template-columns: 1fr 1fr;
        max-height: 720px;
    }

    .log-empty { grid-column: 1 / -1; }

    .lf-ip { font-size: 22px; }
}
