/* ==================================================
   RAINBOW VFC ALERTING SYSTEM
   Web Interface Stylesheet - Version 1.0
   ================================================== */

:root {
    --background: #080d16;
    --panel: #111827;
    --card: #1b2433;
    --border: #2d3748;
    --text: #f3f4f6;
    --muted: #9ca3af;
    --red: #dc2626;
    --red-hover: #b91c1c;
    --green: #22c55e;
    --amber: #f59e0b;
    --blue: #60a5fa;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

h1, h2, h3, p {
    margin-top: 0;
}

h1 {
    font-size: 23px;
    letter-spacing: 1.5px;
    margin-bottom: 0;
}

h2 {
    font-size: 19px;
    margin-bottom: 16px;
}

h3 {
    font-size: 17px;
    margin-bottom: 10px;
}

.muted {
    color: var(--muted);
}

.small {
    font-size: 12px;
}

/* ==================================================
   HEADER AND NAVIGATION
   ================================================== */

.topbar {
    background: var(--panel);
    border-bottom: 3px solid var(--red);
    padding: 18px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.brand-icon {
    color: var(--red);
    display: flex;
    align-items: center;
    justify-content: center;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px;
}

.navigation {
    display: flex;
    gap: 8px;
    margin-bottom: 22px;
    border-bottom: 1px solid var(--border);
}

.navigation a {
    text-decoration: none;
    color: var(--muted);
    padding: 12px 20px;
    border-bottom: 3px solid transparent;
    font-weight: 600;
    transition: 0.2s;
}

.navigation a:hover {
    color: white;
    background: var(--panel);
}

.navigation a.selected {
    color: white;
    border-bottom-color: var(--red);
}

/* ==================================================
   PANELS AND STATUS
   ================================================== */

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px;
    margin-bottom: 20px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.section-header h2 {
    margin: 0;
}

.warning-banner {
    background: #302510;
    color: #fbbf24;
    border: 1px solid #785518;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

.status-badge {
    background: #374151;
    color: #d1d5db;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
}

.status-badge.ready {
    background: #123522;
    color: #4ade80;
}

.status-badge.active {
    background: #451a1a;
    color: #f87171;
}

.status-badge.offline {
    background: #302510;
    color: #fbbf24;
}

/* ==================================================
   OUTPUT CARDS
   ================================================== */

.output-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.output-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 22px;
    transition: border-color 0.2s, background 0.2s;
}

.output-grid .output-card {
    text-align: center;
}

.output-card.active {
    border-color: var(--red);
    background: #301c24;
    box-shadow: 0 0 15px rgba(220, 38, 38, 0.15);
}

.output-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    border-radius: 12px;
    background: var(--background);
    display: flex;
    align-items: center;
    justify-content: center;
}

.buzzer-icon {
    color: var(--amber);
}

.strobe-icon {
    color: var(--blue);
}

.output-state {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--muted);
    margin: 8px 0;
}

.output-state.on {
    color: #f87171;
}

.output-state.off {
    color: var(--green);
}

.countdown {
    color: var(--amber);
    font-size: 20px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    min-height: 30px;
    margin: 0;
}

/* ==================================================
   BUTTONS
   ================================================== */

button {
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 12px 20px;
    color: white;
    transition: background 0.2s, border-color 0.2s;
}

button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 3px;
}

.primary-button,
.login-button {
    background: var(--red);
}

.primary-button:hover:not(:disabled),
.login-button:hover:not(:disabled) {
    background: var(--red-hover);
}

.secondary-button {
    background: #263244;
    border-color: #3b485c;
}

.secondary-button:hover:not(:disabled) {
    background: #374151;
}

.stop-button {
    background: #251619;
    color: #f87171;
    border-color: #991b1b;
}

.stop-button:hover:not(:disabled) {
    background: #7f1d1d;
    color: white;
}

.full-width {
    width: 100%;
    margin-top: 12px;
}

.button-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 12px;
}

/* ==================================================
   CONTROLLER INFORMATION
   ================================================== */

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 13px 0;
    border-bottom: 1px solid var(--border);
}

.info-row:last-child {
    border-bottom: none;
}

.info-row span {
    color: var(--muted);
}

