/* NGI Navigator - Main Styles */

/* =====================================================
   CSS Variables
   ===================================================== */
:root {
    --primary: #003399;
    --primary-dark: #002266;
    --primary-light: #0044cc;
    --secondary: #64748b;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --bg: #f8fafc;
    --bg-alt: #f1f5f9;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --border-dark: #cbd5e1;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
}

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

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* =====================================================
   Header
   ===================================================== */
header {
    background: linear-gradient(
        41deg,
        rgba(32, 83, 116, 1) 0%,
        rgba(31, 86, 118, 1) 74%,
        rgba(0, 178, 191, 1) 100%
    );
    color: white;
    padding: 1rem 2rem;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.logo-link {
    text-decoration: none;
    color: white;
}

.logo-link:hover {
    opacity: 0.9;
}

header nav {
    display: flex;
    gap: 0.5rem;
}

header nav a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

header nav a:hover,
header nav a.active {
    color: white;
    background: rgba(255, 255, 255, 0.15);
}

/* =====================================================
   Header Auth / Login
   ===================================================== */
.header-auth {
    margin-left: 1rem;
}

.btn-login {
    padding: 0.5rem 1.25rem;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius);
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-login:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
}

.user-menu {
    position: relative;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius);
    color: white;
    cursor: pointer;
    transition: all 0.15s ease;
}

.user-menu-trigger:hover {
    background: rgba(255, 255, 255, 0.2);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 500;
}

.chevron {
    transition: transform 0.2s ease;
}

.chevron.rotate {
    transform: rotate(180deg);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 180px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem 0;
    z-index: 1000;
}

.dropdown-item {
    display: block;
    padding: 0.625rem 1rem;
    color: var(--text);
    text-decoration: none;
    font-size: 0.875rem;
    transition: background 0.15s ease;
}

.dropdown-item:hover {
    background: var(--bg-alt);
}

.dropdown-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 0.5rem 0;
}

/* =====================================================
   Main Content
   ===================================================== */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
}

/* =====================================================
   Cards
   ===================================================== */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

/* =====================================================
   Breadcrumb
   ===================================================== */
.breadcrumb {
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    color: var(--text-muted);
}

.breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s;
}

.breadcrumb a:hover {
    color: var(--primary);
}

.breadcrumb .separator {
    margin: 0 0.5rem;
    color: var(--text-light);
}

.breadcrumb .current {
    color: var(--text);
}

/* =====================================================
   Page Header
   ===================================================== */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 1.125rem;
}

/* =====================================================
   Filters Panel
   ===================================================== */
.filters-panel {
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.filter-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-group input,
.filter-group select {
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    background: white;
    color: var(--text);
    transition: all 0.15s ease;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.filter-group input::placeholder {
    color: var(--text-light);
}

/* =====================================================
   Toggle Switches
   ===================================================== */
.toggle-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
    margin-top: 1rem;
}

.toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.toggle input {
    display: none;
}

.toggle-switch {
    width: 36px;
    height: 20px;
    background: var(--border-dark);
    border-radius: 10px;
    position: relative;
    transition: background 0.2s ease;
}

.toggle-switch::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.toggle input:checked + .toggle-switch {
    background: var(--primary);
}

.toggle input:checked + .toggle-switch::after {
    transform: translateX(16px);
}

.toggle-label {
    font-size: 0.875rem;
    color: var(--text);
}

/* =====================================================
   Buttons
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

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

.btn-secondary:hover {
    background: var(--border);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}

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

.btn-lg {
    padding: 0.875rem 2rem;
    font-size: 1rem;
}

/* =====================================================
   Results Header
   ===================================================== */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0 0.25rem;
}

.results-count {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.results-count strong {
    color: var(--text);
    font-weight: 600;
}

/* =====================================================
   Project Grid
   ===================================================== */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1rem;
}

.project-card {
    padding: 1.25rem;
    transition: all 0.2s ease;
}

.project-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.project-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.project-card h3 a {
    color: var(--text);
    text-decoration: none;
    transition: color 0.15s ease;
}

.project-card h3 a:hover {
    color: var(--primary);
}

.project-card .meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 0.75rem;
}

.project-card .content {
    font-size: 0.875rem;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.6;
}

/* =====================================================
   Tags
   ===================================================== */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.tag-type { background: #ede9fe; color: #6d28d9; }
.tag-status { background: #e0f2fe; color: #0369a1; }
.tag-category { background: #dcfce7; color: #15803d; }
.tag-country { background: #fef3c7; color: #b45309; }
.tag-active { background: #d1fae5; color: #047857; }
.tag-inactive { background: #fee2e2; color: #b91c1c; }
.tag-oss { background: #dbeafe; color: #1d4ed8; }
.tag-maintained { background: #fef3c7; color: #b45309; }
.tag-abandoned { background: #f3f4f6; color: #6b7280; }

/* Clickable tags */
a.tag {
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

a.tag:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    filter: brightness(0.95);
}

/* =====================================================
   Loading & Empty States
   ===================================================== */
.loading {
    display: flex;
    justify-content: center;
    padding: 3rem;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state h3 {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

/* =====================================================
   Load More
   ===================================================== */
.load-more {
    display: flex;
    justify-content: center;
    padding: 2rem;
}

.btn-load-more {
    padding: 0.75rem 2rem;
}

/* =====================================================
   Product Card
   ===================================================== */
.product-card .product-links {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 1rem;
}

.product-card .product-links a {
    font-size: 0.8125rem;
    color: var(--primary);
    text-decoration: none;
}

.product-card .product-links a:hover {
    text-decoration: underline;
}

/* =====================================================
   Footer
   ===================================================== */
.site-footer {
    background: var(--bg-alt);
    border-top: 1px solid var(--border);
    margin-top: 3rem;
    padding: 0;
}

.footer-content {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2.5rem 2rem;
}

.footer-main {
    display: flex;
    justify-content: space-between;
    gap: 3rem;
    margin-bottom: 2rem;
}

.footer-brand {
    max-width: 400px;
}

.footer-brand strong {
    font-size: 1.125rem;
    color: var(--text);
}

.footer-brand p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    line-height: 1.6;
}

.footer-links {
    display: flex;
    gap: 4rem;
}

.footer-section h4 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text);
    margin-bottom: 0.75rem;
}

.footer-section a {
    display: block;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    padding: 0.25rem 0;
    transition: color 0.15s;
}

.footer-section a:hover {
    color: var(--primary);
}

.footer-bottom {
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    text-align: center;
}

.footer-bottom p {
    color: var(--text-light);
    font-size: 0.8125rem;
}

/* =====================================================
   Responsive
   ===================================================== */
@media (max-width: 768px) {
    header {
        padding: 1rem;
    }

    .header-content {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    header nav {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .header-auth {
        margin-left: auto;
    }

    main {
        padding: 1rem;
    }

    .filters-grid {
        grid-template-columns: 1fr;
    }

    .project-grid {
        grid-template-columns: 1fr;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .footer-main {
        flex-direction: column;
        gap: 2rem;
    }

    .footer-links {
        gap: 2rem;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }
}
