@import url('https://fonts.googleapis.com/css2?family=Galada&family=Hind+Siliguri:wght@300;400;500;600&family=Inter:wght@400;500;600&display=swap');

:root {
    /* Backgrounds */
    --bg-paper: #F0F4F8;
    /* Soft Blue-Grey/White Mix */
    --bg-card: #FFFFFF;
    /* Pure White */
    --bg-offset: #E1E8ED;
    /* Light Grey Separator */

    /* Text */
    --text-main: #2C3E50;
    /* Dark Charcoal / Deep Blue-Grey */
    --text-muted: #7F8C8D;
    /* Soft Grey */
    --text-light: #ECF0F1;
    /* Off-White for dark backgrounds */

    /* Branding - Clean Blue Theme */
    --brand-primary: #1e3a8a;
    /* Deep Navy Blue */
    --brand-accent: #3b82f6;
    /* Sky Blue / Bright Blue */
    --brand-dark: #0f172a;
    /* Very Dark Blue for Footer */

    --primary-color: var(--brand-primary);

    /* Badge/Status Colors */
    --badge-gold: #FFD700;
    /* Kept for specific highlights if needed, but rarely used */
    --badge-silver: #C0C0C0;
    --badge-bronze: #CD7F32;
    --badge-blue: #E3F2FD;
    /* Light Blue Pill Background */
    --badge-text: #1565C0;
    /* Dark Blue Text */

    /* Shadows */
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    --font-heading: 'Galada', cursive;
    --font-body: 'Hind Siliguri', sans-serif;
}


body {
    font-family: var(--font-body);
    margin: 0;
    padding: 0;
    background-color: #f9fafb;
    color: var(--text-color);
}

/* Brand Logo */
.brand-logo {
    font-family: var(--font-heading);
    font-size: 2rem;
    color: var(--primary-color);
    text-decoration: none;
}

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

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: opacity 0.2s;
}

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

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
}

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

/* Ensure Logo matches Brand */
.logo {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
}

/* Toasts */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease-out;
    z-index: 1000;
}

.toast-info {
    background: #333;
}

.toast-error {
    background: var(--error-color);
}

.toast-success {
    background: var(--success-color);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* Loader */
.loader {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
}

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

/* --- PROFESSIONAL NAVBAR (Sticky & Glass) --- */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    background: rgba(249, 247, 242, 0.95);
    /* Glass Effect */
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    height: 80px;
}

.nav-links {
    display: flex;
    gap: 2.5rem;
    align-items: center;
}

.nav-links a {
    font-weight: 500;
    font-size: 1.05rem;
    position: relative;
    text-decoration: none;
    color: var(--text-color);
}

/* Hover Underline Effect */
.nav-links a:not(.btn-login)::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 0;
    background-color: var(--brand-accent, #C0392B);
    transition: width 0.3s;
}

.nav-links a:not(.btn-login):hover::after {
    width: 100%;
}

.btn-login {
    font-family: 'Inter', sans-serif;
    background: var(--primary-color);
    padding: 10px 28px;
    border-radius: 50px;
    color: white !important;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(26, 60, 107, 0.2);
}

.btn-login:hover {
    background: var(--brand-accent, #C0392B);
    transform: translateY(-2px);
}

/* --- PROFESSIONAL FOOTER (Clean Navy Theme) --- */
footer {
    background: var(--brand-dark);
    /* Deep Navy */
    color: var(--text-light);
    padding-top: 5rem;
    font-size: 0.95rem;
    margin-top: auto;
}

.footer-content {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
    gap: 3rem;
    padding: 0 5% 4rem;
    max-width: 1300px;
    margin: 0 auto;
    text-align: left;
}

.footer-col h4 {
    font-family: 'Galada', cursive;
    font-size: 1.6rem;
    margin-bottom: 1.5rem;
    color: #F1C40F;
    /* Gold */
}

.footer-col h4.logo {
    color: white !important;
    font-size: 2.2rem;
}

.footer-col ul {
    list-style: none;
    padding: 0;
}

.footer-col ul li {
    margin-bottom: 12px;
}

.footer-col ul li a {
    color: #BDC3C7;
    transition: 0.3s;
    display: block;
    text-decoration: none;
}

.footer-col ul li a:hover {
    transform: translateX(5px);
    color: #F1C40F;
}

.contact-info li {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #BDC3C7;
    margin-bottom: 15px;
}

.footer-socials a {
    color: white;
    margin-right: 15px;
    background: rgba(255, 255, 255, 0.1);
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

.footer-socials a:hover {
    background: #C0392B;
    border-color: #C0392B;
}

.footer-bottom {
    background: #0B1C36;
    padding: 1.5rem;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
    color: #7F8C8D;
}

/* --- TOP WRITERS --- */
/* --- TOP WRITERS (AUTHOR CARD DESIGN) --- */
.writer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2.5rem;
    margin-top: 3rem;
}

.writer-card {
    background: var(--bg-card);
    border-radius: 16px;
    /* Slightly more rounded */
    box-shadow: var(--shadow-soft);
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding-bottom: 2rem;
}

.writer-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: var(--brand-accent);
}

/* The Header Background (Blue Gradient) */
.card-header-bg {
    height: 110px;
    background: linear-gradient(135deg, var(--brand-primary) 0%, #3b82f6 100%);
    /* Navy to Sky Blue */
    margin-bottom: -55px;
    /* Pulls avatar up */
}

/* Rank Badge (Clean Blue/Silver) */
.rank-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    /* Moved to right for a cleaner look or per request */
    background: rgba(255, 255, 255, 0.9);
    color: var(--brand-primary);
    padding: 5px 12px;
    font-size: 0.85rem;
    font-weight: 800;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 10;
    border-radius: 20px;
    border: 2px solid var(--brand-accent);
}

