/* AlohaAI Emergency Watchtower — Styles */
/* Tactical dark theme with HVERI red branding */

:root {
    --red: #E61919;
    --red-dark: #990d0d;
    --red-dim: rgba(230, 25, 25, 0.15);
    --bg: #111213;
    --bg-mid: #191b1c;
    --bg-panel: #1e2022;
    --bg-elevated: #252729;
    --border: #2a2d30;
    --border-bright: #3a3d42;
    --text: #e8eaec;
    --text-dim: #7a8088;
    --text-muted: #454a50;
    --green: #22c55e;
    --orange: #f97316;
    --font-mono: 'Share Tech Mono', 'Courier New', monospace;
    --font-ui: 'Barlow', sans-serif;
    --font-display: 'Barlow Condensed', sans-serif;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    background: var(--bg);
}

body {
    font-family: var(--font-ui);
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 24px 16px 48px;
    position: relative;
    overflow-x: hidden;
}

/* Subtle scanline texture */
.scanline-overlay {
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0,0,0,0.04) 2px,
        rgba(0,0,0,0.04) 4px
    );
    pointer-events: none;
    z-index: 9999;
}

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

.container {
    width: 100%;
    max-width: 920px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ── Header ────────────────────────────────────────────────────────────────── */

.header {
    text-align: center;
    padding: 20px 0 14px;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.header-badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.15em;
    color: var(--red);
    background: var(--red-dim);
    border: 1px solid var(--red-dark);
    padding: 3px 10px;
    border-radius: 2px;
    margin-bottom: 10px;
}

.header h1 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 32px;
    letter-spacing: 0.02em;
    line-height: 1;
    margin-bottom: 8px;
}

.title-aloha { color: var(--text); }
.title-ai    { color: var(--red); }
.title-sub {
    display: block;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: var(--text-dim);
    text-transform: uppercase;
    margin-top: 4px;
}

.header-meta {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 6px;
}

.live-clock {
    color: var(--green);
    letter-spacing: 0.08em;
}

.divider { color: var(--border-bright); }

/* ── Input Section ─────────────────────────────────────────────────────────── */

.input-section {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.input-section label {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    color: var(--text-dim);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 6px;
}

.label-icon { color: var(--red); font-size: 10px; }

.input-wrapper {
    position: relative;
}

.input-section input {
    width: 100%;
    padding: 13px 16px;
    font-family: var(--font-mono);
    font-size: 14px;
    background: var(--bg-panel);
    border: 1px solid var(--border-bright);
    border-radius: 3px;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-section input::placeholder { color: var(--text-muted); }

.input-section input:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(230, 25, 25, 0.1);
}

.input-glow {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 1px;
    background: var(--red);
    transition: width 0.3s;
    pointer-events: none;
}

.input-section input:focus ~ .input-glow {
    width: 100%;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */

.controls {
    display: flex;
    gap: 8px;
}

.btn {
    flex: 1;
    padding: 13px 16px;
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: 1px solid transparent;
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.15s;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0);
    transition: background 0.15s;
}

.btn:hover:not(:disabled)::after { background: rgba(255,255,255,0.06); }
.btn:active:not(:disabled) { transform: scale(0.985); }

.btn-icon {
    font-size: 13px;
    opacity: 0.85;
}

.btn-primary {
    background: var(--red);
    color: #fff;
    border-color: var(--red);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 0 16px rgba(230, 25, 25, 0.4);
}

.btn-secondary {
    background: var(--red-dark);
    color: #fff;
    border-color: var(--red-dark);
}

.btn-secondary:disabled {
    background: var(--bg-elevated);
    border-color: var(--border);
    color: var(--text-muted);
    cursor: not-allowed;
}

.btn-gray {
    background: var(--bg-elevated);
    color: var(--text-dim);
    border-color: var(--border-bright);
}

.btn-gray:hover:not(:disabled) {
    border-color: var(--text-muted);
    color: var(--text);
}

/* ── Status Bar ────────────────────────────────────────────────────────────── */

.status-bar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.status-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 7px 14px;
    font-family: var(--font-mono);
    font-size: 12px;
}

.status-label {
    color: var(--text-muted);
    letter-spacing: 0.1em;
    font-size: 10px;
}

.status-value {
    font-weight: 600;
    letter-spacing: 0.05em;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
    transition: background 0.3s;
}

.status-ready    { color: var(--text-muted); }
.status-complete { color: var(--green); }
.status-processing { color: var(--orange); }
.status-error    { color: var(--red); }

