/* SecurityAlert.ai - Shared Design System */

/*
 * ── Z-INDEX STACKING ORDER ──────────────────────────────────────────
 *
 *  -1   Background decorations (hero gradients, bg shapes)
 *   1   Inline hover lifts (heatmap cells, calendar days)
 *   2   Chart overlays, demo overlays
 *  10   Tooltips, sticky sub-headers, floating elements
 *  50   Back-to-top button
 * 100   Navbar (default)
 * 101   Navbar dropdown menus
 * 150   Settings sidebar (mobile)
 * 175   Settings sidebar overlay (mobile)
 * 200   Settings tab bar (sticky)
 * 800   Map overlays (outage-map legend)
 * 900   Map panels (outage-map side panel, mobile drawer)
 * 999   Map floating search
 * 1000  Modals & overlays (brand, cert, dashboard, settings, alerts)
 * 1100  Nested modals (cert detail modal, map mobile filters)
 * 2000  Toast notifications
 * 9999  Temporary progress overlays
 * 10000 Skip-to-content link (accessibility, topmost)
 *
 * Rules:
 *  - Page-local z-index (1–10) can be used freely within components
 *  - Global overlays must use 1000+
 *  - Toasts must float above modals (2000)
 *  - Never exceed 10000 (reserved for skip link)
 */

/* Utility: hidden */
.hidden { display: none !important; }

/* Utility: table-responsive — wraps tables for horizontal scroll on small screens */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Breadcrumb Navigation */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 0;
    font-size: 0.8rem;
    color: var(--text-tertiary);
    list-style: none;
    margin: 0;
}
.breadcrumb a { color: var(--text-tertiary); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb-sep { font-size: 0.7rem; opacity: 0.5; }
.breadcrumb-current { color: var(--text-secondary); font-weight: 500; }

/* Skip Link (accessibility) */
.skip-link {
    position: absolute;
    top: -100px;
    left: 16px;
    background: var(--accent);
    color: #fff;
    padding: 8px 16px;
    border-radius: 0 0 8px 8px;
    z-index: 10000;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: top 0.2s ease;
}
.skip-link:focus {
    top: 0;
}

/* Focus Visible (keyboard accessibility) */
:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}
/* Don't show focus ring on mouse clicks */
:focus:not(:focus-visible) {
    outline: none;
}

/* Screen Reader Only (visible to assistive tech, hidden visually) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Global slim dark scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.18);
}
[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.12);
}
[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}
/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}
[data-theme="light"] * {
    scrollbar-color: rgba(0, 0, 0, 0.12) transparent;
}

/* Typography & Layout */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 0;
    line-height: 1.6;
    font-size: 15px;
    letter-spacing: -0.011em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

@supports (font-variation-settings: normal) {
    body {
        font-family: 'Inter var', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    }
}

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

/* Heading Scale */
h1, .h1 { font-size: 2.25rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.025em; }
h2, .h2 { font-size: 1.75rem; font-weight: 700; line-height: 1.25; letter-spacing: -0.02em; }
h3, .h3 { font-size: 1.375rem; font-weight: 600; line-height: 1.3; letter-spacing: -0.015em; }
h4, .h4 { font-size: 1.125rem; font-weight: 600; line-height: 1.35; }
h5, .h5 { font-size: 0.9375rem; font-weight: 600; line-height: 1.4; }
h6, .h6 { font-size: 0.8125rem; font-weight: 600; line-height: 1.4; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-tertiary); }

/* Responsive Typography */
@media (max-width: 768px) {
    h1, .h1 { font-size: 1.75rem; }
    h2, .h2 { font-size: 1.375rem; }
    h3, .h3 { font-size: 1.125rem; }
}

@media (max-width: 480px) {
    h1, .h1 { font-size: 1.5rem; }
    h2, .h2 { font-size: 1.25rem; }
}

/* Accessibility: Focus indicators for keyboard navigation */
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Mobile touch targets (WCAG 2.5.8: min 44x44px) */
@media (max-width: 768px) {
    button, a.btn, .nav-link, .filter-tab, .nav-dropdown-item, .category-btn {
        min-height: 44px;
        min-width: 44px;
    }
    .nav-dropdown-item {
        padding-top: 12px;
        padding-bottom: 12px;
    }
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
    text-decoration: none;
    border: none;
    font-family: inherit;
    line-height: 1.4;
}

.btn-ghost {
    background: transparent;
    border: none;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.btn-primary {
    background: var(--accent);
    border: 1px solid transparent;
    color: white;
    font-weight: 500;
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3), 0 1px 3px rgba(59, 130, 246, 0.2);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.02);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04);
}
[data-theme="light"] .btn-secondary:hover {
    border-color: rgba(0, 0, 0, 0.15);
    background: rgba(0, 0, 0, 0.02);
}

.btn:active {
    transform: scale(0.98);
    transition-duration: 50ms;
}

.btn:disabled, .btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 0.6875rem;
    gap: 4px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 10px 22px;
    font-size: 0.9375rem;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success { background: rgba(16, 185, 129, 0.12); color: #10B981; }
.badge-warning { background: rgba(245, 158, 11, 0.12); color: #F59E0B; }
.badge-error { background: rgba(239, 68, 68, 0.12); color: #EF4444; }
.badge-info { background: rgba(59, 130, 246, 0.12); color: var(--accent); }

/* Modal Close Button */
.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: 6px;
    font-size: 18px;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.modal-close:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.875rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-subtle);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-tertiary);
}

