/* ═══════════════════════════════════════════════════
   Conformitify — Global Accreditation Intelligence
   Style v3 · Dark Glassmorphism Design System
   ═══════════════════════════════════════════════════ */

/* ── Variables ────────────────────────────────────── */
:root {
    /* Dark palette */
    --bg-primary:    #0a0e17;
    --bg-secondary:  #111827;
    --bg-card:       rgba(17, 24, 39, 0.7);
    --bg-glass:      rgba(255, 255, 255, 0.04);
    --bg-glass-hover:rgba(255, 255, 255, 0.08);

    --text-primary:  #f1f5f9;
    --text-secondary:#94a3b8;
    --text-muted:    #64748b;

    --accent:        #6366f1;
    --accent-glow:   rgba(99, 102, 241, 0.25);
    --accent-light:  #818cf8;
    --green:         #22c55e;
    --green-glow:    rgba(34, 197, 94, 0.15);
    --amber:         #f59e0b;
    --red:           #ef4444;
    --cyan:          #06b6d4;

    --border:        rgba(255, 255, 255, 0.06);
    --border-hover:  rgba(255, 255, 255, 0.12);

    --radius-sm:     8px;
    --radius-md:     12px;
    --radius-lg:     20px;
    --radius-xl:     28px;

    --font:          'Inter', -apple-system, sans-serif;
    --mono:          'JetBrains Mono', monospace;

    --shadow-sm:     0 2px 8px rgba(0,0,0,0.2);
    --shadow-md:     0 8px 32px rgba(0,0,0,0.3);
    --shadow-lg:     0 16px 48px rgba(0,0,0,0.4);
    --glow:          0 0 30px var(--accent-glow);
}

/* Light theme */
:root.light {
    --bg-primary:    #f8fafc;
    --bg-secondary:  #ffffff;
    --bg-card:       rgba(255, 255, 255, 0.85);
    --bg-glass:      rgba(0, 0, 0, 0.02);
    --bg-glass-hover:rgba(0, 0, 0, 0.04);

    --text-primary:  #0f172a;
    --text-secondary:#475569;
    --text-muted:    #94a3b8;

    --border:        rgba(0, 0, 0, 0.06);
    --border-hover:  rgba(0, 0, 0, 0.12);

    --shadow-sm:     0 2px 8px rgba(0,0,0,0.06);
    --shadow-md:     0 8px 32px rgba(0,0,0,0.08);
    --shadow-lg:     0 16px 48px rgba(0,0,0,0.1);
}

/* ── Reset ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── Ambient Background ───────────────────────────── */
.ambient-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.4;
    animation: orbFloat 20s ease-in-out infinite;
}

.orb-1 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, var(--accent), transparent 70%);
    top: -10%; left: -5%;
    animation-duration: 25s;
}

.orb-2 {
    width: 400px; height: 400px;
    background: radial-gradient(circle, var(--cyan), transparent 70%);
    top: 40%; right: -10%;
    animation-duration: 30s;
    animation-delay: -5s;
}

.orb-3 {
    width: 350px; height: 350px;
    background: radial-gradient(circle, var(--green), transparent 70%);
    bottom: -5%; left: 30%;
    animation-duration: 22s;
    animation-delay: -10s;
    opacity: 0.25;
}

:root.light .orb { opacity: 0.15; }

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -50px) scale(1.05); }
    50% { transform: translate(-20px, 30px) scale(0.95); }
    75% { transform: translate(40px, 20px) scale(1.02); }
}

/* ── Navbar ───────────────────────────────────────── */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    background: rgba(10, 14, 23, 0.6);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border);
    transition: all 0.3s ease;
}

:root.light .navbar { background: rgba(255,255,255,0.7); }

.navbar.scrolled {
    background: rgba(10, 14, 23, 0.85);
    box-shadow: var(--shadow-md);
}

.nav-inner {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -0.3px;
}

