/* Dark Theme CSS with Block Customization Support */
:root {
  /* Dark Theme Colors */
  --color-primary: #6366F1;
  --color-primary-dark: #4F46E5;
  --color-primary-light: #818CF8;
  --color-secondary: #8B5CF6;
  --color-accent: #EC4899;
  --color-background: #0a0a0f;
  --color-surface: #12121a;
  --color-surface-elevated: #1a1a25;
  --color-text: #E2E8F0;
  --color-text-muted: #64748B;
  --color-heading: #F8FAFC;
  --color-link: #818CF8;
  --color-link-hover: #A5B4FC;
  --color-border: #2a2a3a;
  --color-border-light: #3a3a4a;
  --color-success: #10B981;
  --color-warning: #F59E0B;
  --color-error: #EF4444;
  --color-danger: #EF4444;

  /* Gradient Colors */
  --gradient-primary: linear-gradient(135deg, #6366F1 0%, #8B5CF6 50%, #EC4899 100%);
  --gradient-surface: linear-gradient(180deg, #1a1a25 0%, #12121a 100%);
  --gradient-glow: radial-gradient(ellipse at center, rgba(99,102,241,0.15) 0%, transparent 70%);

  /* Typography */
  --font-heading: 'Inter', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-size-base: 16px;
  --line-height: 1.7;
  --heading-weight: 700;

  /* Layout */
  --content-width: 1200px;
  --content-width-narrow: 800px;
  --content-width-wide: 1400px;

  /* Spacing */
  --section-padding: 80px;
  --element-spacing: 24px;
  --container-padding: 24px;
  --gap-xs: 8px;
  --gap-sm: 12px;
  --gap-md: 24px;
  --gap-lg: 48px;
  --gap-xl: 80px;

  /* Borders */
  --border-radius: 16px;
  --border-radius-sm: 8px;
  --border-radius-lg: 24px;
  --border-radius-full: 9999px;
  --border-width: 1px;

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.3);
  --shadow-glow-accent: 0 0 40px rgba(236, 72, 153, 0.3);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: var(--font-size-base); scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: var(--line-height);
  color: var(--color-text);
  background-color: var(--color-background);
  -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--heading-weight);
  color: var(--color-heading);
  line-height: 1.2;
  margin-bottom: var(--element-spacing);
}
h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }
p { margin-bottom: var(--element-spacing); }
a { color: var(--color-link); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--color-link-hover); }
img { max-width: 100%; height: auto; display: block; }

/* Layout */
.container { max-width: var(--content-width); margin: 0 auto; padding: 0 var(--container-padding); }
.main-content { min-height: calc(100vh - 200px); padding: var(--section-padding) 0; }

