/**
 * IELTAI Responsive CSS
 * Mobile-first responsive styles for all devices
 */

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */
:root {
  --breakpoint-mobile: 320px;
  --breakpoint-tablet: 768px;
  --breakpoint-desktop: 1024px;
  --breakpoint-large: 1280px;
  
  /* Responsive spacing */
  --spacing-mobile: 1rem;
  --spacing-tablet: 1.5rem;
  --spacing-desktop: 2rem;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Visibility utilities */
.mobile-only {
  display: block;
}

.tablet-only,
.desktop-only {
  display: none;
}

@media (min-width: 768px) {
  .mobile-only {
    display: none;
  }
  
  .tablet-only {
    display: block;
  }
}

@media (min-width: 1024px) {
  .tablet-only {
    display: none;
  }
  
  .desktop-only {
    display: block;
  }
}

/* Responsive spacing utilities */
.p-responsive {
  padding: var(--spacing-mobile);
}

.px-responsive {
  padding-left: var(--spacing-mobile);
  padding-right: var(--spacing-mobile);
}

.py-responsive {
  padding-top: var(--spacing-mobile);
  padding-bottom: var(--spacing-mobile);
}

@media (min-width: 768px) {
  .p-responsive {
    padding: var(--spacing-tablet);
  }
  
  .px-responsive {
    padding-left: var(--spacing-tablet);
    padding-right: var(--spacing-tablet);
  }
  
  .py-responsive {
    padding-top: var(--spacing-tablet);
    padding-bottom: var(--spacing-tablet);
  }
}

@media (min-width: 1024px) {
  .p-responsive {
    padding: var(--spacing-desktop);
  }
  
  .px-responsive {
    padding-left: var(--spacing-desktop);
    padding-right: var(--spacing-desktop);
  }
  
  .py-responsive {
    padding-top: var(--spacing-desktop);
    padding-bottom: var(--spacing-desktop);
  }
}

/* ============================================
   RESPONSIVE CONTAINERS
   ============================================ */
.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 768px) {
  .container {
    padding: 0 1.5rem;
  }
}

@media (min-width: 1024px) {
  .container {
    padding: 0 2rem;
  }
}

/* ============================================
   RESPONSIVE GRID SYSTEM
   ============================================ */
.grid-responsive {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 768px) {
  .grid-responsive {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .grid-responsive {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
  }
}

/* Grid variants */
.grid-2-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 768px) {
  .grid-2-col {
    grid-template-columns: repeat(2, 1fr);
  }
}