/* Loading States */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.spinner {
    border: 3px solid var(--bg-tertiary);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error Messages */
.error-message {
    background: rgba(229, 72, 77, 0.08);
    border: 1px solid rgba(229, 72, 77, 0.2);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    margin-top: 12px;
    font-size: 0.8125rem;
    color: var(--error-text);
}

/* Marketing Page Shared Styles */
.hero {
    text-align: center;
    padding: 72px 0 56px;
    max-width: 900px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 2.75rem;
    font-weight: 650;
    letter-spacing: -0.035em;
    margin-bottom: 20px;
    line-height: 1.08;
}

.hero .subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 36px;
    line-height: 1.65;
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
    font-weight: 400;
}

.hero-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.section {
    padding: var(--space-3xl) 0;
}

.section-alt {
    background: var(--bg-secondary);
}

.section-header {
    text-align: center;
    margin-bottom: var(--space-2xl);
}

.section-header h2 {
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    margin-bottom: 12px;
}

.section-header p {
    font-size: 1.0625rem;
    color: var(--text-secondary);
    max-width: 580px;
    margin: 0 auto;
    line-height: 1.6;
}

.cta-section {
    text-align: center;
    padding: 72px 0;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.04) 0%, transparent 100%);
    border-top: 1px solid var(--border-color);
}

.cta-section h2 {
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
}

.cta-section p {
    color: var(--text-secondary);
    margin-bottom: 28px;
    font-size: 1.0625rem;
}

.cta-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Focus States */
.btn:focus,
.nav-link:focus,
.nav-dropdown-item:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Accessibility */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Responsive - Shared */
@media (max-width: 768px) {
    .btn {
        padding: 6px 12px;
        font-size: 0.8125rem;
    }

    .hero {
        padding: 48px 0 40px;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero .subtitle {
        font-size: 1rem;
    }

    .section {
        padding: var(--space-2xl) 0;
    }

    .section-header h2 {
        font-size: 1.5rem;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }

    .btn-lg {
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }

    .cta-buttons {
        flex-direction: column;
        align-items: center;
    }
}

/* Category Dropdown */
.category-dropdown {
    padding: 8px 32px 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: border-color 0.15s;
}

.category-dropdown:hover,
.category-dropdown:focus {
    border-color: var(--accent);
    outline: none;
}

.directory-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 24px;
}

.directory-controls .directory-search {
    flex: 1;
}

/* Skeleton Loading Animation */
@keyframes skeleton-pulse {
    0% { opacity: 0.6; }
    50% { opacity: 0.3; }
    100% { opacity: 0.6; }
}

.skeleton {
    background: var(--bg-tertiary);
    border-radius: 6px;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
    width: 80%;
}

.skeleton-card {
    height: 120px;
    border-radius: 12px;
}

/* Search no-results message */
.no-results-message {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-tertiary);
    font-size: 0.9375rem;
}

.no-results-message svg {
    display: block;
    margin: 0 auto 12px;
    opacity: 0.5;
}

/* Share buttons (reusable) */
.share-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}
.share-label {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
}
.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}
.share-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--text-tertiary);
}
.share-btn:active {
    transform: scale(0.95);
}

/* Dashboard empty state */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    max-width: 480px;
    margin: 0 auto;
}

.empty-state-icon {
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-bottom: 24px;
    line-height: 1.6;
}

/* Auth error banner */
.auth-error-banner {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--error-text);
    font-size: 0.875rem;
    text-align: center;
    margin: 16px 24px;
    display: none;
}

.auth-error-banner a {
    color: var(--accent-light);
    text-decoration: underline;
}

/* Incident AI Summary block */
.incident-ai-summary {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 32px;
}

.incident-ai-summary-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    margin-bottom: 8px;
    padding-bottom: 8px;
    position: relative;
}

.incident-ai-summary-label::after {
    content: '';
    display: block;
    width: 32px;
    height: 2px;
    background: var(--accent);
    margin-top: 8px;
    opacity: 0.6;
}

.incident-ai-summary p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.65;
    margin: 0;
}

/* Tool page "Why use this?" intro */
.tool-why {
    color: var(--text-tertiary);
    font-size: 0.875rem;
    line-height: 1.6;
    max-width: 560px;
    margin: 8px auto 0;
}

/* ── Print Stylesheet ─────────────────────────────────────────────── */
@media print {
    /* Hide non-content elements */
    .nav, .footer, .skip-link,
    .mobile-menu, .mobile-menu-toggle,
    .back-to-top, .btn, button,
    .user-menu, .nav-auth-btn,
    .tool-seo, .cta-buttons,
    .features-cta, .pricing-cta {
        display: none !important;
    }

    /* Reset backgrounds and colors for ink savings */
    body {
        background: #fff !important;
        color: #111 !important;
        font-size: 11pt;
    }

    *, *::before, *::after {
        background: transparent !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    /* Preserve status colors */
    .check-icon { color: #059669 !important; }
    .dash-icon { color: #999 !important; }

    /* Full-width layout */
    .container {
        max-width: 100% !important;
        padding: 0 !important;
    }

    /* Show link URLs */
    a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
        word-break: break-all;
    }
    a[href^="/"]::after,
    .nav a::after,
    .footer a::after {
        content: none;
    }

    /* Avoid breaks inside cards/rows */
    .pricing-card, .finding-row, .cert-row,
    .comparison-table tr, .monitor-demo-row {
        break-inside: avoid;
    }

    /* Tables: keep header visible */
    thead { display: table-header-group; }
}
