/* ================================
   GLOBAL STYLES & RESET
   ================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Palette */
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #10b981;
    --accent-color: #f59e0b;
    --danger-color: #ef4444;

    /* Difficulty Colors */
    --easy-color: #10b981;
    --medium-color: #f59e0b;
    --hard-color: #ef4444;

    /* Neutral Colors */
    --dark-bg: #1f2937;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Typography */
    --font-primary: 'Poppins', sans-serif;
    --font-hindi: 'Noto Sans Devanagari', sans-serif;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
}

body {
    font-family: var(--font-primary);
    line-height: 1.6;
    color: var(--gray-800);
    background-color: #ffffff;
    overflow-x: hidden;
}

.hi-text {
    font-family: var(--font-hindi);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

img {
    max-width: 100%;
    height: auto;
}

/* ================================
   LANGUAGE TOGGLE BUTTON
   ================================ */
.lang-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.lang-toggle button {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
    font-family: var(--font-hindi);
}

.lang-toggle button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.lang-toggle button:active {
    transform: translateY(0);
}

/* ================================
   HEADER SECTION
   ================================ */
.main-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: var(--spacing-xl) 0;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.main-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.main-header .subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    font-weight: 400;
}

/* ================================
   WELCOME SECTION
   ================================ */
.welcome-section {
    padding: var(--spacing-xl) 0;
    background: linear-gradient(to bottom, #f0f9ff, #ffffff);
}

.welcome-box {
    background: white;
    padding: var(--spacing-xl);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border-left: 6px solid var(--primary-color);
}

.welcome-box h2 {
    color: var(--primary-color);
    font-size: 2rem;
    margin-bottom: var(--spacing-md);
}

.welcome-box p {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--gray-700);
    margin-bottom: var(--spacing-md);
}

.feature-highlights {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

.feature-item {
    background: var(--gray-100);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    font-weight: 500;
    text-align: center;
    transition: all 0.3s ease;
}

.feature-item:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-3px);
}

/* ================================
   TOPICS OVERVIEW SECTION
   ================================ */
.topics-overview {
    padding: var(--spacing-xl) 0;
    background-color: #f9fafb;
}

.section-title {
    text-align: center;
    font-size: 2.25rem;
    color: var(--gray-900);
    margin-bottom: var(--spacing-xl);
    position: relative;
    padding-bottom: var(--spacing-md);
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
}

.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-lg);
}

.topic-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    border-top: 4px solid var(--gray-300);
    display: flex;
    flex-direction: column;
}

.topic-card.easy {
    border-top-color: var(--easy-color);
}

.topic-card.medium {
    border-top-color: var(--medium-color);
}

.topic-card.hard {
    border-top-color: var(--hard-color);
}

.topic-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.topic-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.topic-number {
    background: var(--primary-color);
    color: white;
    padding: 6px 14px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
}

.marks {
    background: var(--accent-color);
    color: white;
    padding: 6px 14px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
}

.topic-card h3 {
    font-size: 1.5rem;
    color: var(--gray-900);
    margin-bottom: var(--spacing-sm);
}

.topic-card p {
    color: var(--gray-700);
    line-height: 1.7;
    margin-bottom: var(--spacing-md);
    flex-grow: 1;
}

.topic-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-sm) 0;
    border-top: 1px solid var(--gray-200);
    border-bottom: 1px solid var(--gray-200);
}

.difficulty {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
}

.easy-badge {
    color: var(--easy-color);
    background: rgba(16, 185, 129, 0.1);
}

.medium-badge {
    color: var(--medium-color);
    background: rgba(245, 158, 11, 0.1);
}

.hard-badge {
    color: var(--hard-color);
    background: rgba(239, 68, 68, 0.1);
}

.question-type {
    font-size: 0.85rem;
    color: var(--gray-700);
    font-weight: 500;
}

.subtopics {
    margin: var(--spacing-md) 0;
    padding: var(--spacing-md);
    background: var(--gray-100);
    border-radius: var(--radius-md);
}

.subtopic-item {
    font-size: 0.9rem;
    color: var(--gray-700);
    margin-bottom: var(--spacing-xs);
    padding-left: var(--spacing-sm);
}

.btn-primary {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 14px 28px;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
    margin-top: auto;
    box-shadow: var(--shadow-md);
}

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

/* ================================
   STUDY TIPS SECTION
   ================================ */
.study-tips {
    padding: var(--spacing-xl) 0;
    background: white;
}

.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
}

.tip-card {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.tip-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    transform: rotate(45deg);
}

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

.tip-number {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--spacing-md);
    box-shadow: var(--shadow-md);
}

.tip-card h3 {
    font-size: 1.25rem;
    color: var(--gray-900);
    margin-bottom: var(--spacing-sm);
}