.grid-3-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 768px) {
  .grid-3-col {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .grid-3-col {
    grid-template-columns: repeat(3, 1fr);
  }
}

.grid-4-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 768px) {
  .grid-4-col {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .grid-4-col {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ============================================
   RESPONSIVE FLEXBOX
   ============================================ */
.flex-responsive {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 768px) {
  .flex-responsive {
    flex-direction: row;
    flex-wrap: wrap;
  }
  
  .flex-responsive > * {
    flex: 1 1 300px;
  }
}

/* ============================================
   RESPONSIVE TYPOGRAPHY
   ============================================ */
html {
  font-size: clamp(14px, 2vw, 16px);
}

h1 {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
}

h2 {
  font-size: clamp(1.5rem, 4vw, 2rem);
}

h3 {
  font-size: clamp(1.25rem, 3vw, 1.5rem);
}

h4 {
  font-size: clamp(1.125rem, 2.5vw, 1.25rem);
}

h5, h6 {
  font-size: clamp(1rem, 2vw, 1.125rem);
}

body {
  font-size: 16px; /* Minimum 16px to prevent iOS zoom */
  line-height: 1.6;
}

p {
  max-width: 75ch; /* Limit line length to 60-75 characters */
  line-height: 1.6;
  font-size: 1rem; /* Ensure minimum 16px */
}

/* Ensure readable text on mobile */
@media (max-width: 767px) {
  body {
    font-size: 16px;
  }
  
  p {
    font-size: 16px;
    line-height: 1.6;
  }
}

/* ============================================
   RESPONSIVE BUTTONS
   ============================================ */
@media (max-width: 767px) {
  button,
  .btn,
  input[type="button"],
  input[type="submit"],
  a.btn {
    width: 100%;
    max-width: 400px;
    min-height: 44px;
    padding: 0.75rem 1.5rem;
    margin: 0.5rem auto;
    display: block;
  }
  
  .btn-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
}

/* Touch target minimum size */
button,
a,
input[type="button"],
input[type="submit"],
.clickable {
  min-height: 44px;
  min-width: 44px;
}

/* ============================================
   RESPONSIVE FORMS
   ============================================ */
@media (max-width: 767px) {
  form {
    width: 100%;
  }
  
  .form-row {
    flex-direction: column;
  }
  
  .form-col {
    width: 100%;
  }
  
  input,
  textarea,
  select {
    width: 100%;
    min-height: 44px;
    font-size: 16px; /* Prevents iOS zoom */
    padding: 0.75rem;
  }
  
  label {
    display: block;
    margin-bottom: 0.5rem;
  }
}

/* Form validation styles */
.error-message,
.form-error,
.invalid-feedback {
  display: block;
  color: #DC2626;
  font-size: 0.875rem;
  margin-top: 0.25rem;
  padding: 0.5rem;
  background: #FEE2E2;
  border-left: 3px solid #DC2626;
  border-radius: 4px;
}

@media (max-width: 767px) {
  .error-message,
  .form-error,
  .invalid-feedback {
    font-size: 0.875rem;
    padding: 0.75rem;
    margin-top: 0.5rem;
  }
}

/* Input validation states */
input.error,
textarea.error,
select.error,
input:invalid,
textarea:invalid,
select:invalid {
  border-color: #DC2626;
  border-width: 2px;
}

input.success,
textarea.success,
select.success,
input:valid:not(:placeholder-shown),
textarea:valid:not(:placeholder-shown),
select:valid:not(:placeholder-shown) {
  border-color: #16A34A;
}

/* Ensure adequate color contrast for accessibility */
.error-message {
  color: #991B1B; /* Darker red for better contrast */
}

/* ============================================
   RESPONSIVE IMAGES
   ============================================ */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

picture {
  display: block;
}

/* Image aspect ratio preservation */
img.cover {
  object-fit: cover;
  width: 100%;
}

img.contain {
  object-fit: contain;
  width: 100%;
}

/* Lazy loading support */
img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.3s;
}

img[loading="lazy"].loaded,
img[loading="lazy"]:not([src=""]) {
  opacity: 1;
}

/* Responsive video containers */
.video-container {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
}

.video-container iframe,
.video-container video,
.video-container embed,
.video-container object {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Responsive media queries for images */
@media (max-width: 767px) {
  img {
    border-radius: 8px;
  }
  
  /* Ensure images don't overflow on small screens */
  img.full-width-mobile {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
  }
}

/* ============================================
   RESPONSIVE TABLES
   ============================================ */
@media (max-width: 767px) {
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Card-based table layout */
  .table-card table,
  .table-card thead,
  .table-card tbody,
  .table-card th,
  .table-card td,
  .table-card tr {
    display: block;
  }
  
  .table-card thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }
  
  .table-card tr {
    margin-bottom: 1rem;
    border: 2px solid #000;
    border-radius: 8px;
    padding: 1rem;
    background: white;
  }
  
  .table-card td {
    border: none;
    position: relative;
    padding-left: 50%;
    padding-bottom: 0.5rem;
  }
  
  .table-card td:before {
    content: attr(data-label);
    position: absolute;
    left: 1rem;
    font-weight: 600;
    white-space: nowrap;
  }
  
  /* Horizontal scroll for complex tables */
  .table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
    margin-bottom: 1rem;
  }
  
  .table-scroll table {
    min-width: 600px;
    width: 100%;
  }
  
  /* Scroll indicator shadows */
  .table-scroll:before,
  .table-scroll:after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 20px;
    pointer-events: none;
    z-index: 2;
  }
  
  .table-scroll:before {
    left: 0;
    background: linear-gradient(to right, rgba(255,255,255,1), rgba(255,255,255,0));
  }
  
  .table-scroll:after {
    right: 0;
    background: linear-gradient(to left, rgba(255,255,255,1), rgba(255,255,255,0));
  }
}

/* Sticky table headers */
.table-sticky thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.table-sticky thead th {
  background: white;
  border-bottom: 2px solid #000;
}

/* Table styling improvements */
table {
  border-collapse: collapse;
  width: 100%;
}

table th,
table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #E5E7EB;
}

table th {
  font-weight: 600;
  background: #F9FAFB;
}

@media (max-width: 767px) {
  table th,
  table td {
    padding: 0.5rem;
    font-size: 0.875rem;
  }
}

/* ============================================
   RESPONSIVE NAVIGATION
   ============================================ */

/* Mobile Menu Toggle Button (Hamburger) */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 1001;
  position: relative;
}

#mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 1001;
}

@media (max-width: 767px) {
  #mobile-menu-toggle,
  .mobile-menu-toggle {
    display: flex !important;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 24px;
  }
  
  /* Hide desktop navigation items on mobile */
  nav ul {
    display: none !important;
  }
  
  /* Keep logo and hamburger visible */
  nav > div {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
  }
}

/* Hamburger Icon Styles */
.hamburger-line {
  display: block;
  width: 100%;
  height: 3px;
  background: #000;
  border-radius: 2px;
  transition: all 0.3s ease;
  transform-origin: center;
}

.hamburger-icon {
  width: 24px;
  height: 18px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hamburger-icon span {
  display: block;
  width: 100%;
  height: 2px;
  background: #000;
  transition: all 0.3s ease;
  transform-origin: center;
}

/* Hamburger Animation when menu is active */
.mobile-menu.active .hamburger-icon span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu.active .hamburger-icon span:nth-child(2) {
  opacity: 0;
}

.mobile-menu.active .hamburger-icon span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
  display: block !important;
  opacity: 1;
}

