:root {
    --primary: #d4af37; /* Constitutional Gold - Symbolizing Justice and Prestige */
    --primary-dark: #b8941f;
    --secondary: #138808; /* Saffron/Orange from Indian Flag */
    --accent: #000080; /* Navy Blue - Stability and Law */
    --light: #f8fafc;
    --dark: #1e293b;
    --gray: #64748b;
    --gray-light: #e2e8f0;
    --success: #2563eb;
    --radius: 12px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 15px 40px rgba(0, 0, 0, 0.12);
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);

    /* Chapter-specific ribbon colors for Indian Constitution (25 chapters) */
    --chap-1: #d4af37; /* Constitutional Gold */
    --chap-2: #138808; /* Saffron/Orange */
    --chap-3: #000080; /* Navy Blue */
    --chap-4: #046307; /* Forest Green */
    --chap-5: #8b0000; /* Dark Red */
    --chap-6: #4b0082; /* Indigo */
    --chap-7: #8b4513; /* Saddle Brown */
    --chap-8: #2e8b57; /* Sea Green */
    --chap-9: #800080; /* Purple */
    --chap-10: #008080; /* Teal */
    --chap-11: #dc143c; /* Crimson */
    --chap-12: #ff4500; /* Orange Red */
    --chap-13: #4682b4; /* Steel Blue */
    --chap-14: #32cd32; /* Lime Green */
    --chap-15: #9400d3; /* Dark Violet */
    --chap-16: #ff1493; /* Deep Pink */
    --chap-17: #1e90ff; /* Dodger Blue */
    --chap-18: #b8860b; /* Dark Goldenrod */
    --chap-19: #20b2aa; /* Light Sea Green */
    --chap-20: #9932cc; /* Dark Orchid */
    --chap-21: #ff6347; /* Tomato */
    --chap-22: #3cb371; /* Medium Sea Green */
    --chap-23: #7b68ee; /* Medium Slate Blue */
    --chap-24: #cd853f; /* Peru */
    --chap-25: #4169e1; /* Royal Blue */
}

/* Dark mode variables */
@media (prefers-color-scheme: dark) {
    :root {
        --light: #0f172a;
        --dark: #f1f5f9;
        --gray: #94a3b8;
        --gray-light: #334155;
        --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
        --shadow-hover: 0 15px 40px rgba(0, 0, 0, 0.4);
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--light);
    color: var(--dark);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

.app-container {
    min-height: 100vh;
    width: 100%;
}

/* Header - Fixed alignment */
.content-header {
    padding: 20px 30px;
    background: white;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 99;
    min-height: 80px;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-top: 5px;
    flex: 1;
}

.header-right {
    display: flex;
    align-items: center; /* Center for button alignment */
    gap: 20px;
    padding-top: 2px;
}

.main-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--dark);
    line-height: 1.3;
}

.main-subtitle {
    font-size: 0.95rem;
    color: var(--gray);
    line-height: 1.4;
}

.header-logo {
    height: 60px;
    width: auto;
}

/* === QUIZ BUTTON STYLES === */
.quiz-btn {
    text-decoration: none;
    color: var(--primary); /* Constitutional Gold */
    font-weight: 600;
    font-size: 0.9rem;
    padding: 8px 18px;
    border: 2px solid var(--primary);
    border-radius: 8px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: transparent;
}

.quiz-btn:hover {
    background-color: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(212, 175, 55, 0.25);
}

/* Floating Home Button */
.floating-home-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
    transition: var(--transition);
    z-index: 1000;
    border: 2px solid white;
    animation: float 3s ease-in-out infinite;
}

.floating-home-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 10px 25px rgba(212, 175, 55, 0.6);
    animation: none;
}

.floating-home-btn:active {
    transform: translateY(-2px) scale(1.05);
}

.floating-home-btn i {
    font-size: 1.5rem;
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
    100% { transform: translateY(0px); }
}

/* Main Content */
.main-content {
    padding: 30px;
    background: var(--light);
    -webkit-overflow-scrolling: touch;
}

.welcome-section {
    background: white;
    border-radius: var(--radius);
    padding: 25px 30px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    display: block;
}

/* Stats Section */
.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 18px 15px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: var(--transition);
    border: 1px solid var(--gray-light);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.stat-number {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 6px;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* RESUME SECTION - Constitutional Theme */
#resume-container {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius);
    padding: 0;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    border: 2px solid var(--primary-dark);
    color: white;
    position: relative;
    overflow: hidden;
}

