* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-padding-top: 70px;
}

:root {
    --text: #f5f7fb; /* primary page text (soft white) */
    --muted: rgba(245,247,251,0.78); /* less prominent text */
    --muted-weak: rgba(245,247,251,0.65);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px 12px 30px;
    color: var(--text);
}

.container {
     /* fully transparent panel: no background, no blur. Kept as a semantic container only. */
     background: transparent;
     border: none;
     -webkit-backdrop-filter: none;
     backdrop-filter: none;
    border-radius: 12px;
    padding: 50px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
    max-width: 800px;
    width: 100%;
    margin: 15px auto;
}

/* Decorative SVG background layering */
.hero-svg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.hero-svg svg {
    width: 120%;
    height: 120%;
    transform: translate(-10%, -8%);
    display: block;
}

.hero-svg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(102, 126, 234, 0.22), rgba(118, 75, 162, 0.22));
}

/* keep content above the SVG */
.container,
footer {
    position: relative;
    z-index: 1;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255,255,255,0.04);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Hide decorative SVG on small screens to save bandwidth and reduce clutter */
@media (max-width: 640px) {
    .hero-svg {
        display: none;
    }
}

/* header layout adjustments */
.site-header>div {
    max-width: 900px;
    margin: 0 auto;
}

.site-header nav button {
    margin-left: 8px;
}

.logo {
    text-align: center;
    margin-bottom: 30px;
}

.logo-icon {
    font-size: 3em;
    margin-bottom: 10px;
}

.logo-text {
    font-size: 2.5em;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    font-weight: bold;
}

.tagline {
    text-align: center;
    color: var(--muted-weak);
    margin-bottom: 30px;
    font-style: italic;
}

h1 {
    text-align: center;
    color: var(--text);
    margin-bottom: 16px;
    margin-top: 0;
    font-size: 2em;
}

/* Move analytics heading up slightly and tighten spacing for the analytics page */
#analytics h1 {
    margin-top: 6px;
    margin-bottom: 10px;
}

/* Analytics controls (month picker) */
.analytics-controls {
    display: flex;
    justify-content: flex-start; /* upper-left placement */
    gap: 8px;
    margin-bottom: 6px;
}

.analytics-controls select {
    /* Transparent / themed select matching the dark UI */
    background-color: rgba(0,0,0,0.22);
    background-image: linear-gradient(45deg, transparent 50%, var(--text) 50%), linear-gradient(135deg, var(--text) 50%, transparent 50%);
    background-position: calc(100% - 14px) calc(50% - 4px), calc(100% - 9px) calc(50% - 4px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    color: var(--text);
    border: 1px solid rgba(255,255,255,0.15);
    padding: 12px 40px 12px 14px;
    border-radius: 12px;
    font-weight: 700;
    min-width: 160px;
    box-shadow: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    position: relative;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    transition: all 0.2s ease;
}

.analytics-controls select:hover {
    border-color: rgba(255,255,255,0.25);
    background-color: rgba(0,0,0,0.28);
    background-image: linear-gradient(45deg, transparent 50%, var(--text) 50%), linear-gradient(135deg, var(--text) 50%, transparent 50%);
    background-position: calc(100% - 14px) calc(50% - 4px), calc(100% - 9px) calc(50% - 4px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

.analytics-controls select:focus {
    outline: 3px solid rgba(102,126,234,0.2);
    border-color: rgba(102,126,234,0.4);
    background-color: rgba(0,0,0,0.28);
    background-image: linear-gradient(45deg, transparent 50%, var(--text) 50%), linear-gradient(135deg, var(--text) 50%, transparent 50%);
    background-position: calc(100% - 14px) calc(50% - 4px), calc(100% - 9px) calc(50% - 4px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

/* Custom select (analytics) */
.custom-select {
    position: relative;
    display: inline-block;
    width: auto;
}

.custom-select .custom-select-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background-color: rgba(0,0,0,0.22);
    color: var(--text);
    border: 1px solid rgba(255,255,255,0.12);
    padding: 12px 14px;
    border-radius: 12px;
    min-width: 180px;
    cursor: pointer;
    backdrop-filter: blur(6px);
}

.custom-select .custom-select-caret {
    opacity: 0.95;
    font-size: 0.95rem;
}

.custom-select .custom-select-options {
    display: none;
    position: absolute;
    left: 0;
    top: calc(100% + 8px);
    /* match trigger width and keep compact */
    min-width: 180px;
    max-width: 260px;
    max-height: 200px;
    overflow: auto;
    background: rgba(18,18,24,0.96);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.45);
    padding: 6px 6px;
    list-style: none;
    z-index: 200;
}

.custom-select.open .custom-select-options {
    display: block;
}

.custom-select .custom-option {
    padding: 6px 10px;
    margin: 4px 4px;
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    font-size: 0.55rem;
}

.custom-select .custom-option:hover,
.custom-select .custom-option.focused {
    background: rgba(102,126,234,0.14);
}

/* Custom scrollbar for the options list (Chromium/WebKit) */
.custom-select .custom-select-options::-webkit-scrollbar {
    width: 10px;
}
.custom-select .custom-select-options::-webkit-scrollbar-track {
    background: transparent;
}
.custom-select .custom-select-options::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.12);
    border-radius: 8px;
    border: 2px solid transparent;
}
.custom-select .custom-select-options::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.18);
}