.mobile-menu {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  width: 280px;
  max-width: 85vw;
  height: 100%;
  background: white;
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
}

.mobile-menu.active {
  display: block !important;
  transform: translateX(0) !important;
}

/* Mobile Menu Close Button */
.mobile-menu-close {
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  padding: 0.5rem;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  transition: background 0.2s;
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 10;
  line-height: 1;
}

#mobile-menu-close {
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  padding: 0.5rem;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  transition: background 0.2s;
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 10;
  line-height: 1;
}

.mobile-menu-close:hover,
#mobile-menu-close:hover {
  background: #F3F4F6;
  border-radius: 8px;
}

/* Mobile Menu Navigation Items */
.mobile-nav {
  padding: 4rem 0 2rem 0;
}

.mobile-nav-item {
  display: block;
  padding: 1rem 1.5rem;
  text-decoration: none;
  color: #000;
  font-weight: 500;
  border-bottom: 1px solid #E5E7EB;
  min-height: 44px;
  transition: background 0.2s;
  font-size: 1rem;
}

.mobile-nav-item:hover,
.mobile-nav-item:active {
  background: #F9FAFB;
}

.mobile-nav-logout {
  color: #EF4444;
}

.mobile-nav-cta {
  background: linear-gradient(90deg, #8c52ff 0%, #00bf63 100%);
  color: white !important;
  font-weight: 700;
  margin: 1rem 1.5rem;
  border-radius: 12px;
  text-align: center;
}

/* Mobile Dropdown Toggle */
.mobile-menu .dropdown-toggle {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 1rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #000;
  min-height: 44px;
  transition: background 0.2s;
}

.mobile-menu .dropdown-toggle:hover,
.mobile-menu .dropdown-toggle:active {
  background: #F9FAFB;
}

.mobile-menu .dropdown-toggle svg {
  transition: transform 0.3s ease;
}

.mobile-menu .dropdown-toggle.open svg {
  transform: rotate(90deg);
}

/* Mobile Dropdown Menu */
.mobile-menu .dropdown-menu {
  display: none;
  padding-left: 0;
  background: #F9FAFB;
  border-top: 1px solid #E5E7EB;
}

.mobile-menu .dropdown-menu.show {
  display: block !important;
}

.mobile-menu .dropdown-menu a {
  padding: 0.75rem 1rem 0.75rem 2rem;
  font-weight: 400;
  border-bottom: 1px solid #E5E7EB;
}

.mobile-menu .dropdown-menu a:last-child {
  border-bottom: none;
}

/* Body scroll lock when menu is open */
body.menu-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

/* Desktop Navigation Adjustments */
@media (min-width: 1024px) {
  .mobile-menu {
    display: none !important;
  }
  
  #mobile-menu-toggle {
    display: none !important;
  }
  
  nav.desktop-only {
    display: flex !important;
  }
}

/* Tablet Navigation Adjustments (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  /* Adjust header spacing for tablet */
  header .container {
    padding: 0 1.5rem;
  }
  
  /* Logo adjustments */
  header a[href*="home"] {
    font-size: 1.25rem !important;
  }
}

/* Desktop Navigation Spacing */
@media (min-width: 1024px) {
  header nav {
    gap: 1.5rem;
  }
  
  header nav a,
  header nav button {
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
  }
}

/* Large Desktop Navigation */
@media (min-width: 1280px) {
  header nav {
    gap: 2rem;
  }
  
  header nav a,
  header nav button {
    padding: 0.5rem 1rem;
    font-size: 1rem;
  }
}

/* ============================================
   DISABLE HOVER ON TOUCH DEVICES
   ============================================ */
@media (hover: none) {
  .hover-effect:hover {
    background: inherit;
    transform: none;
  }
}

/* ============================================
   RESPONSIVE UTILITIES
   ============================================ */

/* Text alignment */
@media (max-width: 767px) {
  .text-center-mobile {
    text-align: center;
  }
  
  .text-left-mobile {
    text-align: left;
  }
}

/* Overflow handling */
.overflow-x-auto {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Aspect ratio boxes */
.aspect-ratio-16-9 {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
}

.aspect-ratio-16-9 > * {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
  .no-print {
    display: none !important;
  }
  
  body {
    font-size: 12pt;
  }
  
  a[href]:after {
    content: " (" attr(href) ")";
  }
}


/* ============================================
   RESPONSIVE TEST INTERFACES
   ============================================ */

/* Writing Test Interface */
@media (max-width: 767px) {
  /* Stack question and answer area vertically */
  .test-layout,
  .writing-test-layout {
    flex-direction: column !important;
    gap: 1rem !important;
  }
  
  /* Make text editor full-width */
  .test-editor,
  .writing-editor,
  textarea.test-input {
    width: 100% !important;
    min-height: 300px !important;
  }
  
  /* Fixed timer header on mobile */
  .test-timer,
  .timer-header {
    position: sticky !important;
    top: 80px !important;
    z-index: 50 !important;
    background: white !important;
    padding: 0.75rem 1rem !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
  }
  
  /* Word count display */
  .word-count {
    font-size: 0.875rem !important;
    padding: 0.5rem !important;
  }
  
  /* Test navigation buttons */
  .test-nav-buttons {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background: white !important;
    padding: 1rem !important;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1) !important;
    z-index: 100 !important;
  }
  
  .test-nav-buttons button {
    width: 100% !important;
    margin-bottom: 0.5rem !important;
  }
}

