/* ===== Base layout ===== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top, #1f2933, #020617);
    color: #e5e7eb;
    min-height: 100vh;
}

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Topbar ===== */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 40px;
    background: rgba(15, 23, 42, 0.95);
    border-bottom: 1px solid rgba(148, 163, 184, 0.3);
    backdrop-filter: blur(14px);
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #38bdf8;
}

.logo img {
    height: 32px;          /* yaha se logo size control hoga */
    width: auto;
    display: block;
}

.topbar nav a {
    color: #cbd5f5;
    text-decoration: none;
    margin-left: 18px;
    font-size: 0.9rem;
    opacity: 0.8;
}

.topbar nav a:hover {
    opacity: 1;
    color: #38bdf8;
}

/* ===== Main card ===== */
.main-card {
    max-width: 900px;
    width: 100%;
    margin: 40px auto;
    padding: 32px 28px 40px;
    background: rgba(15, 23, 42, 0.98);
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.35);
}

.main-card h1 {
    font-size: 2.2rem;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 0.95rem;
    color: #9ca3af;
    margin-bottom: 24px;
}

/* ===== Analyzer area ===== */
.analyzer textarea {
    width: 100%;
    min-height: 140px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(75, 85, 99, 0.9);
    background: #020617;
    color: #e5e7eb;
    resize: vertical;
    font-size: 0.95rem;
    outline: none;
}

.analyzer textarea:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.6);
}

/* Buttons */
.buttons {
    margin-top: 14px;
    display: flex;
    gap: 10px;
}

button {
    border: none;
    cursor: pointer;
    border-radius: 999px;
    font-size: 0.95rem;
    padding: 10px 22px;
    font-weight: 500;
    transition: transform 0.08s ease, box-shadow 0.1s ease, background 0.2s ease;
}

button:focus-visible {
    outline: 2px solid #38bdf8;
    outline-offset: 2px;
}

button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 30px rgba(56, 189, 248, 0.35);
}

/* primary */
button:not(.secondary) {
    background: linear-gradient(135deg, #1d4ed8, #38bdf8);
    color: #f9fafb;
}

/* secondary */
button.secondary {
    background: #0f172a;
    color: #e5e7eb;
    border: 1px solid rgba(148, 163, 184, 0.7);
}

button.secondary:hover {
    background: #111827;
}

/* ===== Result box ===== */
.result-box {
    margin-top: 20px;
    text-align: left;
    font-size: 0.92rem;
}

/* Base alert style */
.alert {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: #020617;
}

/* severity colors */
.low {
    border-color: #22c55e;
    background: rgba(22, 163, 74, 0.14);
}

.medium {
    border-color: #facc15;
    background: rgba(251, 191, 36, 0.15);
}

.high {
    border-color: #fb923c;
    background: rgba(249, 115, 22, 0.18);
}

.critical {
    border-color: #ef4444;
    background: rgba(248, 113, 113, 0.2);
}

/* generic text fallback */
.result-box p {
    margin-top: 8px;
    color: #d1d5db;
}

/* footer */
.footer {
    text-align: center;
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 20px;
}

/* ===== DASHBOARD EXTRA STYLES (charts etc.) ===== */

/* overview cards thoda decent dikhne ke liye */
.cards {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin: 20px 40px 10px;
}

.card {
    flex: 1 1 180px;
    padding: 14px 18px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(148, 163, 184, 0.4);
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.5);
}

.card h3 {
    font-size: 0.9rem;
    color: #9ca3af;
    margin-bottom: 6px;
}

.card p {
    font-size: 1.4rem;
    font-weight: 600;
}

/* charts ko professional size dena */
#severityChart,
#perHourChart {
    max-width: 650px;   /* chart width limit */
    width: 100%;
    max-height: 260px;  /* height limit */
    display: block;
    margin: 16px auto 32px; /* center + spacing */
}

/* table thoda readable */
#alertsTable {
    width: 100%;
    border-collapse: collapse;
    margin: 16px auto 40px;
    max-width: 960px;
    font-size: 0.9rem;
}

#alertsTable thead {
    background: rgba(15, 23, 42, 0.98);
}

#alertsTable th,
#alertsTable td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(55, 65, 81, 0.8);
}

#alertsTable th {
    text-align: left;
    color: #9ca3af;
}

#alertsTable tbody tr:hover {
    background: rgba(15, 23, 42, 0.8);
}

/* ===== Toast notifications ===== */

#toast-container {
    position: fixed;
    top: 18px;
    right: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 9999;
}

.toast {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.9rem;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: rgba(15, 23, 42, 0.96);
    color: #e5e7eb;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
    animation: toast-in 0.22s ease-out;
    max-width: 260px;
}

.toast.success {
    border-color: #22c55e;
}

.toast.error {
    border-color: #ef4444;
}

.toast.info {
    border-color: #38bdf8;
}

.toast.hide {
    opacity: 0;
    transform: translateX(12px);
    transition: all 0.25s ease-out;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(12px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===== Button loading state ===== */

button {
    position: relative; /* for spinner */
}

.btn-loading {
    opacity: 0.7;
    cursor: wait;
}

.btn-loading::after {
    content: "";
    position: absolute;
    right: 14px;
    top: 50%;
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: 2px solid rgba(148, 163, 184, 0.7);
    border-top-color: #38bdf8;
    transform: translateY(-50%);
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}


/* ===== Loader (analyze in progress) ===== */
.loader {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #e5e7eb;
    display: flex;
    align-items: center;
    gap: 8px;
}

.loader.hidden {
    display: none;
}

.spinner {
    width: 16px;
    height: 16px;
    border-radius: 999px;
    border: 2px solid rgba(148, 163, 184, 0.6);
    border-top-color: #38bdf8;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== Toast notifications ===== */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    min-width: 220px;
    max-width: 320px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.85rem;
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: rgba(15, 23, 42, 0.97);
    color: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    animation: slide-in 0.25s ease-out;
}

.toast span {
    flex: 1;
}

.toast button {
    background: transparent;
    border: none;
    color: inherit;
    padding: 0 2px;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: none;
    transform: none;
}

/* toast color types */
.toast.info {
    border-left: 4px solid #38bdf8;
}

.toast.success {
    border-left: 4px solid #22c55e;
}

.toast.error {
    border-left: 4px solid #ef4444;
}

@keyframes slide-in {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}