#resume-container::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(30deg);
    z-index: 1;
}

.resume-button-simple {
    display: flex;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    padding: 25px 30px;
    text-decoration: none;
    font-size: 1em;
    font-weight: 500;
    transition: var(--transition);
    border: none;
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 2;
    width: 100%;
    align-items: center;
    justify-content: center;
}

.resume-button-simple:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

.resume-simple-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 400px;
}

.resume-icon {
    font-size: 2rem;
    margin-right: 20px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.resume-text {
    flex: 1;
    text-align: left;
}

.resume-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: white;
}

.resume-subtitle {
    font-size: 1rem;
    opacity: 0.9;
    color: rgba(255, 255, 255, 0.9);
}

.resume-arrow {
    font-size: 1.5rem;
    margin-left: 20px;
    font-weight: bold;
    transition: transform 0.3s ease;
}

.resume-button-simple:hover .resume-arrow {
    transform: translateX(5px);
}

/* Chapters Section */
.section-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--dark);
    margin: 35px 0 20px;
    text-align: center;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--primary);
    border-radius: 3px;
}

.chapters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

/* Base Chapter Card Styles - Professional Ribbon Design for Constitution */
.chapter-card {
    background: white;
    border-radius: var(--radius);
    padding: 22px 20px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
    border: 1px solid var(--gray-light);
    position: relative;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 150px;
    -webkit-tap-highlight-color: transparent;
    overflow: hidden;
}

/* Color Ribbon on Top */
.chapter-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--ribbon-color, var(--primary));
    z-index: 2;
    transition: height 0.3s ease;
}

/* Light gradient overlay that appears on hover */
.chapter-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, 
        transparent 0%, 
        rgba(var(--ribbon-rgb, 212, 175, 55), 0.05) 30%,
        rgba(var(--ribbon-rgb, 212, 175, 55), 0.1) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 0;
    pointer-events: none;
}

.chapter-card > * {
    position: relative;
    z-index: 1;
}

.chapter-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: var(--ribbon-color, var(--primary));
}

.chapter-card:hover::before {
    height: 6px;
}

.chapter-card:hover::after {
    opacity: 1;
}

.chapter-card.touch-active {
    transform: translateY(-2px) scale(0.98);
    box-shadow: var(--shadow);
    border-color: var(--ribbon-color, var(--primary));
}

/* Chapter-specific ribbon color assignments for Indian Constitution */
.chapter-card[data-name*="Chapter 1"] { --ribbon-color: var(--chap-1); --ribbon-rgb: 212, 175, 55; }
.chapter-card[data-name*="Chapter 2"] { --ribbon-color: var(--chap-2); --ribbon-rgb: 19, 136, 8; }
.chapter-card[data-name*="Chapter 3"] { --ribbon-color: var(--chap-3); --ribbon-rgb: 0, 0, 128; }
.chapter-card[data-name*="Chapter 4"] { --ribbon-color: var(--chap-4); --ribbon-rgb: 4, 99, 7; }
.chapter-card[data-name*="Chapter 5"] { --ribbon-color: var(--chap-5); --ribbon-rgb: 139, 0, 0; }
.chapter-card[data-name*="Chapter 6"] { --ribbon-color: var(--chap-6); --ribbon-rgb: 75, 0, 130; }
.chapter-card[data-name*="Chapter 7"] { --ribbon-color: var(--chap-7); --ribbon-rgb: 139, 69, 19; }
.chapter-card[data-name*="Chapter 8"] { --ribbon-color: var(--chap-8); --ribbon-rgb: 46, 139, 87; }
.chapter-card[data-name*="Chapter 9"] { --ribbon-color: var(--chap-9); --ribbon-rgb: 128, 0, 128; }
.chapter-card[data-name*="Chapter 10"] { --ribbon-color: var(--chap-10); --ribbon-rgb: 0, 128, 128; }
.chapter-card[data-name*="Chapter 11"] { --ribbon-color: var(--chap-11); --ribbon-rgb: 220, 20, 60; }
.chapter-card[data-name*="Chapter 12"] { --ribbon-color: var(--chap-12); --ribbon-rgb: 255, 69, 0; }
.chapter-card[data-name*="Chapter 13"] { --ribbon-color: var(--chap-13); --ribbon-rgb: 70, 130, 180; }
.chapter-card[data-name*="Chapter 14"] { --ribbon-color: var(--chap-14); --ribbon-rgb: 50, 205, 50; }
.chapter-card[data-name*="Chapter 15"] { --ribbon-color: var(--chap-15); --ribbon-rgb: 148, 0, 211; }
.chapter-card[data-name*="Chapter 16"] { --ribbon-color: var(--chap-16); --ribbon-rgb: 255, 20, 147; }
.chapter-card[data-name*="Chapter 17"] { --ribbon-color: var(--chap-17); --ribbon-rgb: 30, 144, 255; }
.chapter-card[data-name*="Chapter 18"] { --ribbon-color: var(--chap-18); --ribbon-rgb: 184, 134, 11; }
.chapter-card[data-name*="Chapter 19"] { --ribbon-color: var(--chap-19); --ribbon-rgb: 32, 178, 170; }
.chapter-card[data-name*="Chapter 20"] { --ribbon-color: var(--chap-20); --ribbon-rgb: 153, 50, 204; }
.chapter-card[data-name*="Chapter 21"] { --ribbon-color: var(--chap-21); --ribbon-rgb: 255, 99, 71; }
.chapter-card[data-name*="Chapter 22"] { --ribbon-color: var(--chap-22); --ribbon-rgb: 60, 179, 113; }
.chapter-card[data-name*="Chapter 23"] { --ribbon-color: var(--chap-23); --ribbon-rgb: 123, 104, 238; }
.chapter-card[data-name*="Chapter 24"] { --ribbon-color: var(--chap-24); --ribbon-rgb: 205, 133, 63; }
.chapter-card[data-name*="Chapter 25"] { --ribbon-color: var(--chap-25); --ribbon-rgb: 65, 105, 225; }