.tip-card p {
    color: var(--gray-700);
    line-height: 1.7;
    font-size: 0.95rem;
}

/* ================================
   QUICK REFERENCE SECTION
   ================================ */
.quick-reference {
    padding: var(--spacing-xl) 0;
    background: var(--gray-100);
}

.reference-table {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    margin-top: var(--spacing-lg);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

thead th {
    padding: var(--spacing-md);
    text-align: left;
    font-weight: 600;
    font-size: 0.95rem;
}

tbody tr {
    border-bottom: 1px solid var(--gray-200);
    transition: background 0.2s ease;
}

tbody tr:hover {
    background: var(--gray-100);
}

tbody td {
    padding: var(--spacing-md);
    font-size: 0.95rem;
}

.badge-easy,
.badge-medium,
.badge-hard {
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-block;
}

.badge-easy {
    background: rgba(16, 185, 129, 0.1);
    color: var(--easy-color);
}

.badge-medium {
    background: rgba(245, 158, 11, 0.1);
    color: var(--medium-color);
}

.badge-hard {
    background: rgba(239, 68, 68, 0.1);
    color: var(--hard-color);
}

/* ================================
   FOOTER
   ================================ */
.main-footer {
    background: var(--gray-900);
    color: white;
    padding: var(--spacing-xl) 0;
    text-align: center;
}

.main-footer p {
    margin-bottom: var(--spacing-sm);
    opacity: 0.9;
}

.disclaimer {
    font-size: 0.9rem;
    opacity: 0.7;
}

/* ================================
   TOPIC PAGES STYLES
   ================================ */
.topic-header-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: var(--spacing-xl) 0;
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.topic-header-banner h1 {
    font-size: 2.5rem;
    margin-bottom: var(--spacing-sm);
}

.topic-header-banner .meta-info {
    display: flex;
    justify-content: center;
    gap: var(--spacing-lg);
    margin-top: var(--spacing-md);
}

.meta-badge {
    background: rgba(255,255,255,0.2);
    padding: 8px 20px;
    border-radius: var(--radius-md);
    font-weight: 500;
}

.content-section {
    padding: var(--spacing-lg) 0;
}

.theory-box {
    background: white;
    padding: var(--spacing-xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--spacing-lg);
    border-left: 4px solid var(--primary-color);
}

.theory-box h2 {
    color: var(--primary-color);
    font-size: 1.75rem;
    margin-bottom: var(--spacing-md);
}

.theory-box h3 {
    color: var(--gray-800);
    font-size: 1.35rem;
    margin: var(--spacing-lg) 0 var(--spacing-md);
}

.formula-box {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    border-left: 4px solid var(--primary-color);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin: var(--spacing-md) 0;
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

.example-box {
    background: var(--gray-100);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin: var(--spacing-md) 0;
    border-left: 3px solid var(--secondary-color);
}

.example-box .example-label {
    color: var(--secondary-color);
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
}

.example-sentence {
    margin: var(--spacing-xs) 0;
    padding-left: var(--spacing-md);
}

.practice-section {
    background: #fef3c7;
    padding: var(--spacing-xl);
    border-radius: var(--radius-lg);
    margin: var(--spacing-xl) 0;
}

.practice-section h3 {
    color: var(--accent-color);
    margin-bottom: var(--spacing-md);
}

.exercise-item {
    background: white;
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-sm);
    box-shadow: var(--shadow-sm);
}

.note-box {
    background: #fef2f2;
    border-left: 4px solid var(--danger-color);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin: var(--spacing-md) 0;
}

.note-box strong {
    color: var(--danger-color);
}

.nav-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: var(--spacing-xl);
    gap: var(--spacing-md);
}

.btn-secondary {
    background: var(--gray-700);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-block;
}

.btn-secondary:hover {
    background: var(--gray-900);
    transform: translateY(-2px);
}

/* ================================
   RESPONSIVE DESIGN
   ================================ */
@media (max-width: 768px) {
    .main-header h1 {
        font-size: 1.75rem;
    }

    .main-header .subtitle {
        font-size: 0.95rem;
    }

    .welcome-box h2 {
        font-size: 1.5rem;
    }

    .section-title {
        font-size: 1.75rem;
    }

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

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

    .feature-highlights {
        grid-template-columns: 1fr;
    }

    .lang-toggle {
        top: 10px;
        right: 10px;
    }

    .lang-toggle button {
        padding: 10px 18px;
        font-size: 0.85rem;
    }

    table {
        font-size: 0.85rem;
    }

    thead th,
    tbody td {
        padding: var(--spacing-sm);
    }

    .topic-meta {
        flex-direction: column;
        gap: var(--spacing-xs);
        align-items: flex-start;
    }

    .nav-buttons {
        flex-direction: column;
    }

    .topic-header-banner h1 {
        font-size: 1.75rem;
    }

    .topic-header-banner .meta-info {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 var(--spacing-sm);
    }

    .main-header {
        padding: var(--spacing-lg) 0;
    }

    .welcome-box,
    .theory-box {
        padding: var(--spacing-md);
    }

    .topic-card {
        padding: var(--spacing-md);
    }
}