/* Reading Test Interface */
@media (max-width: 767px) {
  /* Stack passage and questions vertically */
  .reading-layout {
    flex-direction: column !important;
  }
  
  /* Collapsible passage section */
  .reading-passage {
    max-height: 300px !important;
    overflow-y: auto !important;
    margin-bottom: 1rem !important;
  }
  
  .passage-toggle {
    display: block !important;
    width: 100% !important;
    padding: 0.75rem !important;
    background: #F3F4F6 !important;
    border: none !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    margin-bottom: 0.5rem !important;
  }
  
  /* Touch-friendly answer options */
  .answer-option,
  .question-option {
    min-height: 44px !important;
    padding: 0.75rem 1rem !important;
    margin-bottom: 0.5rem !important;
  }
  
  /* Navigation controls at bottom */
  .reading-nav {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background: white !important;
    padding: 1rem !important;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1) !important;
  }
}

/* Listening Test Interface */
@media (max-width: 767px) {
  /* Fixed audio player header */
  .audio-player,
  .listening-player {
    position: sticky !important;
    top: 80px !important;
    z-index: 50 !important;
    background: white !important;
    padding: 1rem !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
  }
  
  /* Stack questions vertically */
  .listening-questions {
    padding: 1rem !important;
  }
  
  /* Touch-friendly answer options */
  .listening-option {
    min-height: 44px !important;
    padding: 0.75rem 1rem !important;
  }
  
  /* Progress indicator */
  .progress-indicator {
    font-size: 0.875rem !important;
    padding: 0.5rem !important;
  }
}

/* Speaking Test Interface */
@media (max-width: 767px) {
  /* Large centered recording button */
  .recording-button {
    width: 120px !important;
    height: 120px !important;
    margin: 2rem auto !important;
    display: block !important;
  }
  
  /* Prominent timer display */
  .speaking-timer {
    font-size: 3rem !important;
    text-align: center !important;
    margin: 1rem 0 !important;
  }
  
  /* Stack question and controls vertically */
  .speaking-layout {
    flex-direction: column !important;
    text-align: center !important;
  }
  
  /* Mobile waveform visualization */
  .waveform {
    width: 100% !important;
    height: 80px !important;
  }
  
  /* Question display */
  .speaking-question {
    font-size: 1.125rem !important;
    padding: 1.5rem 1rem !important;
    text-align: center !important;
  }
}

/* General Test Interface Improvements */
@media (max-width: 767px) {
  /* Test container padding */
  .test-container {
    padding: 1rem !important;
  }
  
  /* Question numbers */
  .question-number {
    font-size: 1rem !important;
    padding: 0.5rem !important;
  }
  
  /* Submit button */
  .test-submit {
    width: 100% !important;
    padding: 1rem !important;
    font-size: 1.125rem !important;
  }
  
  /* Test instructions */
  .test-instructions {
    font-size: 0.875rem !important;
    padding: 1rem !important;
    margin-bottom: 1rem !important;
  }
  
  /* Add bottom padding to account for fixed navigation */
  .test-content {
    padding-bottom: 100px !important;
  }
}


/* ============================================
   RESPONSIVE RESULT PAGES
   ============================================ */

@media (max-width: 767px) {
  /* Stack score cards vertically */
  .result-scores,
  .score-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
  }
  
  /* Full-width score cards */
  .score-card {
    width: 100% !important;
    padding: 1.5rem !important;
    margin-bottom: 1rem !important;
  }
  
  /* Band score display */
  .band-score {
    font-size: 3rem !important;
  }
  
  /* Feedback sections full-width */
  .feedback-section {
    width: 100% !important;
    padding: 1rem !important;
    margin-bottom: 1rem !important;
  }
  
  /* Charts and graphs */
  .result-chart,
  .score-chart {
    width: 100% !important;
    height: 250px !important;
    margin: 1rem 0 !important;
  }
  
  /* Recommendation cards */
  .recommendation-card {
    width: 100% !important;
    min-height: 44px !important;
    padding: 1rem !important;
    margin-bottom: 0.75rem !important;
  }
  
  /* Result header */
  .result-header {
    padding: 1.5rem 1rem !important;
    text-align: center !important;
  }
  
  .result-title {
    font-size: 1.5rem !important;
  }
  
  /* Criteria breakdown */
  .criteria-item {
    flex-direction: column !important;
    align-items: flex-start !important;
    padding: 1rem !important;
  }
  
  .criteria-label {
    margin-bottom: 0.5rem !important;
  }
  
  /* Detailed feedback */
  .feedback-detail {
    font-size: 0.9375rem !important;
    line-height: 1.6 !important;
  }
  
  /* Action buttons */
  .result-actions {
    flex-direction: column !important;
    gap: 0.75rem !important;
  }
  
  .result-actions button,
  .result-actions a {
    width: 100% !important;
    padding: 0.875rem !important;
  }
  
  /* Progress bars */
  .progress-bar-container {
    width: 100% !important;
    margin: 0.5rem 0 !important;
  }
  
  /* Score comparison */
  .score-comparison {
    flex-direction: column !important;
    gap: 1rem !important;
  }
  
  /* Strengths and weaknesses */
  .strengths-weaknesses {
    flex-direction: column !important;
  }
  
  .strength-item,
  .weakness-item {
    width: 100% !important;
    margin-bottom: 0.75rem !important;
  }
}