.info-row strong {
    text-align: right;
    font-size: 14px;
}

.text-green {
    color: var(--green);
}

.text-red {
    color: #f87171;
}

.text-amber {
    color: var(--amber);
}

/* ==================================================
   SYSTEM CONSOLE
   ================================================== */

.console {
    background: #060a11;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 16px;
    min-height: 150px;
    max-height: 250px;
    overflow-y: auto;
    overflow-wrap: anywhere;
    color: #86efac;
    font-family: Consolas, monospace;
    font-size: 12px;
    line-height: 1.8;
    white-space: pre-wrap;
}

/* ==================================================
   FORMS AND SETTINGS
   ================================================== */

label {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    margin: 14px 0 6px;
}

input {
    width: 100%;
    background: var(--background);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px 14px;
    font: inherit;
    outline: none;
}

input:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.15);
}

input:disabled {
    opacity: 0.5;
}

input[type="number"] {
    max-width: 180px;
    font-size: 20px;
    font-weight: 600;
}

#settings-form .output-card {
    margin-bottom: 16px;
}

#settings-message {
    margin-top: 16px;
    text-align: center;
    font-weight: 600;
}

.success-message {
    color: #4ade80;
}

.error-message {
    background: #35191d;
    border: 1px solid #7f1d1d;
    color: #fca5a5;
    padding: 12px;
    border-radius: 6px;
    margin: 12px 0;
}

/* ==================================================
   EVENT HISTORY
   ================================================== */

.table-wrapper {
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}

.history-table th {
    background: var(--card);
    color: var(--muted);
    padding: 14px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-table td {
    padding: 14px;
    border-bottom: 1px solid var(--border);
}

.history-table tr:hover td {
    background: rgba(255, 255, 255, 0.025);
}

.history-table td:first-child {
    white-space: nowrap;
    color: var(--muted);
}

.event-pager {
    color: #f87171;
    font-weight: 600;
}

.event-remote {
    color: var(--blue);
}

.event-button {
    color: var(--amber);
}

.event-simulation {
    color: var(--amber);
}

.event-system,
.event-web {
    color: var(--muted);
}

/* ==================================================
   LOGIN PAGE
   ================================================== */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: radial-gradient(
        ellipse at top,
        #182131 0%,
        #080d16 65%
    );
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-top: 4px solid var(--red);
    border-radius: 12px;
    padding: 36px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4);
}

.login-card .brand-icon {
    margin-bottom: 16px;
}

.login-card h1,
.login-card h2,
.login-card .subtitle,
.login-card > .muted {
    text-align: center;
}

.login-card h1 {
    font-size: 27px;
}

.subtitle {
    color: var(--muted);
    font-size: 14px;
    margin-top: 4px;
}

.login-divider {
    height: 1px;
    background: var(--border);
    margin: 24px 0;
}

.login-button {
    width: 100%;
    margin-top: 24px;
    padding: 14px;
    letter-spacing: 1px;
}

.security-notice {
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

/* ==================================================
   FOOTER
   ================================================== */

footer {
    color: #6b7280;
    text-align: center;
    font-size: 12px;
    padding: 16px 0;
}

.login-card footer {
    padding-bottom: 0;
}

/* ==================================================
   MOBILE RESPONSIVENESS
   ================================================== */

@media (max-width: 600px) {

    .topbar {
        padding: 14px;
    }

    .brand {
        gap: 8px;
    }

    .brand h1 {
        font-size: 17px;
    }

    .brand p {
        font-size: 11px;
    }

    .topbar button {
        padding: 8px 12px;
        font-size: 12px;
    }

    .container {
        padding: 14px;
    }

    .panel {
        padding: 16px;
    }

    .output-grid {
        gap: 10px;
    }

    .output-card {
        padding: 14px 10px;
    }

    .output-card h3 {
        font-size: 14px;
    }

    .navigation a {
        flex: 1;
        text-align: center;
        padding: 12px 8px;
    }

    .output-state {
        font-size: 24px;
    }

    .login-card {
        padding: 24px;
    }

    .info-row {
        font-size: 13px;
    }

    .history-table {
        font-size: 12px;
    }
}