/* Firefox scrollbar */
.custom-select .custom-select-options {
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.12) transparent;
}

/* Native option styling (best-effort; not all browsers support this) */
.analytics-controls select option {
    background: rgba(45, 40, 55, 0.98);
    color: var(--text);
    border-radius: 6px;
    margin: 8px 4px;
    padding: 12px 10px;
    line-height: 1.5;
}

.analytics-controls select option:checked {
    background: rgba(102, 126, 234, 0.3);
    color: var(--text);
}



/* small utility class for hidden labels (accessible) */
.visually-hidden {
    position: absolute !important;
    height: 1px; width: 1px;
    overflow: hidden; clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap; border: 0; padding: 0; margin: -1px;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.card {
    /* darker, slightly more opaque veil so content reads stronger */
    background: rgba(0,0,0,0.22);
    border: 1px solid rgba(0,0,0,0.45);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.22s, box-shadow 0.22s;
    color: var(--text);
}

/* Per-card palettes to better contrast with the blue network background */
.card.link {
    /* darker blue tint */
    background-image: linear-gradient(180deg, rgba(14,166,217,0.22), rgba(4,78,160,0.18));
    background-color: rgba(6,82,207,0.18);
    box-shadow: 0 14px 30px rgba(6,82,207,0.20);
}
.card.link:focus {
    outline-color: rgba(14,166,217,0.28);
}

.card.email {
    /* darker magenta/purple tint */
    background-image: linear-gradient(180deg, rgba(234,123,123,0.22), rgba(127,75,150,0.18));
    background-color: rgba(127,75,150,0.18);
    box-shadow: 0 14px 30px rgba(127,75,150,0.20);
}
.card.email:focus {
    outline-color: rgba(127,75,150,0.28);
}

.card.content {
    /* darker amber tint */
    background-image: linear-gradient(180deg, rgba(239,201,138,0.22), rgba(230,143,107,0.18));
    background-color: rgba(230,143,107,0.18);
    box-shadow: 0 14px 30px rgba(230,143,107,0.18);
    color: var(--text);
}
.card.content:focus {
    outline-color: rgba(230,143,107,0.28);
}

.card:focus {
    outline: 3px solid rgba(255,255,255,0.06);
    transform: translateY(-6px);
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.50);
}

.card-icon {
    font-size: 2.5em;
    margin-bottom: 12px;
}

.card h3 {
    font-size: 1em;
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-weight: 600;
}

input,
textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: #667eea;
}

textarea {
    resize: vertical;
    min-height: 150px;
    font-family: inherit;
}

.char-count {
    text-align: right;
    color: var(--muted-weak);
    font-size: 0.9em;
    margin-top: 5px;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}