/* Navigation */
.navbar {
  background: var(--color-surface);
  border-bottom: var(--border-width) solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(10px);
}
.nav-wrapper { display: flex; justify-content: space-between; align-items: center; padding: 1rem 0; }
.logo { font-size: 1.5rem; font-weight: 700; color: var(--color-heading); }
.logo:hover { color: var(--color-primary); }
.nav-menu { display: flex; gap: 1.5rem; align-items: center; flex: 1; justify-content: center; }
.nav-link { font-weight: 500; color: var(--color-text); padding: 0.5rem 1rem; border-radius: var(--border-radius); }
.nav-link:hover { background: var(--color-primary); color: #fff; }

/* Nav Actions */
.nav-actions { display: flex; align-items: center; gap: 1rem; }
.nav-icon { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; color: var(--color-text); transition: var(--transition); position: relative; }
.nav-icon:hover { background: var(--color-background); color: var(--color-primary); }
.cart-count { position: absolute; top: -2px; right: -2px; background: var(--color-primary); color: #fff; font-size: 0.7rem; font-weight: 600; min-width: 18px; height: 18px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.nav-auth-link { margin-left: 0.5rem; }
.user-menu { position: relative; }
.user-menu-btn { display: flex; align-items: center; gap: 0.5rem; background: none; border: none; cursor: pointer; padding: 0.25rem; border-radius: var(--border-radius); transition: var(--transition); }
.user-menu-btn:hover { background: var(--color-background); }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--color-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 0.9rem; text-transform: uppercase; }
.user-name { color: var(--color-text); font-weight: 500; font-size: 0.9rem; }
.user-dropdown { position: absolute; top: calc(100% + 8px); right: 0; background: var(--color-surface); border: var(--border-width) solid var(--color-border); border-radius: calc(var(--border-radius) / 2); min-width: 180px; box-shadow: var(--shadow-lg); opacity: 0; visibility: hidden; transform: translateY(-10px); transition: var(--transition); z-index: 1001; }
.user-dropdown.active { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-item { display: block; width: 100%; padding: 0.75rem 1rem; text-align: left; background: none; border: none; color: var(--color-text); font-size: 0.9rem; cursor: pointer; transition: var(--transition); }
.dropdown-item:hover { background: var(--color-background); color: var(--color-primary); }
.dropdown-divider { height: 1px; background: var(--color-border); margin: 0.5rem 0; }

/* Hero Section */
.hero {
  padding: calc(var(--section-padding) * 2) 0;
  text-align: center;
  background: linear-gradient(135deg, var(--color-surface) 0%, var(--color-background) 100%);
}
.hero h1 { font-size: 3rem; margin-bottom: 1rem; }
.hero p { font-size: 1.25rem; color: var(--color-text-muted); max-width: 600px; margin: 0 auto; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  border-radius: var(--border-radius);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-link-hover); color: #fff; }
.btn-secondary { background: var(--color-secondary); color: #fff; }
.btn-outline { background: transparent; border: 2px solid var(--color-primary); color: var(--color-primary); }
.btn-outline:hover { background: var(--color-primary); color: #fff; }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.875rem; }

/* Cards */
.card {
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--border-radius);
  padding: var(--element-spacing);
  transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }

/* Posts Grid */
.posts-section { padding: var(--section-padding) 0; }
.posts-section h2 { text-align: center; margin-bottom: calc(var(--section-padding) / 2); }
.posts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--element-spacing); }

.post-card {
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--border-radius);
  overflow: hidden;
  transition: var(--transition);
}
.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.post-image { width: 100%; height: 200px; object-fit: cover; }
.post-content { padding: var(--element-spacing); }
.post-content h3 { font-size: 1.25rem; margin-bottom: 0.5rem; }
.post-content h3 a { color: var(--color-heading); }
.post-content h3 a:hover { color: var(--color-primary); }
.post-content p { color: var(--color-text-muted); font-size: 0.9rem; }

/* Single Post/Page */
.single-post, .page-content { padding: var(--section-padding) 0; }
.single-post .container, .page-content .container { max-width: 800px; }
.featured-image { width: 100%; height: 400px; object-fit: cover; border-radius: var(--border-radius); margin-bottom: var(--element-spacing); }
.post-meta { color: var(--color-text-muted); font-size: 0.9rem; margin-bottom: var(--element-spacing); }
.post-body { font-size: 1.1rem; line-height: 1.8; }
.post-body p { margin-bottom: 1.5rem; }
.post-body h2, .post-body h3 { margin-top: 2rem; }
.post-body img { border-radius: var(--border-radius); margin: 1.5rem 0; }
.post-body blockquote {
  border-left: 4px solid var(--color-primary);
  padding-left: 1.5rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: var(--color-text-muted);
}
.post-body pre {
  background: var(--color-surface);
  padding: 1rem;
  border-radius: var(--border-radius);
  overflow-x: auto;
}
.post-body code {
  background: var(--color-surface);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9rem;
}

/* Footer */
.site-footer {
  background: var(--color-surface);
  border-top: var(--border-width) solid var(--color-border);
  padding: var(--section-padding) 0;
  text-align: center;
  color: var(--color-text-muted);
}

