/* styles.css - Complete stylesheet for Comores Open Data with Recommended Font Sizes */

/* Import Inter font from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #009639;
    --secondary: #FFD700;
    --dark: #1a1a1a;
    --light: #f8f9fa;
    --white: #ffffff;
    --shadow: rgba(0, 0, 0, 0.1);
    --border: #e0e0e0;
}

/* Prevent white flash on page load */
html {
    background-color: var(--light);
    font-size: 16px;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background: var(--light);
    margin: 0;
    padding: 0;
    font-size: 17px; /* Recommended: 17px */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Header - No opacity transition to prevent white flash */
#header {
    min-height: 80px;
    background: linear-gradient(135deg, var(--primary) 0%, #007a2d 100%);
    position: relative;
    z-index: 1000;
    margin: 0;
}

#header .header {
    position: relative;
    z-index: 1000;
}

.header {
    background: linear-gradient(135deg, var(--primary) 0%, #007a2d 100%);
    color: var(--white);
    padding: 1rem 0;
    box-shadow: 0 2px 10px var(--shadow);
    margin: 0;
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.flag {
    font-size: 2rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
    align-items: center;
}

.nav-links a {
    color: var(--white);
    text-decoration: none;
    transition: opacity 0.3s;
    font-weight: 500;
    font-size: 16px; /* Recommended: 16px */
}

.nav-links a:hover {
    opacity: 0.8;
}

/* Language Flag Buttons */
.lang-flags {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.flag-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.4rem 0.6rem;
    transition: all 0.3s ease;
    opacity: 0.6;
}

.flag-btn:hover {
    opacity: 0.9;
}

.flag-btn.active {
    font-size: 1.1rem;
    font-weight: bold;
    opacity: 1;
    transform: scale(1.2);
}

.lang-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid var(--white);
    color: var(--white);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.lang-toggle:hover {
    background: var(--white);
    color: var(--primary);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, rgba(0, 150, 57, 0.95), rgba(0, 122, 45, 0.95)),
                url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 600"><rect fill="%23009639" width="1200" height="600"/><circle cx="200" cy="150" r="100" fill="%23FFD700" opacity="0.1"/><circle cx="800" cy="400" r="150" fill="%23FFD700" opacity="0.1"/><circle cx="1000" cy="200" r="80" fill="%23FFD700" opacity="0.1"/></svg>');
    background-size: cover;
    background-position: center;
    color: var(--white);
    padding: 5rem 0;
    text-align: center;
    margin: 0;
}

.hero h1 {
    font-size: 46px; /* Recommended: 46px */
    margin-bottom: 1rem;
    font-weight: 700;
    line-height: 1.2;
}

.hero p {
    font-size: 20px; /* Recommended: 20px */
    margin-bottom: 2rem;
    opacity: 0.95;
    line-height: 1.6;
}

.search-box {
    max-width: 600px;
    margin: 2rem auto;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 1rem 3rem 1rem 1.5rem;
    border: none;
    border-radius: 50px;
    font-size: 16px; /* Recommended: 16px */
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    font-family: inherit;
}

.search-box button {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 0.7rem 2rem;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    font-size: 16px; /* Recommended: 16px */
    transition: background 0.3s;
}

.search-box button:hover {
    background: #007a2d;
}

/* Stats Section */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin: 3rem 0;
}

.stat-card {
    background: var(--white);
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 5px 15px var(--shadow);
    transition: transform 0.3s;
    cursor: pointer;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.stat-label {
    color: #666;
    font-size: 16px; /* Recommended: 16px */
}

/* Section Styles */
.section {
    padding: 4rem 0;
    background-color: var(--light);
    margin: 0;
}

.section-title {
    text-align: center;
    font-size: 34px; /* Recommended: 34px */
    margin-bottom: 3rem;
    color: var(--dark);
    font-weight: 700;
}

/* Categories Section */
.categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.category-card {
    background: var(--white);
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 3px 10px var(--shadow);
}

.category-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 30px var(--shadow);
}

.category-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.category-card h3 {
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-size: 19px; /* Recommended: 19px */
    font-weight: 600;
}

.category-count {
    color: #666;
    font-size: 16px; /* Recommended: 16px */
}

/* Datasets Section */
.datasets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.dataset-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 3px 10px var(--shadow);
    transition: all 0.3s;
}

.dataset-card:hover {
    box-shadow: 0 10px 30px var(--shadow);
}

.dataset-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.dataset-title {
    color: var(--primary);
    font-weight: 600;
    font-size: 19px; /* Recommended: 19px */
}

.dataset-format {
    background: var(--primary);
    color: var(--white);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.dataset-meta {
    color: #666;
    font-size: 16px; /* Recommended: 16px */
    margin-bottom: 1rem;
}

.dataset-desc {
    color: var(--dark);
    margin-bottom: 1rem;
    line-height: 1.6;
    font-size: 16px; /* Recommended: 16px */
}

.download-btn {
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 0.7rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    font-size: 16px; /* Recommended: 16px */
    transition: background 0.3s;
    width: 100%;
}

.download-btn:hover {
    background: #007a2d;
}

/* Footer Styles */
#footer {
    margin: 0;
}

.footer {
    background: var(--dark);
    color: var(--white);
    padding: 3rem 0 1rem;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    margin-bottom: 1rem;
    color: var(--secondary);
    font-size: 19px; /* Recommended: 19px */
    font-weight: 600;
}

.footer-section ul {
    list-style: none;
}

.footer-section a {
    color: #ccc;
    text-decoration: none;
    display: block;
    padding: 0.3rem 0;
    font-size: 16px; /* Recommended: 16px */
    transition: color 0.3s;
}

.footer-section a:hover {
    color: var(--secondary);
}

.admin-footer-link {
    margin-top: 1rem;
    padding-top: 0.8rem;
    border-top: 1px solid #444;
}

.admin-footer-link .admin-link {
    color: #999;
    font-size: 15px;
    opacity: 0.8;
    transition: all 0.3s;
}

.admin-footer-link .admin-link:hover {
    color: var(--primary);
    opacity: 1;
}

.admin-footer-link svg {
    stroke: #999;
    transition: stroke 0.3s;
}

.admin-footer-link .admin-link:hover svg {
    stroke: var(--primary);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #444;
    color: #999;
    font-size: 16px; /* Recommended: 16px */
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        font-size: 16px;
    }

    .hero h1 {
        font-size: 32px;
    }
    
    .hero p {
        font-size: 18px;
    }
    
    .nav-links {
        flex-direction: column;
        gap: 1rem;
    }
    
    .container {
        padding: 0 1rem;
    }

    .section-title {
        font-size: 28px;
    }
}

/* ============================================
   BACK TO TOP BUTTON
   ============================================ */
#backToTop {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    z-index: 999;
}

#backToTop:hover {
    background: #007a2d;
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}

#backToTop.show {
    display: flex;
    animation: fadeInUp 0.3s ease;
}

@media (max-width: 768px) {
    #backToTop {
        width: 45px;
        height: 45px;
        bottom: 20px;
        right: 20px;
        font-size: 20px;
    }
}

/* Loading Overlay - Global */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.loading-overlay.hidden {
    display: none;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid #f3f3f3;
    border-top: 6px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-overlay p {
    margin-top: 1.5rem;
    font-size: 1.1rem;
    color: var(--primary);
    font-weight: 600;
    letter-spacing: 0.5px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.loading-overlay {
    animation: fadeIn 0.2s ease-in;
}