/* Mobile App-like Styles */

/* Mobile-first viewport and touch optimizations */
@media (max-width: 768px) {

  /* Fix body and html for bottom nav */
  html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
  }

  body {
    position: relative;
  }

  /* Touch-friendly interactions */
  * {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    -webkit-touch-callout: none;
  }
  
  
  /* App-like sections with spacing */
  .section {
    padding: 24px 0;
    margin-bottom: 0;
  }
  
  .section:not(:last-child) {
    border-bottom: 8px solid #f8f9fa;
  }
  
  /* App-like section titles */
  .section-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0;
    padding: 0 4px;
    white-space: nowrap;
  }
  
  /* Card stack styling */
  .grid {
    padding: 0 4px;
  }
  
  /* Popular classes mobile grid - 2 columns (excluding admin page) */
  #popular-classes-grid.grid-4,
  #events-grid.grid-4 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  
  /* Full-width mobile cards (exclude admin page) */
  .card,
  .class-card,
  .event-card:not(.admin-dashboard .event-card) {
    margin-bottom: 12px;
    border-radius: 16px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
    border: none;
    transition: all 0.2s ease;
  }
  
  .card:active,
  .class-card:active,
  .event-card:not(.admin-dashboard .event-card):active {
    transform: scale(0.98);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12) !important;
  }
  
  /* Improved typography for mobile */
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }
  h4 { font-size: 1.125rem; }
  
  /* Better text contrast and spacing */
  p {
    line-height: 1.5;
    margin-bottom: 16px;
  }
  
  /* Mobile navigation improvements */
  .nav-toggle {
    border: none;
    background: none;
    font-size: 1.25rem;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
  }
  
  .nav-toggle:active {
    background-color: #f0f0f0;
  }
  
  .nav-links {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    border: none;
  }
  
  /* Form improvements for mobile */
  .form-input,
  .form-textarea,
  .form-select {
    border-radius: 12px;
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    transition: all 0.2s ease;
  }
  
  .form-input:focus,
  .form-textarea:focus,
  .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
    outline: none;
  }
  
  /* Mobile hero content adjustments */
  .hero-content h1 {
    font-size: 1.75rem;
    margin-bottom: 12px;
  }
  
  .hero-content p {
    font-size: 1rem;
    margin-bottom: 20px;
  }
  
  /* Category grid - 4+4+2 layout */
  #categories .container {
    padding: 0 !important;
    max-width: 100% !important;
  }

  .categories-no-padding .container .categories-grid,
  #categories .categories-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    grid-template-rows: repeat(3, auto) !important;
    gap: 0 !important;
    padding: 20px 16px !important;
    margin: 0 !important;
    background: white;
    justify-items: center;
  }
  
  .category-item:nth-child(9) {
    grid-column: 1.5 / 2.5;
  }
  
  .category-item:nth-child(10) {
    grid-column: 2.5 / 3.5;
  }
  
  .category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 1px;
    border: none;
    background: none;
    cursor: pointer;
    transition: transform 0.2s ease;
    min-height: 60px;
  }
  
  .category-item:active {
    transform: scale(0.95);
  }
  
  /* Category icons mobile optimization */
  .category-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    margin-bottom: 6px;
    background: #f7fafc;
  }
  
  .category-item h3 {
    font-size: 11px;
    font-weight: bold;
    color: #000000;
    text-align: center;
    margin: 0;
    line-height: 1.1;
  }
  
  /* Bottom navigation - only show on mobile */
  .bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex !important;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    z-index: 9999;
    box-sizing: border-box;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
  }

  .bottom-nav.bottom-nav-single {
    justify-content: center;
  }
  
  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 4px;
    text-decoration: none;
    color: #64748b;
    transition: color 0.2s ease;
  }

  .bottom-nav-single .bottom-nav-item {
    flex: none;
    width: 80px;
  }
  
  .bottom-nav-item.active {
    color: #000;
  }
  
  .bottom-nav-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
  }
  
  .bottom-nav-label {
    font-size: 10px;
    font-weight: 500;
  }
  
  /* Hide hero arrows on mobile */
  .hero-arrows {
    display: none;
  }
  
  
  /* Add line below review count row (exclude admin page) */
  .class-card-content .review-count-row,
  .event-card-content:not(.admin-dashboard .event-card .event-content) .review-count-row {
    padding-bottom: 10px !important;
    border-bottom: 1px solid #e2e8f0 !important;
    margin-bottom: 10px !important;
  }

  .class-card-content .rating-row,
  .event-card-content:not(.admin-dashboard .event-card .event-content) .rating-row {
    margin-bottom: 4px !important;
  }

  /* Price formatting for mobile (exclude admin page) */
  .class-card-price,
  .admin-dashboard .event-price,
  .event-card-price:not(.admin-dashboard .event-card .event-price) {
    font-size: 1.125rem;
    font-weight: 700;
  }
  
  /* Mobile-specific spacing utilities */
  .mobile-px-16 { padding-left: 16px; padding-right: 16px; }
  .mobile-py-16 { padding-top: 16px; padding-bottom: 16px; }
  .mobile-mb-12 { margin-bottom: 12px; }
  .mobile-mb-16 { margin-bottom: 16px; }
  .mobile-mb-20 { margin-bottom: 20px; }
  
  /* Touch-friendly interactive elements */
  [onclick],
  [data-action],
  .clickable {
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
  }
  
  /* Smooth scrolling improvements */
  html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Remove default button styling on mobile */
  button,
  input[type="submit"],
  input[type="button"] {
    -webkit-appearance: none;
    appearance: none;
    border-radius: 12px;
  }
  
  /* Status bar and safe area handling */
  .header {
    padding-top: env(safe-area-inset-top);
  }
  
  /* App-like bottom spacing - extra padding for bottom nav */
  .footer {
    padding-bottom: calc(80px + 24px + env(safe-area-inset-bottom));
  }
  
  /* Loading states optimized for mobile */
  .loading-placeholder {
    padding: 40px 20px;
  }
  
  .spinner {
    width: 32px;
    height: 32px;
    border-width: 3px;
  }
  
  /* Mobile-optimized alerts */
  .alert {
    border-radius: 12px;
    margin: 12px 16px;
    padding: 16px;
    font-size: 0.9rem;
  }
  
  /* Swiper navigation for mobile */
  .swiper-button-next,
  .swiper-button-prev {
    display: none !important;
  }
  
  .swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    margin: 0 4px;
  }
}

