/* ================================
   Chat247 Community Forum Styles
   Costa Rica Flag Colors Theme
   Red: #CE1126
   White: #FFFFFF
   Blue: #002B7F
   Gold: #FFD700
   ================================ */

:root {
    --cr-red: #CE1126;
    --cr-red-light: #E63946;
    --cr-blue: #002B7F;
    --cr-blue-light: #1E5BA8;
    --cr-white: #FFFFFF;
    --cr-gold: #FFD700;
    --cr-gold-dark: #DAA520;
    
    --text-dark: #1a1a1a;
    --text-light: #4a4a4a;
    --text-muted: #6a6a6a;
    --bg-light: #FFF8F0;
    --bg-cream: #FFF5E6;
    --bg-white: #FFFFFF;
    --border-light: rgba(206, 17, 38, 0.1);
    --shadow: 0 20px 60px rgba(206, 17, 38, 0.15);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --radius-sm: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-dark);
    overflow-x: hidden;
    background: var(--bg-light);
    line-height: 1.6;
}

/* ================================
   NAVIGATION
   ================================ */

.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    z-index: 1000;
    padding: 1.2rem 0;
    border-bottom: 1px solid var(--border-light);
    transition: all 0.3s ease;
}

.navbar.scrolled {
    padding: 0.8rem 0;
    box-shadow: var(--shadow-sm);
    background: rgba(255, 255, 255, 0.98);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.logo {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--cr-red), var(--cr-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    transition: transform 0.3s ease;
    z-index: 1001;
}

.logo:hover {
    transform: scale(1.05);
}

.logo-extension {
    font-size: 1rem;
    opacity: 0.8;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
}

.mobile-menu-toggle span {
    width: 25px;
    height: 3px;
    background: var(--cr-red);
    margin: 3px 0;
    transition: all 0.3s ease;
    border-radius: 3px;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

.nav-links-container {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--cr-red);
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--cr-red);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-auth-buttons {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-form {
    display: flex;
    align-items: center;
    background: var(--bg-white);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.search-form:focus-within {
    border-color: var(--cr-red);
    box-shadow: 0 0 0 3px rgba(206, 17, 38, 0.1);
}

.search-input {
    border: none;
    outline: none;
    padding: 0.25rem;
    font-size: 0.95rem;
    width: 200px;
    background: transparent;
}

.search-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0;
    transition: transform 0.2s ease;
}

.search-btn:hover {
    transform: scale(1.1);
}

.user-menu {
    position: relative;
}

.user-avatar-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.avatar-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cr-red), var(--cr-blue));
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
}

/* Profile photo in nav -- same dimensions as avatar-circle */
.avatar-img {
    display: inline-block;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-light);
    vertical-align: middle;
    transition: border-color 0.3s ease;
}

.user-avatar-btn:hover .avatar-img {
    border-color: var(--cr-red);
}

.user-dropdown {
    display: none;
    position: absolute;
    top: 120%;
    right: 0;
    background: white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    min-width: 180px;
    overflow: hidden;
}

.user-menu:hover .user-dropdown {
    display: block;
}

.user-dropdown a {
    display: block;
    padding: 0.75rem 1.25rem;
    color: var(--text-dark);
    text-decoration: none;
    transition: background 0.2s ease;
}

.user-dropdown a:hover {
    background: var(--bg-light);
    color: var(--cr-red);
}

/* ================================
   BUTTONS
   ================================ */

.btn-primary,
.btn-secondary {
    padding: 0.75rem 1.75rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--cr-red), var(--cr-red-light));
    color: white;
    box-shadow: 0 4px 15px rgba(206, 17, 38, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(206, 17, 38, 0.4);
}

.btn-secondary {
    background: transparent;
    color: var(--cr-red);
    border: 2px solid var(--cr-red);
}

.btn-secondary:hover {
    background: var(--cr-red);
    color: white;
}

/* ================================
   HERO SECTION
   ================================ */

.hero {
    padding: 140px 2rem 80px;
    background: linear-gradient(135deg, var(--bg-cream) 0%, var(--bg-light) 100%);
    text-align: center;
}