/* ==================== SHOP & PRODUCT STYLES ==================== */
.shop-hero { padding: var(--gap-xl) 0; background: var(--gradient-surface); position: relative; overflow: hidden; }
.shop-hero::before { content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%; background: var(--gradient-glow); animation: pulse 8s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 0.5; transform: scale(1); } 50% { opacity: 0.8; transform: scale(1.1); } }
.shop-hero .container { position: relative; z-index: 1; }
.shop-hero h1 { background: var(--gradient-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; font-size: 3rem; margin-bottom: 0.5rem; }
.shop-filters { display: flex; gap: var(--gap-md); flex-wrap: wrap; margin-bottom: var(--gap-lg); }
.filter-group { display: flex; align-items: center; gap: var(--gap-sm); }
.filter-label { font-weight: 500; color: var(--color-text-muted); font-size: 0.875rem; }

/* Product Grid */
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--gap-md); }
.product-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--border-radius); overflow: hidden; transition: var(--transition); position: relative; }
.product-card:hover { transform: translateY(-8px); box-shadow: var(--shadow-glow); border-color: var(--color-primary); }
.product-badge { position: absolute; top: 1rem; left: 1rem; z-index: 2; padding: 0.35rem 0.75rem; border-radius: var(--border-radius-full); font-size: 0.75rem; font-weight: 600; backdrop-filter: blur(10px); }
.product-badge.sale { background: rgba(239, 68, 68, 0.9); color: white; }
.product-badge.new { background: rgba(16, 185, 129, 0.9); color: white; }
.product-image-wrapper { position: relative; overflow: hidden; aspect-ratio: 4/3; }
.product-image { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.product-card:hover .product-image { transform: scale(1.08); }
.product-actions { position: absolute; bottom: 0; left: 0; right: 0; padding: 1rem; background: linear-gradient(transparent, rgba(0,0,0,0.8)); transform: translateY(100%); transition: var(--transition); display: flex; gap: 0.5rem; }
.product-card:hover .product-actions { transform: translateY(0); }
.product-content { padding: 1.25rem; }
.product-category { font-size: 0.75rem; color: var(--color-primary); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
.product-title { font-size: 1.1rem; margin-bottom: 0.5rem; line-height: 1.4; }
.product-title a { color: var(--color-heading); }
.product-title a:hover { color: var(--color-primary); }
.product-price { font-size: 1.25rem; font-weight: 700; color: var(--color-primary); }
.product-price .original { font-size: 0.9rem; color: var(--color-text-muted); text-decoration: line-through; margin-right: 0.5rem; font-weight: 400; }

/* ==================== COURSE STYLES ==================== */
.courses-hero { padding: var(--gap-xl) 0; background: var(--gradient-surface); }
.courses-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--gap-md); }
.course-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--border-radius); overflow: hidden; transition: var(--transition); }
.course-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-glow); border-color: var(--color-primary); }
.course-image-wrapper { position: relative; aspect-ratio: 16/9; overflow: hidden; }
.course-image { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.course-card:hover .course-image { transform: scale(1.05); }
.course-price-badge { position: absolute; bottom: 1rem; right: 1rem; padding: 0.5rem 1rem; background: rgba(0,0,0,0.8); backdrop-filter: blur(10px); border-radius: var(--border-radius-sm); font-weight: 700; color: var(--color-primary); }
.course-price-badge.free { background: rgba(16, 185, 129, 0.9); color: white; }
.course-content { padding: 1.25rem; }
.course-meta { display: flex; gap: 1rem; margin-bottom: 0.75rem; font-size: 0.8rem; color: var(--color-text-muted); }
.course-title { font-size: 1.1rem; margin-bottom: 0.75rem; line-height: 1.4; }
.course-description { font-size: 0.9rem; color: var(--color-text-muted); margin-bottom: 1rem; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ==================== CART STYLES ==================== */
.cart-section { padding: var(--section-padding) 0; min-height: 70vh; }
.cart-layout { display: grid; grid-template-columns: 1fr 380px; gap: var(--gap-lg); }
.cart-items { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--border-radius); padding: var(--gap-md); }
.cart-item { display: flex; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--color-border); }
.cart-item:last-child { border-bottom: none; }
.cart-item-image { width: 100px; height: 100px; object-fit: cover; border-radius: var(--border-radius-sm); }
.cart-item-details { flex: 1; }
.cart-item-title { font-weight: 600; margin-bottom: 0.25rem; }
.cart-item-type { font-size: 0.8rem; color: var(--color-primary); margin-bottom: 0.5rem; }
.cart-item-price { color: var(--color-text-muted); }
.cart-item-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; }
.qty-controls { display: flex; align-items: center; gap: 0.5rem; }
.qty-btn { width: 32px; height: 32px; border: 1px solid var(--color-border); background: var(--color-background); border-radius: var(--border-radius-sm); cursor: pointer; color: var(--color-text); transition: var(--transition-fast); }
.qty-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }
.remove-btn { background: none; border: none; color: var(--color-error); cursor: pointer; font-size: 0.875rem; transition: var(--transition-fast); }
.remove-btn:hover { text-decoration: underline; }
.cart-summary { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--border-radius); padding: var(--gap-md); height: fit-content; position: sticky; top: 100px; }
.cart-summary h3 { margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--color-border); }
.summary-row { display: flex; justify-content: space-between; padding: 0.75rem 0; }
.summary-row.total { font-size: 1.25rem; font-weight: 700; color: var(--color-heading); border-top: 2px solid var(--color-border); margin-top: 0.5rem; padding-top: 1rem; }

