/* ===================================================
   GRAMMAR PAGE - Enhanced Modern Design with SVG Icons
   =================================================== */

/* Smooth page layout */
@media (max-width: 768px) {
  body {
    padding-top: 70px;
  }
}

/* Hero section improvements */
@media (max-width: 768px) {
  .hero {
    margin-top: 0;
    min-height: 280px;
  }
}

.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  pointer-events: none;
  opacity: 0.92;
}

/* Main content area */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  background: var(--bg-primary);
  min-height: 60vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Content grid improvements */
.content-grid {
  display: grid;
  gap: 2rem;
}

.grammar-content {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  padding: 0;
}

/* Section styling */
.grammar-section {
  margin-bottom: 4rem;
  padding: 2.5rem;
  background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 24px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.grammar-section:hover {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid transparent;
  background: linear-gradient(90deg, var(--primary-color) 0%, var(--secondary-color) 50%, transparent 100%);
  background-size: 100% 2px;
  background-position: bottom;
  background-repeat: no-repeat;
}

.section-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
  box-shadow: 0 8px 20px rgba(70, 187, 229, 0.3);
  position: relative;
  overflow: hidden;
}

.section-icon::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent 40%, rgba(255,255,255,0.2) 50%, transparent 60%);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%) rotate(45deg); }
  100% { transform: translateX(100%) rotate(45deg); }
}

.section-header h2 {
  flex: 1;
  font-family: "Poppins", sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

/* ===========================================
   ENHANCED RULE CARDS WITH SVG ICONS
   =========================================== */

.rule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.75rem;
  margin-top: 2rem;
}

.rule-card {
  background: white;
  border: none;
  border-radius: 20px;
  padding: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.rule-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
  background: linear-gradient(135deg, var(--card-gradient-start, #667eea) 0%, var(--card-gradient-end, #764ba2) 100%);
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 0;
}

.rule-card:hover {
  transform: translateY(-12px) scale(1.02);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

.rule-card:hover::before {
  opacity: 0.03;
}

/* Card Header with SVG Icon */
.rule-card-header {
  position: relative;
  padding: 1.5rem 1.5rem 0;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  z-index: 1;
}

.rule-card-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.rule-card-icon svg {
  width: 36px;
  height: 36px;
  position: relative;
  z-index: 1;
}

.rule-card-icon::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 100%);
}

/* Card Body */
.rule-card-body {
  padding: 1rem 1.5rem 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  z-index: 1;
}

.rule-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  font-family: "Poppins", sans-serif;
  line-height: 1.3;
}

.rule-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(70, 187, 229, 0.25);
}

.rule-explanation {
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
  flex-grow: 1;
}

/* Topic Tag */
.topic-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  background: rgba(70, 187, 229, 0.08);
  color: var(--primary-color);
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.75rem;
  width: fit-content;
}

/* Enhanced Topic Links */
.topic-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  text-decoration: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  margin-top: auto;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 14px rgba(70, 187, 229, 0.3);
  width: 100%;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.topic-link::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s ease;
}

.topic-link:hover::before {
  left: 100%;
}

.topic-link:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(70, 187, 229, 0.4);
}

.topic-link i {
  font-size: 0.9rem;
  transition: transform 0.3s ease;
}

.topic-link:hover i {
  transform: translateX(4px);
}