.chapter-icon {
    font-size: 1.8rem;
    color: var(--dark);
    margin-bottom: 12px;
    transition: var(--transition);
}

.chapter-card:hover .chapter-icon {
    color: var(--ribbon-color, var(--primary));
    transform: scale(1.1);
}

.chapter-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 8px;
    line-height: 1.4;
    transition: color 0.3s ease;
}

.chapter-card:hover .chapter-title {
    color: var(--dark);
}

.chapter-desc {
    font-size: 0.8rem;
    color: var(--gray);
    line-height: 1.4;
    transition: color 0.3s ease;
}

.chapter-card:hover .chapter-desc {
    color: var(--dark);
}

footer {
    padding: 25px;
    text-align: center;
    background: white;
    border-top: 1px solid var(--gray-light);
    color: var(--gray);
    font-size: 0.95rem;
}

.heart {
    color: var(--secondary);
    animation: heartbeat 1.5s infinite;
}

@keyframes heartbeat {
    0% { transform: scale(1); }
    5% { transform: scale(1.1); }
    10% { transform: scale(1); }
    15% { transform: scale(1.1); }
    20% { transform: scale(1); }
    100% { transform: scale(1); }
}

/* =========================================== */
/* MOBILE RESPONSIVE HIDING RULES */
/* =========================================== */

/* Hide logo on tablets and mobiles (768px and below) */
@media (max-width: 768px) {
    .header-logo {
        display: none !important;
    }
}

/* Hide welcome section on mobile */
@media (max-width: 768px) {
    .welcome-section {
        display: none !important;
    }
    
    .section-title {
        margin-top: 20px;
    }
    
    .main-content {
        padding-top: 20px;
    }
}

/* Mobile fixes for simplified resume section */
@media (max-width: 768px) {
    #resume-container {
        margin-bottom: 18px;
    }
    
    .resume-button-simple {
        padding: 20px 25px;
    }
    
    .resume-simple-content {
        max-width: 100%;
    }
    
    .resume-icon {
        font-size: 1.8rem;
        margin-right: 15px;
    }
    
    .resume-title {
        font-size: 1.2rem;
    }
    
    .resume-subtitle {
        font-size: 0.95rem;
    }
    
    .resume-arrow {
        font-size: 1.3rem;
        margin-left: 15px;
        font-weight: bold;
        transition: transform 0.3s ease;
    }
    
    .resume-button-simple:hover .resume-arrow {
        transform: translateX(5px);
    }
}