/* ==================== AUTH STYLES ==================== */
.auth-section { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: var(--gap-lg) var(--gap-md); background: var(--gradient-surface); position: relative; }
.auth-section::before { content: ''; position: absolute; inset: 0; background: var(--gradient-glow); opacity: 0.5; }
.auth-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--border-radius-lg); padding: 2.5rem; width: 100%; max-width: 420px; position: relative; box-shadow: var(--shadow-lg); }
.auth-header { text-align: center; margin-bottom: 2rem; }
.auth-header h1 { margin-bottom: 0.5rem; }
.auth-header p { color: var(--color-text-muted); margin: 0; }
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-weight: 500; margin-bottom: 0.5rem; color: var(--color-text); }
.form-input { width: 100%; padding: 0.875rem 1rem; background: var(--color-background); border: 1px solid var(--color-border); border-radius: var(--border-radius-sm); color: var(--color-text); font-size: 1rem; transition: var(--transition-fast); }
.form-input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15); }
.form-input::placeholder { color: var(--color-text-muted); }
.auth-footer { text-align: center; margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--color-border); }
.alert { padding: 1rem; border-radius: var(--border-radius-sm); margin-bottom: 1.5rem; }
.alert-error { background: rgba(239, 68, 68, 0.1); border: 1px solid var(--color-error); color: var(--color-error); }
.alert-success { background: rgba(16, 185, 129, 0.1); border: 1px solid var(--color-success); color: var(--color-success); }

/* ==================== ACCOUNT STYLES ==================== */
.account-section { padding: var(--section-padding) 0; min-height: 70vh; }
.account-layout { display: grid; grid-template-columns: 260px 1fr; gap: var(--gap-lg); }
.account-sidebar { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--border-radius); padding: 1.5rem; height: fit-content; position: sticky; top: 100px; }
.account-nav { display: flex; flex-direction: column; gap: 0.5rem; }
.account-nav-link { padding: 0.875rem 1rem; border-radius: var(--border-radius-sm); color: var(--color-text); text-decoration: none; transition: var(--transition-fast); display: flex; align-items: center; gap: 0.75rem; }
.account-nav-link:hover { background: var(--color-background); color: var(--color-primary); }
.account-nav-link.active { background: var(--color-primary); color: white; }
.account-content { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--border-radius); padding: 2rem; }
.account-content h2 { margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--color-border); }

/* ==================== UTILITY CLASSES ==================== */
.text-center { text-align: center; }
.text-muted { color: var(--color-text-muted); }
.text-primary { color: var(--color-primary); }
.text-success { color: var(--color-success); }
.text-error { color: var(--color-error); }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.btn-full { width: 100%; justify-content: center; }
.btn-ghost { background: transparent; color: var(--color-text); border: none; }
.btn-ghost:hover { background: var(--color-background); color: var(--color-primary); }
.btn-danger { background: var(--color-error); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--color-success); color: white; }
.btn-lg { padding: 1rem 2rem; font-size: 1.1rem; }

/* Empty/Loading States */
.empty-state { text-align: center; padding: 4rem 2rem; }
.empty-state .icon { font-size: 4rem; margin-bottom: 1rem; }
.empty-state h2 { margin-bottom: 0.5rem; }
.empty-state p { color: var(--color-text-muted); margin-bottom: 2rem; max-width: 400px; margin-left: auto; margin-right: auto; }
.loading-state { text-align: center; padding: 4rem 2rem; color: var(--color-text-muted); }
.loading-spinner { width: 40px; height: 40px; border: 3px solid var(--color-border); border-top-color: var(--color-primary); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 1rem; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== MOBILE NAVIGATION (Hamburger Menu) ==================== */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--color-text);
  z-index: 1002;
}
.mobile-menu-toggle .hamburger {
  display: block;
  width: 24px;
  height: 2px;
  background: currentColor;
  position: relative;
  transition: var(--transition);
}
.mobile-menu-toggle .hamburger::before,
.mobile-menu-toggle .hamburger::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 2px;
  background: currentColor;
  left: 0;
  transition: var(--transition);
}
.mobile-menu-toggle .hamburger::before { top: -7px; }
.mobile-menu-toggle .hamburger::after { bottom: -7px; }
.mobile-menu-toggle.active .hamburger { background: transparent; }
.mobile-menu-toggle.active .hamburger::before { transform: rotate(45deg); top: 0; }
.mobile-menu-toggle.active .hamburger::after { transform: rotate(-45deg); bottom: 0; }