/* Result page specific improvements */
@media (max-width: 767px) {
  /* Overall score card - prominent display */
  .overall-score-card {
    padding: 2rem 1rem !important;
    text-align: center !important;
  }
  
  .overall-score {
    font-size: 4rem !important;
    font-weight: 800 !important;
  }
  
  /* Skill breakdown */
  .skill-breakdown {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }
  
  /* Feedback tabs */
  .feedback-tabs {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    white-space: nowrap !important;
  }
  
  .feedback-tab {
    min-width: 120px !important;
    padding: 0.75rem 1rem !important;
  }
  
  /* Error highlights */
  .error-highlight {
    display: block !important;
    padding: 0.75rem !important;
    margin: 0.5rem 0 !important;
  }
  
  /* Sample answers */
  .sample-answer {
    font-size: 0.875rem !important;
    padding: 1rem !important;
  }
}


/* ============================================
   RESPONSIVE PRICING PAGE
   ============================================ */

@media (max-width: 767px) {
  /* Stack pricing cards vertically */
  .pricing-grid,
  .pricing-cards {
    display: flex !important;
    flex-direction: column !important;
    gap: 1.5rem !important;
  }
  
  /* Full-width pricing cards */
  .pricing-card {
    width: 100% !important;
    max-width: 100% !important;
    padding: 1.5rem !important;
    margin-bottom: 1rem !important;
  }
  
  /* Pricing header */
  .pricing-header {
    padding: 2rem 1rem !important;
    text-align: center !important;
  }
  
  .pricing-title {
    font-size: 2rem !important;
  }
  
  .pricing-subtitle {
    font-size: 1rem !important;
  }
  
  /* Price display */
  .price-amount {
    font-size: 2.5rem !important;
  }
  
  .price-currency {
    font-size: 1.5rem !important;
  }
  
  .price-period {
    font-size: 0.875rem !important;
  }
  
  /* Feature lists */
  .feature-list {
    padding: 0 !important;
    margin: 1rem 0 !important;
  }
  
  .feature-item {
    padding: 0.75rem 0 !important;
    font-size: 0.9375rem !important;
  }
  
  /* CTA buttons */
  .pricing-cta {
    width: 100% !important;
    padding: 1rem !important;
    font-size: 1.125rem !important;
    margin-top: 1rem !important;
  }
  
  /* Pricing table */
  .pricing-table {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  
  .pricing-table table {
    min-width: 600px !important;
  }
  
  /* Comparison table */
  .comparison-table {
    display: none !important; /* Hide on mobile, show cards instead */
  }
  
  .comparison-cards {
    display: block !important;
  }
  
  /* FAQ section */
  .faq-item {
    padding: 1rem !important;
    margin-bottom: 0.75rem !important;
  }
  
  .faq-question {
    font-size: 1rem !important;
    padding-right: 2rem !important;
  }
  
  .faq-answer {
    font-size: 0.9375rem !important;
    line-height: 1.6 !important;
  }
  
  /* Popular badge */
  .popular-badge {
    font-size: 0.75rem !important;
    padding: 0.375rem 0.75rem !important;
  }
  
  /* Plan features grid */
  .plan-features {
    grid-template-columns: 1fr !important;
  }
  
  /* Testimonials */
  .testimonial-card {
    width: 100% !important;
    padding: 1.5rem 1rem !important;
  }
  
  /* Money-back guarantee */
  .guarantee-badge {
    font-size: 0.875rem !important;
    padding: 0.75rem 1rem !important;
  }
}

/* Pricing page specific improvements */
@media (max-width: 767px) {
  /* Billing toggle */
  .billing-toggle {
    flex-direction: column !important;
    gap: 0.5rem !important;
    padding: 0.5rem !important;
  }
  
  .billing-option {
    width: 100% !important;
    padding: 0.75rem !important;
  }
  
  /* Savings badge */
  .savings-badge {
    position: static !important;
    display: inline-block !important;
    margin-top: 0.5rem !important;
  }
  
  /* Plan comparison */
  .plan-comparison-row {
    flex-direction: column !important;
    gap: 0.5rem !important;
  }
  
  /* Trust indicators */
  .trust-indicators {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 1rem !important;
  }
  
  .trust-item {
    flex: 0 0 calc(50% - 0.5rem) !important;
    text-align: center !important;
  }
}


/* ============================================
   RESPONSIVE FOOTER
   ============================================ */

@media (max-width: 1023px) {
  /* Footer grid - stack on tablet */
  footer > div > div:first-of-type {
    grid-template-columns: 1fr 1fr !important;
    gap: 2rem !important;
  }
  
  /* Brand column takes full width */
  footer > div > div:first-of-type > div:first-child {
    grid-column: 1 / -1 !important;
  }
}

@media (max-width: 767px) {
  /* Footer - single column on mobile */
  footer {
    padding: 3rem 0 1.5rem !important;
  }
  
  footer > div > div:first-of-type {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
    margin-bottom: 2rem !important;
  }
  
  /* Footer logo */
  footer img {
    height: 50px !important;
  }
  
  /* Footer text */
  footer p {
    font-size: 0.875rem !important;
  }
  
  /* Footer links */
  footer a {
    font-size: 0.875rem !important;
  }
  
  /* Footer headings */
  footer h6 {
    font-size: 0.8125rem !important;
    margin-bottom: 1rem !important;
  }
  
  /* Social icons */
  footer > div > div:first-child > div:last-child {
    justify-content: flex-start !important;
  }
  
  /* Footer bottom bar */
  footer > div > div:last-child {
    flex-direction: column !important;
    text-align: center !important;
    gap: 1rem !important;
  }
  
  footer > div > div:last-child p {
    font-size: 0.8125rem !important;
  }
}

/* ============================================
   RESPONSIVE HOME PAGE
   ============================================ */

@media (max-width: 767px) {
  /* Hero section */
  section:first-of-type {
    padding: 3rem 0 4rem !important;
  }
  
  /* Hero heading */
  section:first-of-type h1 {
    font-size: clamp(2rem, 8vw, 3rem) !important;
    margin-bottom: 1rem !important;
  }
  
  /* Hero subtitle */
  section:first-of-type p {
    font-size: 1rem !important;
    margin-bottom: 2rem !important;
  }
  
  /* Hero CTA button */
  section:first-of-type > div > div > div:nth-child(4) {
    margin-bottom: 2rem !important;
  }
  
  section:first-of-type > div > div > div:nth-child(4) a {
    width: 100% !important;
    max-width: 100% !important;
    justify-content: center !important;
    padding: 1rem 2rem !important;
    font-size: 1.125rem !important;
  }
  
  /* Quick navigation pills - stack on mobile */
  .quick-nav-pills {
    flex-wrap: wrap !important;
    justify-content: center !important;
    padding: 0.5rem !important;
  }
  
  .quick-nav-pills a {
    font-size: 0.8125rem !important;
    padding: 0.5rem 0.875rem !important;
    flex: 0 0 calc(50% - 0.25rem) !important;
    justify-content: center !important;
  }
  
  /* Section padding */
  section {
    padding: 3rem 0 !important;
  }
  
  /* Section headings */
  section h2 {
    font-size: 1.875rem !important;
    margin-bottom: 1rem !important;
  }
  
  section p {
    font-size: 1rem !important;
  }
  
  /* Feature sections - stack content */
  .grid-2-col {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }
  
  /* Reverse order for mobile (image first, then text) */
  .grid-2-col > div:first-child {
    order: 2;
  }
  
  .grid-2-col > div:last-child {
    order: 1;
  }
  
  /* Feature cards with icons */
  .grid-2-col > div > div:last-child {
    min-height: 300px !important;
    padding: 2rem !important;
  }
  
  .grid-2-col > div > div:last-child > div:last-child > div:first-child {
    font-size: 5rem !important;
  }
  
  /* Feature list items */
  section div[style*="display: flex"][style*="align-items: start"] {
    gap: 0.75rem !important;
  }
  
  section div[style*="display: flex"][style*="align-items: start"] strong {
    font-size: 0.9375rem !important;
  }
  
  section div[style*="display: flex"][style*="align-items: start"] p {
    font-size: 0.875rem !important;
  }
  
  /* Section buttons */
  section .btn,
  section a.btn {
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
    text-align: center !important;
    padding: 0.875rem 1.5rem !important;
  }
  
  /* Grid 3 columns - stack on mobile */
  .grid-3-col {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }
  
  /* Full test section */
  section[id="full-test"] h2 {
    font-size: 2rem !important;
  }
  
  section[id="full-test"] p {
    font-size: 1rem !important;
  }
  
  /* CTA section buttons */
  section:last-of-type div[style*="display: flex"][style*="justify-content: center"] {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.75rem !important;
  }
  
  section:last-of-type div[style*="display: flex"][style*="justify-content: center"] a {
    width: 100% !important;
    text-align: center !important;
    justify-content: center !important;
  }
}

/* Tablet adjustments (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  /* Hero section */
  section:first-of-type h1 {
    font-size: clamp(2.5rem, 6vw, 3.5rem) !important;
  }
  
  /* Quick nav pills - 2 rows on tablet */
  .quick-nav-pills {
    max-width: 600px !important;
    margin: 0 auto !important;
  }
  
  /* Grid 3 columns - 2 columns on tablet */
  .grid-3-col {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  
  /* Last item in 3-col grid spans full width */
  .grid-3-col > div:last-child:nth-child(odd) {
    grid-column: 1 / -1 !important;
    max-width: 50% !important;
    margin: 0 auto !important;
  }
}

/* ============================================
   RESPONSIVE HEADER/NAVIGATION
   ============================================ */

@media (max-width: 1023px) {
  /* Header container */
  header,
  nav {
    padding: 0.5rem 0 !important;
  }
  
  /* Navigation bar */
  nav[style*="border-radius: 100px"] {
    border-radius: 50px !important;
    padding: 0.5rem 1rem !important;
  }
  
  /* Logo size on mobile */
  nav img[alt*="Logo"] {
    height: 50px !important;
  }
}

@media (max-width: 767px) {
  /* Logo size on small mobile */
  nav img[alt*="Logo"] {
    height: 45px !important;
  }
  
  /* Sticky header adjustment */
  div[style*="position: sticky"] {
    padding: 0.5rem 0 !important;
  }
}


/* ============================================
   FIX: MOBILE MENU OVERLAY (CRITICAL)
   ============================================ */
.mobile-menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
  display: block !important;
  opacity: 1;
}