/* ================================
   PRINT STYLES
   ================================ */
@media print {
    .lang-toggle,
    .nav-buttons,
    .main-footer {
        display: none;
    }

    .topic-card,
    .theory-box {
        page-break-inside: avoid;
    }

    body {
        font-size: 12pt;
        line-height: 1.5;
    }
}

/* ================================
   UTILITY CLASSES
   ================================ */
.text-center {
    text-align: center;
}

.mb-sm {
    margin-bottom: var(--spacing-sm);
}

.mb-md {
    margin-bottom: var(--spacing-md);
}

.mb-lg {
    margin-bottom: var(--spacing-lg);
}

.mt-lg {
    margin-top: var(--spacing-lg);
}

.highlight {
    background: #fef08a;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 600;
}

.text-primary {
    color: var(--primary-color);
}

.text-success {
    color: var(--secondary-color);
}

.text-warning {
    color: var(--accent-color);
}

.text-danger {
    color: var(--danger-color);
}

/* ================================
   TOPIC PAGE SPECIFIC STYLES
   ================================ */
.page-header {
    text-align: center;
    padding: var(--spacing-xl) 0;
    margin-bottom: var(--spacing-lg);
}

.page-header h1 {
    font-size: 2.5rem;
    color: var(--gray-900);
    margin-bottom: var(--spacing-sm);
}

.difficulty-badge {
    display: inline-block;
    padding: 8px 20px;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: var(--spacing-md);
}

.exam-info {
    color: var(--gray-700);
    font-size: 1rem;
    margin-top: var(--spacing-sm);
}

.topic-section {
    background: white;
    padding: var(--spacing-xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--spacing-xl);
}

.topic-section h2 {
    color: var(--primary-color);
    font-size: 1.75rem;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--gray-200);
}

.topic-section h3 {
    color: var(--gray-800);
    font-size: 1.35rem;
    margin: var(--spacing-md) 0;
}

.topic-section h4 {
    color: var(--gray-700);
    font-size: 1.1rem;
    margin: var(--spacing-sm) 0;
}

.theory-section {
    margin-bottom: var(--spacing-xl);
}

.formula {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    font-size: 1.1em;
    text-align: center;
    margin: 1rem 0;
    font-weight: 600;
}

.formula-breakdown {
    background: var(--gray-100);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin-top: var(--spacing-md);
}

.formula-breakdown p {
    margin: 0.5rem 0;
}

.formula-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background: white;
}

.formula-table th,
.formula-table td {
    padding: 0.75rem;
    text-align: left;
    border: 1px solid var(--gray-200);
}

.formula-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.formula-table tbody tr:nth-child(even) {
    background: #f9fafb;
}

.example-note {
    color: #6b7280;
    font-size: 0.9em;
    font-style: italic;
    margin-left: 1.5rem;
}

.simple-sentence {
    color: #6b7280;
    font-size: 0.95em;
    margin: 0.5rem 0;
}

.combined-sentence {
    color: #059669;
    font-weight: 600;
    font-size: 1em;
    margin: 0.5rem 0;
}

.error-note {
    color: var(--danger-color);
    font-size: 0.9em;
    font-style: italic;
}

.correct-note {
    color: var(--secondary-color);
    font-size: 0.9em;
    font-style: italic;
}

.exercise-box {
    background: white;
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-lg);
    border-left: 4px solid var(--accent-color);
}

.exercise-box h3 {
    color: var(--accent-color);
    margin-bottom: var(--spacing-md);
}

.question {
    margin: 1.5rem 0;
    padding: var(--spacing-md);
    background: #f9fafb;
    border-left: 4px solid var(--primary-color);
    border-radius: var(--radius-sm);
}

.answer {
    margin-top: var(--spacing-md);
    padding: var(--spacing-md);
    background: #ecfdf5;
    border-left: 4px solid var(--secondary-color);
    border-radius: var(--radius-sm);
}

.topic-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--spacing-xl);
    padding: var(--spacing-lg) 0;
    gap: var(--spacing-md);
}

.back-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    background: white;
    color: var(--primary-color);
    padding: 10px 20px;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    z-index: 999;
}

.back-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateX(-3px);
}

#scrollTopBtn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    padding: 15px 20px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
    z-index: 999;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#scrollTopBtn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
}

/* Language Toggle Button - Updated for consistency */
.lang-toggle {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
    font-family: var(--font-hindi);
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.lang-toggle:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.lang-toggle:active {
    transform: translateY(0);
}

/* Override old button style */
.lang-toggle button {
    all: unset;
}