/* Mobile Menu Overlay */
.mobile-menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.mobile-menu-overlay.active { opacity: 1; }

/* Mobile Slide-out Menu */
.mobile-nav-menu {
  display: none;
  position: fixed;
  top: 0;
  right: -100%;
  width: 280px;
  max-width: 85vw;
  height: 100vh;
  background: var(--color-surface);
  z-index: 1001;
  transition: right 0.3s ease;
  overflow-y: auto;
  padding: 1rem 0;
  box-shadow: -5px 0 30px rgba(0, 0, 0, 0.3);
}
.mobile-nav-menu.active { right: 0; }
.mobile-nav-menu .mobile-nav-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 1rem;
}
.mobile-nav-menu .mobile-nav-close {
  background: none;
  border: none;
  color: var(--color-text);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
}
.mobile-nav-menu .mobile-nav-links {
  display: flex;
  flex-direction: column;
  padding: 0 1rem;
}
.mobile-nav-menu .mobile-nav-link {
  display: block;
  padding: 1rem 1.5rem;
  color: var(--color-text);
  font-weight: 500;
  font-size: 1rem;
  border-radius: var(--border-radius-sm);
  transition: var(--transition);
}
.mobile-nav-menu .mobile-nav-link:hover,
.mobile-nav-menu .mobile-nav-link:active {
  background: var(--color-primary);
  color: #fff;
}
.mobile-nav-menu .mobile-nav-divider {
  height: 1px;
  background: var(--color-border);
  margin: 1rem 1.5rem;
}
.mobile-nav-menu .mobile-nav-user {
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-top: 1px solid var(--color-border);
  margin-top: 1rem;
}
.mobile-nav-menu .mobile-nav-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

/* ==================== RESPONSIVE ==================== */
/* Large Tablets and small desktops */
@media (max-width: 1024px) {
  .cart-layout { grid-template-columns: 1fr; }
  .account-layout { grid-template-columns: 1fr; }
  .account-sidebar { position: static; }
  .features-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Tablets */
@media (max-width: 768px) {
  :root {
    --section-padding: 48px;
    --gap-xl: 48px;
    --container-padding: 16px;
  }
  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }

  /* Show mobile menu toggle, hide desktop nav */
  .mobile-menu-toggle { display: block; }
  .mobile-menu-overlay { display: block; }
  .mobile-nav-menu { display: block; }
  .nav-menu { display: none; }
  .nav-actions .nav-auth-link { display: none; }
  .nav-actions .btn { display: none; }
  .user-name { display: none; }

  .nav-wrapper { gap: 0.75rem; }
  .hero h1, .shop-hero h1, .courses-hero h1 { font-size: 2rem; }
  .products-grid, .courses-grid { grid-template-columns: 1fr; }
  .posts-grid { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 1.5rem; }
  .content-grid { grid-template-columns: 1fr; }

  /* Hero adjustments */
  .hero-section { min-height: auto; padding: 3rem 0; }
  .hero-content h1 { font-size: 2rem; }
  .hero-content p { font-size: 1rem; }
  .hero-buttons { flex-direction: column; }
  .hero-buttons .btn { width: 100%; justify-content: center; }
  .hero-stats { flex-wrap: wrap; gap: 1.5rem; justify-content: center; }
  .hero-stat { min-width: 80px; }

  /* Section adjustments */
  .section-header h2 { font-size: 1.75rem; }
  .feature-card { padding: 1.5rem; }
  .cta-section h2 { font-size: 1.75rem; }
}