/* ============================================
   FIX: QUICK NAVIGATION PILLS ON HERO (CRITICAL)
   ============================================ */
@media (max-width: 767px) {
  /* Make quick nav pills look better on mobile */
  .quick-nav-pills {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    padding: 0.5rem !important;
    gap: 0.5rem !important;
    max-width: 100% !important;
  }
  
  .quick-nav-pills a {
    flex: 0 1 auto !important;
    font-size: 0.75rem !important;
    padding: 0.5rem 0.75rem !important;
    white-space: nowrap !important;
  }
}

/* Stack pills in 2 columns on very small screens */
@media (max-width: 375px) {
  .quick-nav-pills a {
    flex: 0 1 calc(50% - 0.25rem) !important;
    justify-content: center !important;
  }
}

/* ============================================
   FIX: DESKTOP NAVIGATION VISIBILITY (CRITICAL)
   ============================================ */
@media (min-width: 768px) {
  /* Ensure desktop nav is always visible */
  nav ul {
    display: flex !important;
  }
  
  /* Hide mobile menu elements on desktop */
  #mobile-menu-toggle,
  .mobile-menu-toggle,
  #mobile-menu,
  .mobile-menu,
  #mobile-menu-overlay,
  .mobile-menu-overlay {
    display: none !important;
  }
}