.brand-icon {
    width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent), var(--cyan));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.9rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 24px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover { color: var(--text-primary); }

.theme-toggle {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    width: 36px; height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.theme-toggle:hover {
    background: var(--bg-glass-hover);
    color: var(--amber);
}

/* ── Hero ─────────────────────────────────────────── */
.hero {
    min-height: 75vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 120px 24px 60px;
    text-align: center;
}

.hero-content {
    max-width: 740px;
    width: 100%;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 28px;
    animation: fadeInUp 0.6s ease;
}

.hero-badge i { color: var(--amber); font-size: 0.7rem; }

.hero-title {
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -1.5px;
    margin-bottom: 18px;
    animation: fadeInUp 0.6s ease 0.1s backwards;
}

.gradient-text {
    background: linear-gradient(135deg, var(--accent-light), var(--cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 520px;
    margin: 0 auto 36px;
    line-height: 1.7;
    animation: fadeInUp 0.6s ease 0.2s backwards;
}

.hero-subtitle strong { color: var(--text-primary); }

/* ── Search Container ─────────────────────────────── */
.search-container {
    position: relative;
    max-width: 640px;
    margin: 0 auto;
    animation: fadeInUp 0.6s ease 0.3s backwards;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 6px 4px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(16px);
    transition: all 0.3s ease;
    height: 56px;
}

.search-box:focus-within {
    border-color: var(--accent);
    box-shadow: var(--glow);
}

.search-icon {
    color: var(--text-muted);
    font-size: 0.9rem;
    flex-shrink: 0;
}

#searchInput {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: var(--font);
}

#searchInput::placeholder { color: var(--text-muted); }

.search-kbd {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--mono);
    flex-shrink: 0;
    pointer-events: none;
}

/* Suggestions dropdown */
.suggestions-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0; right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 320px;
    overflow-y: auto;
    display: none;
    z-index: 50;
    backdrop-filter: blur(20px);
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--border);
}

.suggestion-item:last-child { border-bottom: none; }

.suggestion-item:hover { background: var(--bg-glass-hover); }

.suggestion-icon {
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    background: var(--accent-glow);
    color: var(--accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.suggestion-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.suggestion-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--mono);
}

/* Quick filters */
.quick-filters {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    animation: fadeInUp 0.6s ease 0.4s backwards;
    flex-wrap: wrap;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: 100px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font);
}

.filter-chip:hover {
    background: var(--bg-glass-hover);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.filter-chip.active {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--accent-light);
}

.flag-dot {
    width: 14px; height: 14px;
    border-radius: 50%;
    display: inline-block;
}