button {
    flex: 1;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    min-height: 36px;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    /* Match header/nav button styling (muted indigo) for consistent controls */
    background: linear-gradient(135deg, #4f46e5 0%, #6d28d9 100%);
    color: #ffffff;
    padding: 8px 14px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 15px;
    box-shadow: 0 4px 10px rgba(79,70,229,0.08);
    border: none;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(79,70,229,0.12);
    outline: 3px solid rgba(79,70,229,0.10);
}

.btn-secondary {
    background: linear-gradient(135deg, #c1c0c0 0%, #c1c0c0 100%);
    color: #ffffff;
    padding: 8px 14px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 15px;
    box-shadow: 0 4px 10px rgba(79,70,229,0.08);
    border: none;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(79,70,229,0.12);
    outline: 3px solid rgba(79,70,229,0.10);
}

.btn-cancel {
    background: linear-gradient(135deg, #4f46e5 0%, #6d28d9 100%);
    color: #fff;
    padding: 8px 14px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 15px;
    box-shadow: 0 4px 10px rgba(79,70,229,0.08);
    border: none;
}

.btn-cancel:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(79,70,229,0.12);
    outline: 3px solid rgba(79,70,229,0.10);
}

/* Button accents that mirror the card palettes (use by adding 'link'|'email'|'content' classes to buttons) */
button.link {
    background-image: linear-gradient(rgba(0,0,0,0.08), rgba(0,0,0,0.08)), linear-gradient(135deg, #0ea6d9 0%, #044ea0 100%);
    box-shadow: 0 8px 20px rgba(6,82,207,0.10);
    color: #fff;
}

button.email {
    background-image: linear-gradient(rgba(0,0,0,0.08), rgba(0,0,0,0.08)), linear-gradient(135deg, #ea7b7b 0%, #7f4b96 100%);
    box-shadow: 0 8px 20px rgba(127,75,150,0.10);
    color: #fff;
}

button.content {
    background-image: linear-gradient(rgba(0,0,0,0.08), rgba(0,0,0,0.08)), linear-gradient(135deg, #fefefe 0%, #bab9b9 100%);
    box-shadow: 0 8px 20px rgba(230,143,107,0.08);
    color: #fff;
}

/* Ensure buttons with both the action class and an accent class exactly match the card styles
   (use the same overlay, gradient stops and shadow). This increases specificity so
   .btn-primary.link overrides the generic .btn-primary background. */
.btn-primary.link, .btn-secondary.link, .btn-cancel.link {
    background-image: linear-gradient(rgba(0,0,0,0.12), rgba(0,0,0,0.12)), linear-gradient(135deg, #c1c0c0 0%, #c1c0c0 100%);
    box-shadow: 0 10px 24px rgba(6,82,207,0.12);
    color: #fff;
}

.btn-primary.email, .btn-secondary.email, .btn-cancel.email {
    background-image: linear-gradient(rgba(0,0,0,0.12), rgba(0,0,0,0.12)), linear-gradient(135deg, #c1c0c0 0%, #c1c0c0 100%);
    box-shadow: 0 10px 24px rgba(127,75,150,0.12);
    color: #fff;
}

.btn-primary.content, .btn-secondary.content, .btn-cancel.content {
    background-image: linear-gradient(rgba(0,0,0,0.12), rgba(0,0,0,0.12)), linear-gradient(135deg, #c1c0c0 0%, #c1c0c0 100%);
    box-shadow: 0 10px 24px rgba(230,143,107,0.10);
    color: #fff;
}

/* Header/nav buttons: styled separately so they sit nicely over the hero background */
.site-header nav button {
    background: rgba(255,255,255,0.08);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.06);
    padding: 8px 14px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 15px;
    transition: background 0.15s, transform 0.12s;
}
.site-header nav button:hover,
.site-header nav button:focus {
    background: rgba(255,255,255,0.12);
    transform: translateY(-2px);
    outline: none;
}

/* Responsive: stack header buttons on narrow screens to avoid tiny controls */
@media (max-width: 720px) {
    .site-header nav {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
        justify-content: center;
    }
    .site-header nav button {
        flex: 0 1 auto;
        padding: 8px 12px;
        font-size: 14px;
    }
}

.response {
    margin-top: 20px;
    padding: 20px;
    border-radius: 10px;
    display: none;
    animation: slideIn 0.3s ease;
}

.response.show {
    display: block;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-safe {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.result-spam {
    background: linear-gradient(135deg, #f2994a 0%, #f2c94c 100%);
    color: white;
}

.result-phishing {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    color: white;
}

.result-suspicious {
    background: linear-gradient(135deg, #ff6b6b 0%, #feca57 100%);
    color: white;
}

.result-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
}

.result-icon {
    font-size: 3em;
}

.result-title {
    flex: 1;
}

.result-title h2 {
    font-size: 1.8em;
    margin-bottom: 5px;
}

.result-title p {
    opacity: 0.9;
}

.confidence-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 1.2em;
    font-weight: bold;
}

.result-body {
    padding: 15px 0;
}

/* Loading / spinner */
.loading {
    display: none;
    align-items: center;
    gap: 10px;
    color: #333;
}

.loading.show {
    display: flex;
}

.spinner {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 3px solid rgba(0, 0, 0, 0.08);
    border-top-color: #667eea;
    animation: spin .8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Result info grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.info-card {
    background: rgba(255, 255, 255, 0.08);
    padding: 12px;
    border-radius: 8px;
    color: white;
    text-align: center;
}

.info-card-label {
    font-size: 0.85em;
    opacity: 0.95;
}

.info-card-value {
    font-size: 1.2em;
    font-weight: 700;
    margin-top: 6px;
}

.result-error {
    background: linear-gradient(135deg, #6c757d 0%, #343a40 100%);
    color: white;
}

/* Chart Styles */
#chart {
    width: 100%;
    /* increase chart panel height to give graph more space */
    max-height: 260px;
    height: 220px; /* prefer a taller area so bars render with visible differences */
    margin-top: 6px;
    margin-bottom: 18px;
    padding: 12px;
    background: rgba(0,0,0,0.12);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    /* Match chart line to Total Scans card color */
    --chart-line-color: rgba(14,166,217,0.8);
    --chart-grid-color: rgba(255,255,255,0.06);
    --chart-text-color: var(--text);
}

.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 15px;
}

.stat-card {
    /* Base style for all stat cards */
    background: rgba(0,0,0,0.12);
    border: 1px solid rgba(255,255,255,0.06);
    color: var(--text);
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* Total Scans card (blue) */
.stat-card:nth-child(1) {
    background-image: linear-gradient(180deg, rgba(14,166,217,0.16), rgba(4,78,160,0.10));
    background-color: rgba(6,82,207,0.10);
    box-shadow: 0 12px 26px rgba(6,82,207,0.14);
}

/* Safe Content card (green) */
.stat-card:nth-child(2) {
    background-image: linear-gradient(180deg, rgba(52,211,153,0.16), rgba(16,185,129,0.10));
    background-color: rgba(16,185,129,0.10);
    box-shadow: 0 12px 26px rgba(16,185,129,0.14);
}

/* Threats Detected card (red) */
.stat-card:nth-child(3) {
    background-image: linear-gradient(180deg, rgba(239,68,68,0.16), rgba(220,38,38,0.10));
    background-color: rgba(220,38,38,0.10);
    box-shadow: 0 12px 26px rgba(220,38,38,0.14);
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    margin-bottom: 2px;
    line-height: 1;
}

.stat-label {
    font-size: 0.9em;
    opacity: 0.9;
    line-height: 1.2;
}

/* Footer Styles */
footer {
    text-align: center;
    padding: 18px 12px;
    color: var(--muted-weak);
    background: transparent;
    margin-top: 18px;
}

footer > div {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* API Documentation Styles */
.api-section {
    /* API docs panel made fully transparent to let the background show through */
    background: transparent;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    border-left: 3px solid rgba(102,126,234,0.75);
}

/* API entry layout (repeatable) */
.api-entry {
    padding: 12px 14px;
    margin-bottom: 18px;
    border-radius: 8px;
    background: rgba(0,0,0,0.08);
    border: 1px solid rgba(255,255,255,0.03);
}
.api-entry .api-header {
    display: flex;
    align-items: center;
    gap: 12px;
}
.api-entry .endpoint {
    font-family: 'Courier New', monospace;
    color: var(--muted-weak);
}

/* Collapsible body */
.api-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 260ms ease, opacity 200ms ease;
    opacity: 0;
    margin-top: 8px;
}
.api-entry.expanded .api-body {
    max-height: 1200px; /* large enough for content */
    opacity: 1;
}

/* Make header look interactive */
.api-entry .api-header {
    cursor: pointer;
}
.api-header .caret {
    margin-left: 8px;
    transition: transform 180ms ease;
    color: var(--muted-weak);
    font-size: 0.95em;
}
.api-entry.expanded .caret {
    transform: rotate(180deg);
}

/* Copy button */
.copy-btn {
    margin-left: 8px;
    background: rgba(255,255,255,0.06);
    color: var(--text);
    border: 1px solid rgba(255,255,255,0.06);
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.85em;
}
.copy-btn:hover {
    background: rgba(255,255,255,0.12);
    transform: translateY(-2px);
}

/* Smaller code blocks inside API entries */
.code-block {
    position: relative;
    margin-top: 8px;
    padding: 12px;
    background: rgba(0,0,0,0.06);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.03);
}
.code-block pre {
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--muted-weak) !important;
    margin: 0;
}

/* temporary copied feedback */
.copy-btn.copied {
    background: linear-gradient(135deg,#38ef7d,#11998e);
    color: #04210f;
}

/* ensure API section text (inline styles may have dark color) is readable */
.api-section p,
.api-section .api-description,
.api-section pre {
    color: var(--muted-weak) !important;
}

/* Inputs/textarea should be readable on the dark background */
input,
textarea {
    background: rgba(255,255,255,0.06);
    color: var(--text);
    border: 1px solid rgba(255,255,255,0.12);
}

.api-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.method-badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 0.9em;
}

.method-post {
    background: #28a745;
    color: white;
}

.method-get {
    background: #17a2b8;
    color: white;
}

.endpoint {
    font-family: 'Courier New', monospace;
    background: transparent;
    padding: 8px 12px;
    border-radius: 6px;
    flex: 1;
}