/* ============================================
   FIX: MOBILE NAVIGATION ALIGNMENT (CRITICAL)
   ============================================ */
@media (max-width: 767px) {
  /* Hide desktop navigation on mobile/tablet */
  nav ul {
    display: none !important;
  }
  
  /* Show mobile menu toggle */
  #mobile-menu-toggle,
  .mobile-menu-toggle {
    display: flex !important;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 24px;
  }
  
  /* Ensure nav container is flex */
  nav > div {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
  }
}


/* ============================================
   FIX: HAMBURGER POSITIONING (EXTREME RIGHT)
   ============================================ */
@media (max-width: 1023px) {
  /* Position hamburger on extreme right */
  #mobile-menu-toggle,
  .mobile-menu-toggle {
    margin-left: auto !important;
    position: relative !important;
    z-index: 1001 !important;
  }
  
  /* Ensure proper alignment in nav */
  nav > div > a:first-child {
    margin-right: auto !important;
  }
}

/* ============================================
   FIX: MOBILE MENU SLIDE-IN (NOT IN HEADER)
   ============================================ */
.mobile-menu {
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  width: 280px !important;
  max-width: 85vw !important;
  height: 100vh !important;
  background: white !important;
  z-index: 1000 !important;
  transform: translateX(100%) !important;
  transition: transform 0.3s ease !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1) !important;
  display: block !important;
}

.mobile-menu.active {
  transform: translateX(0) !important;
}

/* ============================================
   FIX: TOGGLE FUNCTIONALITY
   ============================================ */
/* Hamburger icon animation when active */
.mobile-menu.active ~ div nav #mobile-menu-toggle .hamburger-line:nth-child(1),
#mobile-menu-toggle.active .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu.active ~ div nav #mobile-menu-toggle .hamburger-line:nth-child(2),
#mobile-menu-toggle.active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.mobile-menu.active ~ div nav #mobile-menu-toggle .hamburger-line:nth-child(3),
#mobile-menu-toggle.active .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}