.flag-tr { background: linear-gradient(180deg, #e30a17 50%, #fff 50%); }
.flag-us { background: linear-gradient(180deg, #3c3b6e 40%, #fff 40%, #fff 50%, #b22234 50%); }

/* ── Stats ────────────────────────────────────────── */
.stats-section {
    padding: 40px 24px 80px;
    max-width: 1000px;
    margin: 0 auto;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    backdrop-filter: blur(12px);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 44px; height: 44px;
    border-radius: var(--radius-sm);
    background: var(--accent-glow);
    color: var(--accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    font-size: 1rem;
}

.stat-icon.active { background: var(--green-glow); color: var(--green); }
.stat-icon.cities { background: rgba(245, 158, 11, 0.15); color: var(--amber); }
.stat-icon.sources { background: rgba(6, 182, 212, 0.15); color: var(--cyan); }

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 4px;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ── Results ──────────────────────────────────────── */
.results-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px 80px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.results-title {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.results-title span {
    color: var(--accent-light);
}

.results-query {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-left: 12px;
}

.clear-btn {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    padding: 8px 16px;
    font-size: 0.8rem;
    cursor: pointer;
    font-family: var(--font);
    transition: all 0.2s;
}

.clear-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--red);
    color: var(--red);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 16px;
}

/* Result card */
.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    cursor: pointer;
    transition: all 0.25s ease;
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    animation: fadeInUp 0.4s ease backwards;
}

.result-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    box-shadow: var(--glow);
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
}

.card-badges {
    display: flex;
    gap: 6px;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.badge-source {
    background: var(--accent-glow);
    color: var(--accent-light);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.badge-active {
    background: var(--green-glow);
    color: var(--green);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-passive {
    background: rgba(239, 68, 68, 0.1);
    color: var(--red);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.card-code {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--mono);
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-location {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.card-location i { font-size: 0.7rem; color: var(--accent-light); }

.card-scope-preview {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.6;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 16px;
    border-left: 2px solid var(--border);
    padding-left: 12px;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.card-date {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--mono);
}

.card-action {
    font-size: 0.8rem;
    color: var(--accent-light);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-action i { font-size: 0.7rem; transition: transform 0.2s; }
.result-card:hover .card-action i { transform: translateX(3px); }

/* Loading spinner */
.loading-spinner {
    text-align: center;
    padding: 60px 0;
}

.loading-spinner i {
    font-size: 2rem;
    color: var(--accent-light);
    animation: spin 1s linear infinite;
}

.loading-text {
    margin-top: 12px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

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

/* ── Modal ────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.visible {
    display: flex;
    opacity: 1;
}

.modal-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    max-width: 860px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 0;
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { transform: translateY(20px) scale(0.97); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-close {
    position: absolute;
    top: 16px; right: 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    width: 36px; height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--red);
}

.modal-header-section {
    padding: 32px 32px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-badges {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.modal-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 14px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.modal-badge.source {
    background: var(--accent-glow);
    color: var(--accent-light);
}

.modal-badge.status.active-status {
    background: var(--green-glow);
    color: var(--green);
}

.modal-badge.status.passive-status {
    background: rgba(239, 68, 68, 0.1);
    color: var(--red);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

.modal-code {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: var(--mono);
}

.modal-body-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 0;
}

.modal-scope-section {
    padding: 24px 32px;
    border-right: 1px solid var(--border);
}

.modal-contact-section {
    padding: 24px 32px;
}

.modal-section-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-section-title i { color: var(--accent-light); font-size: 0.85rem; }

.scope-content {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    max-height: 280px;
    overflow-y: auto;
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--text-secondary);
    white-space: pre-wrap;
    font-family: var(--mono);
    font-size: 0.8rem;
}

.scope-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 30px 0;
}

.scope-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    color: var(--accent-light);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

.scope-link:hover { color: var(--text-primary); }

.contact-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.contact-list li {
    display: flex;
    gap: 12px;
}

.contact-list li > i {
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    background: var(--bg-glass);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-light);
    font-size: 0.8rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.contact-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    display: block;
    margin-bottom: 2px;
}

.contact-value {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    display: block;
    word-break: break-all;
}

.contact-sub {
    font-size: 0.78rem;
    color: var(--text-secondary);
    display: block;
    margin-top: 2px;
}

.contact-link {
    text-decoration: none;
    color: var(--accent-light) !important;
    transition: color 0.2s;
}

.contact-link:hover { color: var(--text-primary) !important; }

/* ── Footer ───────────────────────────────────────── */
.footer {
    padding: 24px;
    text-align: center;
    border-top: 1px solid var(--border);
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.footer-dot { margin: 0 8px; opacity: 0.4; }

/* ── Animations ───────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 768px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .results-grid { grid-template-columns: 1fr; }
    .modal-body-grid { grid-template-columns: 1fr; }
    .modal-scope-section { border-right: none; border-bottom: 1px solid var(--border); }
    .hero-title { font-size: 2rem; }
    .search-kbd { display: none; }
    .nav-links { gap: 12px; }
    .footer-dot { display: none; }
    .footer-inner { display: flex; flex-direction: column; gap: 4px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 16px; }
    .stat-value { font-size: 1.5rem; }
    .hero { padding: 100px 16px 40px; }
}

/* ── Scrollbar ────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