/* Coming soon style */
.topic-link[href="#"] {
  background: linear-gradient(135deg, #9ca3af, #6b7280);
  cursor: not-allowed;
  opacity: 0.7;
}

.topic-link[href="#"]:hover {
  transform: none;
  box-shadow: 0 4px 12px rgba(156, 163, 175, 0.3);
}

/* ===========================================
   COLOR THEMES FOR EACH CARD
   =========================================== */

/* Theme 1: Blue (Parts of Speech) */
.rule-card[data-theme="blue"] .rule-card-icon {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}
.rule-card[data-theme="blue"] { --card-gradient-start: #3b82f6; --card-gradient-end: #1d4ed8; }

/* Theme 2: Purple (Word Forms) */
.rule-card[data-theme="purple"] .rule-card-icon {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
}
.rule-card[data-theme="purple"] { --card-gradient-start: #8b5cf6; --card-gradient-end: #6d28d9; }

/* Theme 3: Pink (Prefixes & Suffixes) */
.rule-card[data-theme="pink"] .rule-card-icon {
  background: linear-gradient(135deg, #ec4899, #be185d);
}
.rule-card[data-theme="pink"] { --card-gradient-start: #ec4899; --card-gradient-end: #be185d; }

/* Theme 4: Rose (Word Families) */
.rule-card[data-theme="rose"] .rule-card-icon {
  background: linear-gradient(135deg, #f43f5e, #be123c);
}
.rule-card[data-theme="rose"] { --card-gradient-start: #f43f5e; --card-gradient-end: #be123c; }

/* Theme 5: Cyan (Sentence Structure) */
.rule-card[data-theme="cyan"] .rule-card-icon {
  background: linear-gradient(135deg, #06b6d4, #0891b2);
}
.rule-card[data-theme="cyan"] { --card-gradient-start: #06b6d4; --card-gradient-end: #0891b2; }

/* Theme 6: Teal (Clauses & Phrases) */
.rule-card[data-theme="teal"] .rule-card-icon {
  background: linear-gradient(135deg, #14b8a6, #0d9488);
}
.rule-card[data-theme="teal"] { --card-gradient-start: #14b8a6; --card-gradient-end: #0d9488; }

/* Theme 7: Green (Tenses & Aspects) */
.rule-card[data-theme="green"] .rule-card-icon {
  background: linear-gradient(135deg, #22c55e, #16a34a);
}
.rule-card[data-theme="green"] { --card-gradient-start: #22c55e; --card-gradient-end: #16a34a; }

/* Theme 8: Emerald (Modal Verbs) */
.rule-card[data-theme="emerald"] .rule-card-icon {
  background: linear-gradient(135deg, #10b981, #059669);
}
.rule-card[data-theme="emerald"] { --card-gradient-start: #10b981; --card-gradient-end: #059669; }

/* Theme 9: Amber (Conditionals) */
.rule-card[data-theme="amber"] .rule-card-icon {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}
.rule-card[data-theme="amber"] { --card-gradient-start: #f59e0b; --card-gradient-end: #d97706; }

/* Theme 10: Orange (Passive Voice) */
.rule-card[data-theme="orange"] .rule-card-icon {
  background: linear-gradient(135deg, #f97316, #ea580c);
}
.rule-card[data-theme="orange"] { --card-gradient-start: #f97316; --card-gradient-end: #ea580c; }

/* Theme 11: Red (Reported Speech) */
.rule-card[data-theme="red"] .rule-card-icon {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}
.rule-card[data-theme="red"] { --card-gradient-start: #ef4444; --card-gradient-end: #dc2626; }

/* Theme 12: Indigo (Questions & Negation) */
.rule-card[data-theme="indigo"] .rule-card-icon {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
}
.rule-card[data-theme="indigo"] { --card-gradient-start: #6366f1; --card-gradient-end: #4f46e5; }

/* Theme 13: Violet (Articles) */
.rule-card[data-theme="violet"] .rule-card-icon {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}
.rule-card[data-theme="violet"] { --card-gradient-start: #8b5cf6; --card-gradient-end: #7c3aed; }

/* Theme 14: Sky (Nouns) */
.rule-card[data-theme="sky"] .rule-card-icon {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
}
.rule-card[data-theme="sky"] { --card-gradient-start: #0ea5e9; --card-gradient-end: #0284c7; }

/* Theme 15: Lime (Prepositions) */
.rule-card[data-theme="lime"] .rule-card-icon {
  background: linear-gradient(135deg, #84cc16, #65a30d);
}
.rule-card[data-theme="lime"] { --card-gradient-start: #84cc16; --card-gradient-end: #65a30d; }

/* Theme 16: Fuchsia (Pronouns) */
.rule-card[data-theme="fuchsia"] .rule-card-icon {
  background: linear-gradient(135deg, #d946ef, #c026d3);
}
.rule-card[data-theme="fuchsia"] { --card-gradient-start: #d946ef; --card-gradient-end: #c026d3; }

/* Hide examples on overview page for cleaner look */
.grammar-section .examples {
  display: none;
}

/* Example items with clear visual hierarchy */
.examples {
  display: grid;
  gap: 1rem;
}

.example-item {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  transition: var(--transition-normal);
}

.example-item:hover {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-sm);
}

.example-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 1.2rem;
  font-weight: 700;
}

.example-correct {
  background: rgba(16, 185, 129, 0.1);
  color: var(--secondary-color);
}

.example-incorrect {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.example-text {
  flex: 1;
}

.example-sentence {
  color: var(--text-primary);
  font-weight: 500;
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.example-note {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-style: italic;
}

/* Difficulty badges */
.difficulty-badge {
  padding: 0.4rem 1rem;
  border-radius: var(--radius-lg);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.difficulty-beginner {
  background: rgba(16, 185, 129, 0.1);
  color: var(--secondary-color);
  border: 2px solid var(--secondary-color);
}

.difficulty-intermediate {
  background: rgba(245, 158, 11, 0.1);
  color: var(--accent-color);
  border: 2px solid var(--accent-color);
}

.difficulty-advanced {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 2px solid #ef4444;
}

/* ===========================================
   FLOATING DECORATIONS
   =========================================== */

.grammar-section {
  position: relative;
}

.grammar-section::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(70, 187, 229, 0.08) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.grammar-section::after {
  content: '';
  position: absolute;
  bottom: -60px;
  left: -60px;
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.06) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

/* ===========================================
   MOBILE RESPONSIVE IMPROVEMENTS
   =========================================== */

@media (max-width: 768px) {
  body {
    padding-top: 70px;
  }

  .hero {
    min-height: 350px;
    padding: 4rem 1.5rem 3rem;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-subtitle {
    font-size: 1.1rem;
  }

  .main-content {
    padding: 2rem 1rem;
  }

  .grammar-section {
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-radius: 16px;
  }

  .grammar-section::before,
  .grammar-section::after {
    display: none;
  }

  .section-header {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }

  .section-header h2 {
    font-size: 1.75rem;
  }

  .section-header p {
    margin-left: 0 !important;
    text-align: center;
  }

  .rule-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .rule-card {
    border-radius: 16px;
  }

  .rule-card:hover {
    transform: translateY(-6px) scale(1.01);
  }

  .rule-card-header {
    padding: 1.25rem 1.25rem 0;
  }

  .rule-card-body {
    padding: 0.75rem 1.25rem 1.25rem;
  }

  .rule-card-icon {
    width: 56px;
    height: 56px;
  }

  .rule-card-icon svg {
    width: 30px;
    height: 30px;
  }

  .rule-title {
    font-size: 1.15rem;
  }

  .rule-number {
    width: 28px;
    height: 28px;
    font-size: 0.85rem;
    border-radius: 8px;
  }

  .rule-explanation {
    font-size: 0.9rem;
  }

  .topic-link {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    border-radius: 10px;
  }
}

@media (max-width: 480px) {
  .hero {
    min-height: 300px;
    padding: 3rem 1rem 2rem;
  }

  .section-header h2 {
    font-size: 1.5rem;
  }

  .section-icon {
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
  }

  .rule-card-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
  }

  .rule-card-body {
    text-align: center;
  }

  .topic-tag {
    margin-left: auto;
    margin-right: auto;
  }
}

/* ===========================================
   DARK MODE SUPPORT
   =========================================== */

[data-theme="dark"] .grammar-section {
  background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .rule-card {
  background: #1e293b;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .rule-card:hover {
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .topic-tag {
  background: rgba(70, 187, 229, 0.15);
}

    <!-- Breadcrumb Structured Data -->
    <script type="application/ld+json">
      {
        "@context": "https://schema.org",
        "@type": "BreadcrumbList",
        "itemListElement": [
          {
            "@type": "ListItem",
            "position": 1,
            "name": "Home",
            "item": "https://eslfunonline.com/"
          },
          {
            "@type": "ListItem",
            "position": 2,
            "name": "English",
            "item": "https://eslfunonline.com/english/"
          },
          {
            "@type": "ListItem",
            "position": 3,
            "name": "Grammar",
            "item": "https://eslfunonline.com/english/grammar.html"
          }
        ]
      }
    </script>
  </head>
  <body>
    <!-- Scroll Progress Indicator -->
    <div class="scroll-progress" id="scrollProgress"></div>
    <!-- Header & Navigation -->
    <header>
      <div class="container">
        <nav class="navbar">
          <a href="../index.html" class="logo-container">
            <img
              src="../images/1.png"
              alt="ESL Fun Online Logo"
              class="logo-image"
              width="40"
              height="40"
            />
            <span class="logo-text">ESL Fun Online</span>
          </a>

          <ul
            class="nav-links"
            id="navLinks"
            role="menubar"
            aria-label="Main navigation"
          >
            <li class="nav-item" role="none">
              <a href="../index.html" class="nav-link" role="menuitem">
                <i class="fas fa-home"></i>
                Home
              </a>
            </li>
            <li class="nav-item" role="none">
              <a
                href="#"
                class="nav-link"
                role="menuitem"
                aria-haspopup="true"
                aria-expanded="false"
              >
                <i class="fas fa-book"></i>
                English
                <i class="fas fa-chevron-down"></i>
              </a>
              <div class="dropdown" role="menu" aria-label="English submenu">
                <a href="../english/grammar.html" class="dropdown-item">
                  <i class="fas fa-spell-check"></i>
                  Grammar Guides
                </a>
                <a href="../english/vocabguide.html" class="dropdown-item">
                  <i class="fas fa-book-open"></i>
                  Vocabulary Building
                </a>
                <a href="../english/worksheets.html" class="dropdown-item">
                  <i class="fas fa-file-alt"></i>
                  Worksheets
                </a>
                <a href="../english/writingf.html" class="dropdown-item">
                  <i class="fas fa-pen"></i>
                  Writing for Success
                </a>
                <a href="../english/business.html" class="dropdown-item">
                  <i class="fas fa-briefcase"></i>
                  Business English
                </a>
                <a href="../english/test.html" class="dropdown-item">
                  <i class="fas fa-graduation-cap"></i>
                  Test Preparation
                </a>
              </div>
            </li>
            <li class="nav-item">
              <a href="#" class="nav-link">
                <i class="fas fa-code"></i>
                Coding
                <i class="fas fa-chevron-down"></i>
              </a>
              <div class="dropdown">
                <a href="../coding/computerbasics.html" class="dropdown-item">
                  <i class="fas fa-desktop"></i>
                  Computer Basics
                </a>
                <a href="../coding/ai.html" class="dropdown-item">
                  <i class="fas fa-robot"></i>
                  AI Basics
                </a>
                <a href="../coding/codingresources.html" class="dropdown-item">
                  <i class="fas fa-code"></i>
                  Coding Basics
                </a>
              </div>
            </li>

            <li class="nav-item">
              <a href="../games/games.html" class="nav-link">
                <i class="fas fa-dice"></i>
                Games
              </a>
            </li>
            <li class="nav-item">
              <a href="../tools/tools.html" class="nav-link">
                <i class="fas fa-tools"></i>
                Toolkit
              </a>
            </li>
            <li class="nav-item">
              <a href="../blog/blog.html" class="nav-link">
                <i class="fas fa-book-open"></i>
                Blog
              </a>
            </li>
          </ul>

          <div class="controls">
            <button
              class="control-btn theme-toggle"
              id="themeToggle"
              aria-label="Toggle dark mode"
            >
              <i class="fas fa-moon"></i>
            </button>
            <a
              class="control-btn admin-toggle"
              id="adminToggle"
              aria-label="Admin"
              href="../login.html"
            >
              <i class="fas fa-user-shield"></i>
            </a>
          </div>
          <button
            class="control-btn mobile-toggle"
            id="mobileToggle"
            aria-label="Toggle mobile menu"
          >
            <i class="fas fa-bars"></i>
          </button>
        </nav>
      </div>
    </header>

    <!-- Immediate Mobile Menu Script - Inline for guaranteed execution -->
    <script>