.dot-ready      { background: var(--text-muted); }
.dot-complete   { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot-processing {
    background: var(--orange);
    box-shadow: 0 0 6px var(--orange);
    animation: pulse-dot 1s infinite;
}
.dot-error { background: var(--red); box-shadow: 0 0 6px var(--red); }

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

/* ── Log Section ───────────────────────────────────────────────────────────── */

.log-section {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.log-header {
    background: var(--bg-elevated);
    padding: 7px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.log-header-title {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.1em;
    color: var(--red);
    text-transform: uppercase;
}

.log-pulse {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background 0.3s;
}

.log-pulse.active {
    background: var(--orange);
    animation: pulse-dot 0.8s infinite;
}

.log-content {
    padding: 10px 14px;
    max-height: 130px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 12.5px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.log-entry {
    padding: 2px 0;
    color: var(--text-dim);
    line-height: 1.5;
}

.log-entry::before {
    content: attr(data-ts);
    color: var(--text-muted);
    margin-right: 10px;
    font-size: 11px;
}

.log-success    { color: var(--green); }
.log-error      { color: var(--red); }
.log-processing { color: var(--orange); }
.log-info       { color: var(--text-dim); }

/* ── Report Section ────────────────────────────────────────────────────────── */

.report-section {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 3px;
    overflow: hidden;
    flex: 1;
    min-height: 320px;
    display: flex;
    flex-direction: column;
}

.report-header {
    background: var(--bg-elevated);
    padding: 7px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.report-header-title {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.1em;
    color: var(--red);
    text-transform: uppercase;
}

.report-timestamp {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}

.report-content {
    padding: 20px;
    overflow-y: auto;
    max-height: 460px;
    flex: 1;
    line-height: 1.65;
    font-size: 14px;
}

/* Placeholder */
.placeholder-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 60px 20px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 13px;
    text-align: center;
}

.placeholder-icon {
    font-size: 36px;
    opacity: 0.4;
    margin-bottom: 4px;
}

.placeholder-sub {
    font-size: 11px;
    color: var(--text-muted);
    opacity: 0.6;
}

/* Rendered report markdown */
.report-body { color: var(--text); }

.report-body p { margin-bottom: 10px; }

.report-body h1, .report-body h2, .report-body h3 {
    font-family: var(--font-display);
    color: var(--red);
    margin: 16px 0 8px;
    letter-spacing: 0.04em;
}

.report-body h1 { font-size: 18px; }
.report-body h2 { font-size: 16px; }
.report-body h3 { font-size: 15px; }

.report-body ul, .report-body ol {
    margin-left: 22px;
    margin-bottom: 10px;
}

.report-body li { margin: 5px 0; color: #c8ced4; }

.report-body strong { color: var(--text); font-weight: 600; }

.report-body em { color: var(--text-dim); font-style: italic; }

.report-body hr {
    border: none;
    border-top: 1px solid var(--border-bright);
    margin: 16px 0;
}

/* Urgent keyword highlight */
.urgent-kw {
    background: var(--red);
    color: #fff;
    padding: 1px 5px;
    border-radius: 2px;
    font-weight: 700;
    font-size: 0.92em;
}

/* ── Modal ─────────────────────────────────────────────────────────────────── */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(3px);
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--bg-panel);
    border: 1px solid var(--border-bright);
    border-radius: 4px;
    min-width: 340px;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    animation: modal-in 0.18s ease-out;
}

@keyframes modal-in {
    from { transform: translateY(-16px); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}

.modal-header.success { background: rgba(34, 197, 94, 0.15); border-bottom-color: rgba(34, 197, 94, 0.3); }
.modal-header.error   { background: var(--red-dim); border-bottom-color: var(--red-dark); }
.modal-header.info    { background: var(--red-dim); border-bottom-color: var(--red-dark); }

.modal-title {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text);
}

.modal-header.success .modal-title { color: var(--green); }
.modal-header.error   .modal-title { color: var(--red); }

.modal-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.15s;
}

.modal-close:hover { color: var(--text); }

.modal-body {
    padding: 18px;
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1.55;
    font-family: var(--font-mono);
    white-space: pre-wrap;
}

/* ── Scrollbar ─────────────────────────────────────────────────────────────── */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

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

@media (max-width: 600px) {
    .controls { flex-direction: column; }
    .status-bar { flex-direction: column; }
    .header h1 { font-size: 26px; }
}