/* Mobile phones - Galaxy A55 and similar (360-430px) */
@media (max-width: 480px) {
  :root {
    --section-padding: 32px;
    --gap-xl: 32px;
    --container-padding: 16px;
    --element-spacing: 16px;
    --border-radius: 12px;
  }

  html { font-size: 15px; }
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.35rem; }
  h3 { font-size: 1.15rem; }

  /* Navigation mobile */
  .navbar { padding: 0; }
  .nav-wrapper { padding: 0.75rem 0; }
  .logo { font-size: 1.25rem; }
  .nav-icon { width: 36px; height: 36px; }
  .user-avatar { width: 28px; height: 28px; font-size: 0.8rem; }

  /* Buttons */
  .btn { padding: 0.65rem 1.25rem; font-size: 0.9rem; }
  .btn-sm { padding: 0.5rem 0.875rem; font-size: 0.8rem; }

  /* Cards */
  .card { padding: 1rem; }
  .content-card-body { padding: 1rem; }
  .feature-card { padding: 1.25rem; }
  .feature-icon { font-size: 2rem; }

  /* Hero */
  .hero-section { padding: 2rem 0; }
  .hero-content h1 { font-size: 1.75rem; line-height: 1.2; }
  .hero-content p { font-size: 0.95rem; margin-bottom: 1.5rem; }
  .hero-stat .number { font-size: 1.5rem; }
  .hero-stat .label { font-size: 0.8rem; }

  /* Forms */
  input, select, textarea { font-size: 16px !important; } /* Prevent zoom on iOS */
  .form-group { margin-bottom: 1rem; }

  /* Course/Product cards */
  .course-card, .product-card, .post-card { border-radius: var(--border-radius); }
  .course-image, .product-image { height: 160px; }

  /* Main content padding */
  .main-content { padding: 1.5rem 0; }

  /* CTA */
  .cta-section h2 { font-size: 1.5rem; }
  .cta-section p { font-size: 0.95rem; }
}

/* Small phones (320-375px) */
@media (max-width: 375px) {
  :root {
    --container-padding: 12px;
    --section-padding: 24px;
  }

  html { font-size: 14px; }
  h1 { font-size: 1.5rem; }

  .logo { font-size: 1.1rem; }
  .hero-content h1 { font-size: 1.5rem; }
  .hero-stats { gap: 1rem; }
  .hero-stat .number { font-size: 1.25rem; }

  .btn { padding: 0.6rem 1rem; }
  .mobile-nav-menu { width: 260px; }
}

/* Touch-friendly tap targets */
@media (hover: none) and (pointer: coarse) {
  .nav-link,
  .btn,
  .dropdown-item,
  .mobile-nav-link,
  .lesson-item,
  .filter-btn {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* Increase touch targets */
  .nav-icon { min-width: 44px; min-height: 44px; }
  .user-menu-btn { min-height: 44px; }
  .mobile-menu-toggle { min-width: 44px; min-height: 44px; }
}

/* ==================== DEVICE-SPECIFIC STYLES ==================== */
/* Mobile device class (from server or client detection) */
.device-mobile .nav-menu { display: none; }
.device-mobile .mobile-menu-toggle { display: block; }
.device-mobile .mobile-menu-overlay { display: block; }
.device-mobile .mobile-nav-menu { display: block; }
.device-mobile .nav-actions .nav-auth-link { display: none; }
.device-mobile .nav-actions .btn { display: none; }
.device-mobile .user-name { display: none; }

/* Tablet device class */
.device-tablet .nav-menu { display: none; }
.device-tablet .mobile-menu-toggle { display: block; }
.device-tablet .mobile-menu-overlay { display: block; }
.device-tablet .mobile-nav-menu { display: block; }
.device-tablet .user-name { display: none; }

/* Touch device optimizations */
.touch-device .btn,
.touch-device .nav-link,
.touch-device .dropdown-item,
.touch-device .lesson-item,
.touch-device .filter-btn {
  min-height: 44px;
}

.touch-device .nav-icon {
  min-width: 44px;
  min-height: 44px;
}

/* Disable hover effects on touch devices */
.touch-device .btn:hover,
.touch-device .card:hover,
.touch-device .content-card:hover,
.touch-device .feature-card:hover {
  transform: none;
}

/* Active states for touch devices */
.touch-device .btn:active {
  transform: scale(0.98);
}

.touch-device .card:active,
.touch-device .content-card:active {
  transform: scale(0.99);
}