.profile-img {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    border: 5px solid white;
    /* Clean white border */
    object-fit: cover;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    background: #fff;
    position: relative;
    z-index: 2;
}

.writer-info {
    padding: 1rem 1.5rem 0.5rem;
}

.writer-name {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
    font-family: var(--font-body);
    /* Modern Feel */
}

.writer-location {
    font-size: 0.9rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

/* Stats Row - Clean & Minimal */
.writer-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    border-top: 1px solid var(--bg-offset);
    padding-top: 15px;
    margin-top: 10px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-weight: 800;
    color: var(--brand-primary);
    display: block;
    font-size: 1.2rem;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* The Prize Badge (Pill Shape) */
.prize-badge {
    margin-top: 1.5rem;
    display: inline-block;
    background: var(--badge-blue);
    color: var(--badge-text);
    /* border: 1px solid var(--brand-accent); */
    padding: 8px 20px;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Mobile Footer Fix & Navbar */
@media (max-width: 768px) {

    /* Navbar & Menu (MANDATED FIX) */
    .navbar {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        height: 70px;
        padding: 0 20px !important;
        width: 100% !important;
        box-sizing: border-box;
    }

    .logo,
    .brand-logo {
        margin-right: auto !important;
    }

    .mobile-menu-icon {
        margin-left: auto !important;
    }

    .nav-links {
        /* Enforce absolute positioning */
        position: absolute !important;
        top: 70px !important;
        left: 0 !important;
        width: 100% !important;
        background-color: #FFFFFF !important;
        flex-direction: column !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        padding: 20px 0 !important;
        gap: 1.5rem !important;
        z-index: 999;
    }

    .btn-login {
        width: 80% !important;
        margin: 0 auto;
        display: block;
        text-align: center;
    }

    /* Hero Section */
    h1 {
        font-size: 2.2rem !important;
        line-height: 1.2;
    }

    .actions {
        flex-direction: column !important;
        width: 100% !important;
        gap: 1rem !important;
        padding: 0 20px;
        box-sizing: border-box;
    }

    .actions .btn {
        width: 100% !important;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    /* Story Grid */
    #story-grid,
    .story-grid {
        grid-template-columns: 1fr !important;
    }

    /* Footer */
    .footer-content {
        grid-template-columns: 1fr !important;
        text-align: center !important;
        gap: 2rem !important;
    }

    .contact-info li {
        justify-content: center !important;
    }

    .nav-links {
        display: none;
    }

    /* Mobile Menu Icon Visibility */
    .mobile-menu-icon {
        display: block !important;
        /* Ensure it overrides any specific desktop hiding */
        cursor: pointer;
        font-size: 1.5rem;
        color: var(--primary-color) !important;
        /* Ensure Brand Blue Color */
    }

    /* Touch Targets */
    a,
    button,
    .btn {
        min-height: 44px;
        min-width: 44px;
    }

    /* Reduce body/section padding */
    body {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

/* Default Desktop State for Mobile Icon */
@media (min-width: 769px) {
    .mobile-menu-icon {
        display: none !important;
    }
}

/* --- EMERGENCY MOBILE NAVBAR OVERRIDE --- */
@media (max-width: 768px) {

    /* 1. Force the Container to spread elements apart */
    .navbar {
        display: flex !important;
        justify-content: space-between !important;
        /* Pushes items to edges */
        align-items: center !important;
        width: 100% !important;
        height: 70px !important;
        padding: 0 20px !important;
        /* Standard padding */
        box-sizing: border-box !important;
    }

    /* 2. Anchor Logo to the LEFT */
    .logo {
        margin: 0 !important;
        flex-grow: 0 !important;
        text-align: left !important;
    }

    /* 3. Anchor Hamburger Icon to the RIGHT */
    .mobile-menu-icon {
        display: block !important;
        margin: 0 !important;
        margin-left: auto !important;
        /* This creates the separation */
        position: relative !important;
        top: auto !important;
        right: auto !important;
        cursor: pointer;
    }

    /* 4. Ensure the dropdown menu doesn't break the bar */
    .nav-links {
        position: absolute !important;
        top: 70px !important;
        left: 0 !important;
        width: 100% !important;
        background: #ffffff !important;
        z-index: 9999 !important;
    }
}

/* --- EMERGENCY MOBILE NAVBAR OVERRIDE --- */
@media (max-width: 768px) {

    /* 1. Force the Container to spread elements apart */
    .navbar {
        display: flex !important;
        justify-content: space-between !important;
        /* Pushes items to edges */
        align-items: center !important;
        width: 100% !important;
        height: 70px !important;
        padding: 0 20px !important;
        /* Standard padding */
        box-sizing: border-box !important;
    }

    /* 2. Anchor Logo to the LEFT */
    .logo {
        margin: 0 !important;
        flex-grow: 0 !important;
        text-align: left !important;
    }

    /* 3. Anchor Hamburger Icon to the RIGHT */
    .mobile-menu-icon {
        display: block !important;
        margin: 0 !important;
        margin-left: auto !important;
        /* This creates the separation */
        position: relative !important;
        top: auto !important;
        right: auto !important;
        cursor: pointer;
    }

    /* 4. Ensure the dropdown menu doesn't break the bar */
    .nav-links {
        position: absolute !important;
        top: 70px !important;
        left: 0 !important;
        width: 100% !important;
        background: #ffffff !important;
        z-index: 9999 !important;
    }
}