/* ==========================================================================
   components.css — shared UI primitives
   ========================================================================== */

/* -------- Card -------- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    position: relative;
}
.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--accent-gradient);
    border-radius: var(--radius) var(--radius) 0 0;
    opacity: 0.85;
}
.card.no-stripe::before { display: none; }
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.card-header h2, .card-header h3 { margin-bottom: 0; }
.card > h2 { margin-bottom: 16px; }

/* -------- Button -------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 20px;
    height: 38px;
    font-size: 13px;
    font-weight: 600;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    white-space: nowrap;
}
.btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}
.btn-primary {
    height: 42px;
    padding: 0 26px;
    background: var(--accent-gradient);
    color: #fff;
    border: none;
    font-weight: 700;
    letter-spacing: 0.3px;
    box-shadow: 0 4px 14px -4px rgba(233, 69, 96, 0.5);
    min-width: 160px;
}
.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-cta);
    color: #fff;
    border: none;
}
.btn-primary:disabled,
.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* -------- Input -------- */
.input {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-app);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    transition: var(--transition);
}
.input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.12);
}
.input::placeholder { color: var(--text-dim); }

/* -------- Select -------- */
.select {
    padding: 11px 38px 11px 14px;
    background: var(--bg-app);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    transition: var(--transition);
}
.select:hover { border-color: var(--accent); }
.select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.12);
}

/* -------- Status chip / pill -------- */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    padding: 5px 12px;
    background: var(--bg-app);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    white-space: nowrap;
}
.chip::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-dim);
}
.chip.online  { color: var(--term-green); border-color: rgba(0, 212, 138, 0.4); background: rgba(0, 212, 138, 0.08); }
.chip.online::before  { background: var(--term-green); box-shadow: 0 0 6px var(--term-green); }
.chip.offline { color: var(--text-dim); }
.chip.running { color: var(--accent); border-color: rgba(233, 69, 96, 0.4); background: rgba(233, 69, 96, 0.08); }
.chip.running::before { background: var(--accent); animation: pulse 1.5s ease-in-out infinite; }
.chip.done    { color: var(--term-green); border-color: rgba(0, 212, 138, 0.4); background: rgba(0, 212, 138, 0.08); }
.chip.done::before    { background: var(--term-green); }
.chip.error   { color: var(--term-red); border-color: rgba(255, 71, 87, 0.4); background: rgba(255, 71, 87, 0.08); }
.chip.error::before   { background: var(--term-red); }

/* -------- Severity badge -------- */
.sev {
    display: inline-block;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.sev.critical { background: rgba(255, 71, 87, 0.15); color: var(--sev-critical); }
.sev.high     { background: rgba(255, 107, 53, 0.15); color: var(--sev-high); }
.sev.medium   { background: rgba(245, 158, 11, 0.15); color: var(--sev-medium); }
.sev.low      { background: rgba(0, 212, 138, 0.15); color: var(--sev-low); }
.sev.info     { background: rgba(56, 189, 248, 0.15); color: var(--sev-info); }

/* -------- Tables -------- */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
table { font-size: 13px; }
th {
    text-align: left;
    padding: 12px 14px;
    background: var(--bg-app);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}
tbody tr { transition: var(--transition); }
tbody tr:hover { background: var(--bg-elev); }
tbody tr:last-child td { border-bottom: none; }

/* -------- Stats grid -------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--border);
    transition: var(--transition);
}
.stat-card.critical::before { background: var(--sev-critical); }
.stat-card.high::before     { background: var(--sev-high); }
.stat-card.medium::before   { background: var(--sev-medium); }
.stat-card.low::before      { background: var(--sev-low); }
.stat-card.info::before     { background: var(--sev-info); }
.stat-card:hover            { transform: translateY(-2px); border-color: var(--accent); }
.stat-value {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -1px;
    color: var(--text-primary);
}
.stat-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* -------- Toasts -------- */
#toast-container {
    position: fixed;
    top: 72px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 9999;
    pointer-events: none;
}
.toast {
    padding: 12px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    pointer-events: auto;
    animation: toast-in 0.22s ease;
    max-width: 360px;
}
.toast.success { border-left-color: var(--term-green); }
.toast.error   { border-left-color: var(--term-red); }
.toast.warning { border-left-color: var(--term-amber); }
@keyframes toast-in {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* -------- Filters row -------- */
.filters {
    display: flex;
    align-items: center;
    gap: 10px;
}
.filters .input,
.filters .select { height: 36px; padding-top: 0; padding-bottom: 0; }