/* Extra small mobile screens */
@media (max-width: 375px) {
  .container {
    padding: 0 12px;
  }
  
  .hero-content h1 {
    font-size: 1.5rem;
  }
  
  .category-item {
    padding: 16px 8px;
    border: none !important;
    outline: none !important;
  }
  
  .category-icon {
    font-size: 2rem !important;
  }
}

/* Remove margin from main content */
@media (max-width: 768px) {
  .main {
    margin-top: 0;
    padding-bottom: 80px;
  }
  
  /* Mobile hero section - short height */
  .hero-section {
    height: 180px;
    min-height: 180px;
    margin-top: 0;
  }
}

/* Landscape mobile orientation */
@media (max-width: 768px) and (orientation: landscape) {
  .hero-section {
    height: 180px;
    min-height: 180px;
  }
  
  .hero-content h1 {
    font-size: 1.5rem;
  }
  
  .hero-content p {
    font-size: 0.9rem;
  }
}

/* Event detail page - detailed description mobile styling */
@media (max-width: 768px) {
  /* Detailed description section full width on mobile */
  .detailed-description {
    width: 100vw !important;
    margin-left: calc(-50vw + 50%) !important;
    padding: 0 !important;
  }

  .detailed-description .detailed-content {
    padding: 0 !important;
    background: none !important;
    border-radius: 0 !important;
    margin-top: 0 !important;
  }

  .detailed-description .detailed-text {
    padding: 20px !important;
  }

  .detailed-description .detailed-image,
  .detailed-description #detailed-image-container {
    width: 100% !important;
    padding: 0 !important;
    display: block !important;
  }

  .detailed-description .detailed-image-item {
    width: 100% !important;
    border-radius: 0 !important;
  }

  .detailed-description .detailed-image-item img,
  .detailed-description #detailed-image-container img {
    width: 100% !important;
    height: auto !important;
    max-width: none !important;
    object-fit: cover !important;
  }

  /* Reviews section mobile optimization */
  .reviews-scroll .review-card {
    flex: 0 0 240px;
  }
  
  .review-card .review-text {
    font-size: 13px;
  }
  
  .review-card .review-image-thumb {
    width: 50px;
    height: 50px;
  }
  
  /* Hide navigation buttons on mobile */
  .reviews-nav-btn {
    display: none;
  }

  /* Footer Language Switcher - Mobile Only */
  .footer-language-switcher {
    display: flex !important;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
  }

  .footer-language-switcher .lang-link {
    background: none;
    border: none;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    padding: 8px 12px;
    transition: color 0.2s ease;
  }

  .footer-language-switcher .lang-link:hover,
  .footer-language-switcher .lang-link:active {
    color: #000;
  }
}