@media (max-width: 480px) {
    .resume-button-simple {
        padding: 18px 20px;
    }
    
    .resume-icon {
        font-size: 1.5rem;
        margin-right: 12px;
    }
    
    .resume-title {
        font-size: 1.1rem;
    }
    
    .resume-subtitle {
        font-size: 0.9rem;
    }
    
    .resume-arrow {
        font-size: 1.2rem;
        margin-left: 12px;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .content-header {
        padding: 15px 20px;
        min-height: auto;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 15px;
    }

    /* LEFT HEADER (Mobile) - Order 1 ensures title is FIRST */
    .header-left {
        order: 1;
        padding-top: 0;
        align-items: center;
        width: 100%;
    }

    /* RIGHT HEADER (Mobile) - Order 2 ensures button is SECOND */
    .header-right {
        order: 2;
        padding-top: 0;
        justify-content: center;
        width: 100%; /* Full width for centering button */
        gap: 15px;
        flex-wrap: wrap;
    }
    
    /* Full width quiz button for mobile */
    .quiz-btn {
        width: 100%;
        justify-content: center;
        padding: 12px;
    }

    .main-content {
        padding: 20px;
    }

    .main-title {
        font-size: 1.5rem;
    }

    .main-subtitle {
        font-size: 0.85rem;
    }

    .stat-card {
        padding: 15px 10px;
    }

    .stat-number {
        font-size: 1.4rem;
        margin-bottom: 5px;
    }

    .stat-label {
        font-size: 0.7rem;
    }

    .section-title {
        font-size: 1.4rem;
        margin: 30px 0 15px;
    }

    .section-title::after {
        bottom: -6px;
    }

    .chapters-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .chapter-card {
        padding: 20px 15px;
        min-height: 130px;
    }

    .chapter-icon {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }

    .chapter-title {
        font-size: 0.9rem;
    }

    .chapter-desc {
        font-size: 0.75rem;
    }

    /* Floating button mobile adjustments */
    .floating-home-btn {
        width: 55px;
        height: 55px;
        bottom: 20px;
        right: 20px;
    }

    .floating-home-btn i {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .content-header {
        padding: 15px 15px;
        gap: 12px;
    }
    
    .main-title {
        font-size: 1.3rem;
    }

    .main-subtitle {
        font-size: 0.8rem;
    }

    .main-content {
        padding: 15px;
    }

    .chapters-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .chapter-card {
        padding: 15px;
        min-height: 120px;
    }

    .chapter-icon {
        font-size: 1.3rem;
        margin-bottom: 8px;
    }

    .chapter-title {
        font-size: 0.85rem;
    }

    .chapter-desc {
        font-size: 0.7rem;
    }

    /* Very small screen floating button */
    .floating-home-btn {
        width: 50px;
        height: 50px;
        bottom: 15px;
        right: 15px;
    }

    .floating-home-btn i {
        font-size: 1.2rem;
    }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .heart {
        animation: none;
    }
    
    .floating-home-btn {
        animation: none;
    }
    
    .resume-icon {
        animation: none;
    }
    
    .resume-button-simple:hover .resume-arrow {
        transform: none;
    }
}

/* Dark mode support - Constitutional Theme */
@media (prefers-color-scheme: dark) {
    .welcome-section, .stat-card, .chapter-card, footer, .content-header {
        background: #1e293b;
        color: #f1f5f9;
        border-color: #334155;
    }

    body {
        background-color: #0f172a;
        color: #f1f5f9;
    }

    .main-title, .section-title {
        color: #f1f5f9;
    }
    
    .chapter-card:hover {
        border-color: var(--ribbon-color, var(--primary));
    }
    
    #resume-container {
        background: linear-gradient(135deg, #b8941f, #9a7c15);
        border-color: #9a7c15;
    }
    
    /* Quiz Button Dark Mode */
    .quiz-btn {
        color: #f1f5f9;
        border-color: var(--primary);
    }
    
    .quiz-btn:hover {
        background-color: var(--primary);
        color: white;
    }

    .floating-home-btn {
        background: var(--primary-dark);
        border: 2px solid #1e293b;
    }
    
    .stat-label, .main-subtitle, .chapter-desc, footer {
        color: #94a3b8;
    }

    .stat-number {
        color: #d4af37;
    }

    .chapter-icon {
        color: #f1f5f9;
    }
    
    .chapter-card:hover .chapter-icon {
        color: var(--ribbon-color, #d4af37);
    }
    
    .chapter-title, .chapter-card:hover .chapter-title {
        color: #f1f5f9;
    }
    
    .chapter-desc, .chapter-card:hover .chapter-desc {
        color: #94a3b8;
    }
}