.hero-container {
    max-width: 900px;
    margin: 0 auto;
}

.hero-badge {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    background: rgba(255, 215, 0, 0.2);
    border: 2px solid var(--cr-gold);
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.gradient-text {
    background: linear-gradient(135deg, var(--cr-red), var(--cr-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-description {
    font-size: 1.25rem;
    color: var(--text-light);
    margin-bottom: 2.5rem;
    line-height: 1.7;
}

.hero-cta {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ================================
   STATS SECTION
   ================================ */

.stats {
    padding: 60px 2rem;
    background: linear-gradient(135deg, var(--cr-blue), var(--cr-blue-light));
}

.stats-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 3rem;
}

.stat-item {
    text-align: center;
    color: white;
}

.stat-number {
    display: block;
    font-size: 3rem;
    font-weight: 800;
    color: var(--cr-gold);
    margin-bottom: 0.5rem;
}

.stat-label {
    display: block;
    font-size: 1.1rem;
    opacity: 0.95;
}

/* ================================
   CONTENT SECTIONS
   ================================ */

.featured,
.categories,
.contributors,
.guidelines {
    padding: 80px 2rem;
}

.content-container {
    max-width: 1200px;
    margin: 0 auto;
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-badge {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    background: rgba(206, 17, 38, 0.1);
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--cr-red);
    margin-bottom: 1rem;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.section-subtitle {
    font-size: 1.15rem;
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto;
}

.section-cta {
    text-align: center;
    margin-top: 3rem;
}

/* ================================
   TOPIC CARDS
   ================================ */

.topics-list {
    display: grid;
    gap: 2rem;
}

.topic-card {
    background: white;
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.topic-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.topic-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.topic-meta {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.category-badge,
.activity-badge {
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.category-badge {
    background: rgba(0, 43, 127, 0.1);
    color: var(--cr-blue);
}

.activity-badge {
    background: rgba(206, 17, 38, 0.1);
    color: var(--cr-red);
}

.topic-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.topic-title a {
    color: var(--text-dark);
    text-decoration: none;
    transition: color 0.3s ease;
}

.topic-title a:hover {
    color: var(--cr-red);
}

.topic-preview {
    color: var(--text-light);
    margin-bottom: 1.25rem;
    line-height: 1.6;
}

.topic-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

.topic-author {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    color: var(--text-dark);
}

.avatar-small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cr-red), var(--cr-blue));
    color: white;
    font-weight: 700;
    font-size: 0.75rem;
}

.topic-stats {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ================================
   CATEGORIES GRID
   ================================ */

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.category-card {
    background: white;
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    text-decoration: none;
    color: var(--text-dark);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    display: block;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.category-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.category-card h4 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-dark);
}

.category-card p {
    color: var(--text-light);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.category-count {
    display: inline-block;
    padding: 0.4rem 1rem;
    background: rgba(206, 17, 38, 0.1);
    color: var(--cr-red);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* ================================
   CONTRIBUTORS
   ================================ */

.contributors-list {
    display: grid;
    gap: 1.5rem;
}

.contributor-card {
    background: white;
    border-radius: var(--radius);
    padding: 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.contributor-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.contributor-rank {
    font-size: 2rem;
    font-weight: 800;
    color: var(--cr-gold);
    min-width: 60px;
    text-align: center;
}

.contributor-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cr-red), var(--cr-blue));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.contributor-info {
    flex: 1;
}

.contributor-info h4 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.contributor-info p {
    color: var(--text-light);
    line-height: 1.5;
}

.contributor-stats {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    text-align: right;
}

/* ================================
   GUIDELINES
   ================================ */

.guidelines-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.guideline-card {
    text-align: center;
}

.guideline-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.guideline-card h4 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-dark);
}

.guideline-card p {
    color: var(--text-light);
    line-height: 1.6;
}

/* ================================
   CTA SECTION
   ================================ */

.final-cta {
    padding: 80px 2rem;
    background: linear-gradient(135deg, var(--cr-red), var(--cr-red-light));
    text-align: center;
}

.cta-container {
    max-width: 800px;
    margin: 0 auto;
}

.final-cta h2 {
    font-size: 2.5rem;
    font-weight: 800;
    color: white;
    margin-bottom: 1rem;
}

.final-cta p {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 2rem;
}

.final-cta .btn-primary {
    background: white;
    color: var(--cr-red);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.final-cta .btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.3);
}

/* ================================
   FOOTER
   ================================ */

.footer {
    background: var(--text-dark);
    color: white;
    padding: 60px 2rem 30px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 4rem;
    margin-bottom: 3rem;
}

.footer-brand {
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--cr-red-light), var(--cr-gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

.footer-description {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.7;
}

.footer-links-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.footer-links h4 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--cr-gold);
}

.footer-links a {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    margin-bottom: 0.75rem;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
}

/* ================================
   RESPONSIVE - MOBILE FIXES
   ================================ */

@media (max-width: 968px) {
    /* Mobile Menu Toggle */
    .mobile-menu-toggle {
        display: flex;
    }
    
    /* Hide nav links container by default on mobile */
    .nav-links-container {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        max-width: 350px;
        height: 100vh;
        background: white;
        flex-direction: column;
        align-items: flex-start;
        gap: 2rem;
        padding: 5rem 2rem 2rem;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        transition: left 0.3s ease;
        overflow-y: auto;
    }
    
    .nav-links-container.active {
        left: 0;
    }
    
    /* Stack navigation items vertically */
    .nav-links {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }
    
    .nav-links li {
        width: 100%;
    }
    
    .nav-links a {
        display: block;
        padding: 0.75rem 0;
        font-size: 1.1rem;
    }
    
    .nav-links a.active::after {
        bottom: 0;
        left: 0;
        width: 3px;
        height: 100%;
    }
    
    .nav-actions {
        flex-direction: column;
        width: 100%;
        gap: 1.5rem;
    }
    
    .search-form {
        width: 100%;
    }
    
    .search-input {
        width: 100%;
    }
    
    .nav-auth-buttons {
        flex-direction: column;
        width: 100%;
        gap: 0.75rem;
    }
    
    .nav-auth-buttons .btn-primary,
    .nav-auth-buttons .btn-secondary {
        width: 100%;
        text-align: center;
    }
    
    .user-menu {
        width: 100%;
    }
    
    .user-avatar-btn {
        width: 100%;
        display: flex;
        align-items: center;
        gap: 1rem;
    }
    
    .user-dropdown {
        position: static;
        box-shadow: none;
        margin-top: 1rem;
        border: 1px solid var(--border-light);
    }
    
    /* Hero adjustments */
    .hero-title {
        font-size: 2.5rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    /* Footer adjustments */
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .footer-links-section {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .nav-container {
        padding: 0 1rem;
    }
    
    .logo {
        font-size: 1.5rem;
    }
    
    .logo-extension {
        font-size: 0.85rem;
    }
    
    .hero {
        padding: 120px 1rem 60px;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-description {
        font-size: 1.1rem;
    }
    
    .hero-cta {
        flex-direction: column;
    }
    
    .hero-cta .btn-primary,
    .hero-cta .btn-secondary {
        width: 100%;
    }
    
    .stats-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    
    .stat-number {
        font-size: 2.5rem;
    }
    
    .featured,
    .categories,
    .contributors,
    .guidelines {
        padding: 60px 1rem;
    }
    
    .section-title {
        font-size: 1.75rem;
    }
    
    .contributor-card {
        flex-direction: column;
        text-align: center;
    }
    
    .contributor-stats {
        text-align: center;
    }
    
    .topic-footer {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .topic-stats {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .footer-links-section {
        grid-template-columns: 1fr;
    }
    
    .final-cta h2 {
        font-size: 2rem;
    }
    
    .final-cta p {
        font-size: 1.1rem;
    }
}

/* Mobile menu overlay */
@media (max-width: 968px) {
    body.menu-open {
        overflow: hidden;
    }
    
    body.menu-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }
}