/* ============================================
   CRITICAL FIX: HEADER Z-INDEX & HAMBURGER POSITION
   ============================================ */
@media (max-width: 1023px) {
  /* Reduce header z-index so mobile menu appears ABOVE it */
  div[style*="position: sticky"][style*="z-index: 1000"] {
    z-index: 900 !important;
  }
  
  nav[style*="border-radius: 100px"] {
    position: relative !important;
    z-index: 900 !important;
  }
  
  /* Position hamburger on EXTREME RIGHT using absolute positioning */
  #mobile-menu-toggle,
  .mobile-menu-toggle {
    position: absolute !important;
    right: 1.5rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    margin: 0 !important;
    padding: 0.5rem !important;
    z-index: 1001 !important;
    background: none !important;
    border: none !important;
    cursor: pointer !important;
  }
  
  /* Ensure nav container allows absolute positioning */
  nav > div {
    position: relative !important;
  }
}

/* ============================================
   CRITICAL FIX: MOBILE MENU Z-INDEX (ABOVE HEADER)
   ============================================ */
.mobile-menu-overlay {
  z-index: 1100 !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
}

.mobile-menu {
  z-index: 1200 !important;
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: auto !important;
  width: 280px !important;
  max-width: 85vw !important;
  height: 100vh !important;
  background: white !important;
  transform: translateX(100%) !important;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  box-shadow: -4px 0 12px rgba(0, 0, 0, 0.15) !important;
}

.mobile-menu.active {
  transform: translateX(0) !important;
}

/* ============================================
   CRITICAL FIX: CLOSE BUTTON POSITIONING
   ============================================ */
.mobile-menu-close,
#mobile-menu-close {
  position: absolute !important;
  top: 1rem !important;
  right: 1rem !important;
  z-index: 10 !important;
  background: none !important;
  border: none !important;
  font-size: 2rem !important;
  line-height: 1 !important;
  cursor: pointer !important;
  padding: 0.5rem !important;
  min-width: 44px !important;
  min-height: 44px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}


/* ============================================
   FIX: BEAUTIFUL CLOSE BUTTON
   ============================================ */
.mobile-menu-close,
#mobile-menu-close {
  /* Positioning */
  position: absolute !important;
  top: 1.5rem !important;
  right: 1.5rem !important;
  z-index: 10 !important;
  
  /* Size */
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  
  /* Appearance */
  background: #F3F4F6 !important;
  border: none !important;
  border-radius: 50% !important;
  
  /* Text */
  color: #1F2937 !important;
  font-size: 1.75rem !important;
  font-weight: 300 !important;
  line-height: 1 !important;
  
  /* Layout */
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  
  /* Interaction */
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  
  /* Remove default button styles */
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  outline: none !important;
}

.mobile-menu-close:hover,
#mobile-menu-close:hover {
  background: #E5E7EB !important;
  transform: scale(1.05) !important;
}

.mobile-menu-close:active,
#mobile-menu-close:active {
  background: #D1D5DB !important;
  transform: scale(0.95) !important;
}

/* Ensure × symbol is centered */
.mobile-menu-close::before,
#mobile-menu-close::before {
  content: '×' !important;
  display: block !important;
  line-height: 1 !important;
}


/* ============================================
   FIX: ENSURE DESKTOP PAGES WORK NORMALLY
   ============================================ */

/* Only apply mobile button styles on mobile, NOT desktop */
@media (min-width: 1024px) {
  /* Reset any mobile button overrides for desktop */
  button,
  .btn,
  input[type="button"],
  input[type="submit"],
  a.btn {
    width: auto !important;
    max-width: none !important;
    min-height: auto !important;
    margin: initial !important;
    display: inline-block !important;
  }
  
  .btn-group {
    display: flex !important;
    flex-direction: row !important;
    gap: 0.5rem !important;
  }
  
  /* Ensure test navigation buttons are visible */
  .test-nav-buttons,
  .test-navigation,
  .question-navigation {
    position: static !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    background: transparent !important;
    padding: 1rem 0 !important;
    box-shadow: none !important;
    z-index: auto !important;
  }
  
  .test-nav-buttons button,
  .test-navigation button,
  .question-navigation button {
    width: auto !important;
    margin-bottom: 0 !important;
    display: inline-block !important;
  }
}

/* Ensure scrolling works on desktop */
@media (min-width: 1024px) {
  body {
    overflow: auto !important;
  }
  
  .test-container,
  .writing-test-container {
    overflow: visible !important;
  }
}


/* ============================================
   CRITICAL FIX: HIDE MOBILE MENU ON DESKTOP
   ============================================ */
@media (min-width: 1024px) {
  /* Hide ALL mobile menu elements on desktop */
  #mobile-menu-overlay,
  .mobile-menu-overlay,
  #mobile-menu,
  .mobile-menu,
  #mobile-menu-toggle,
  .mobile-menu-toggle,
  .mobile-nav,
  .mobile-nav-item {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }
}
