/* ============================================
   AHDS App Store - Responsive Design
   Mobile-First Approach
   ============================================ */

/* ============================================
   TABLET (768px - 1024px)
   ============================================ */

@media (max-width: 1024px) {
  .navbar {
    padding: 1rem 1.5rem;
    gap: 1.5rem;
  }

  .search-container {
    max-width: 400px;
  }

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

  .hero-stats {
    gap: 2rem;
  }

  .stat-number {
    font-size: 2rem;
  }

  .apps-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
  }

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

/* ============================================
   MOBILE (< 768px)
   ============================================ */

@media (max-width: 768px) {
  /* Header & Navigation */
  .navbar {
    padding: 0.875rem 1rem;
    gap: 1rem;
    flex-wrap: wrap;
  }

  .logo {
    width: 40px;
    height: 40px;
  }

  .logo-title {
    font-size: 1.25rem;
  }

  .logo-subtitle {
    font-size: 0.65rem;
  }

  /* Search - Full Width on Mobile */
  .search-container {
    order: 3;
    flex: 1 1 100%;
    max-width: 100%;
    margin-top: 0.5rem;
  }

  .search-box {
    padding: 0.75rem 2.5rem 0.75rem 2.5rem;
    font-size: 0.9375rem;
  }

  .search-icon {
    left: 0.75rem;
    font-size: 1.125rem;
  }

  .clear-search {
    right: 0.75rem;
    font-size: 1.125rem;
  }

  /* Header Actions */
  .header-actions {
    gap: 0.5rem;
  }

  .theme-toggle {
    width: 40px;
    height: 40px;
    font-size: 1.125rem;
  }

  .admin-btn {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
  }

  .admin-btn span {
    display: none;
  }

  .admin-btn i {
    margin: 0;
  }

  /* Mobile Menu Toggle */
  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Hero Section */
  .hero {
    padding: 3rem 1rem;
  }

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

  .hero-subtitle {
    font-size: 1rem;
    margin-bottom: 1.5rem;
  }

  .hero-stats {
    flex-direction: column;
    gap: 1.5rem;
  }

  .stat-number {
    font-size: 2rem;
  }

  .stat-label {
    font-size: 0.8125rem;
  }

  /* Category Section */
  .category-section {
    margin: 1.5rem auto;
    padding: 0 1rem;
  }

  .category-chips {
    gap: 0.5rem;
    padding: 0.5rem 0;
  }

  .category-chip {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
  }

  .category-chip i {
    font-size: 0.875rem;
  }

  /* Sections */
  .featured-section,
  .apps-section {
    margin: 2rem auto;
    padding: 0 1rem;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
  }

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

  .section-title i {
    font-size: 1.25rem;
  }

  .view-all-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    align-self: flex-start;
  }

  /* App Grid - Single Column on Mobile */
  .apps-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* App Cards */
  .app-card {
    padding: 1.25rem;
  }

  .app-card-header {
    gap: 0.875rem;
  }

  .app-icon {
    width: 56px;
    height: 56px;
  }

  .app-name {
    font-size: 1rem;
  }

  .app-developer {
    font-size: 0.8125rem;
  }

  .app-description {
    font-size: 0.8125rem;
    -webkit-line-clamp: 3;
  }

  .app-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .app-category {
    padding: 0.375rem 0.625rem;
    font-size: 0.6875rem;
  }

  .app-version {
    font-size: 0.6875rem;
  }

  .featured-badge {
    top: 0.75rem;
    right: 0.75rem;
    padding: 0.3125rem 0.625rem;
    font-size: 0.6875rem;
  }

  /* Loading State */
  .loading-container {
    padding: 3rem 1rem;
  }

  .spinner {
    width: 50px;
    height: 50px;
    border-width: 3px;
  }

  .loading-text {
    font-size: 1rem;
  }

  /* Empty State */
  .empty-state {
    padding: 3rem 1rem;
  }

  .empty-icon {
    font-size: 4rem;
  }

  .empty-title {
    font-size: 1.25rem;
  }

  .empty-message {
    font-size: 0.875rem;
  }

  /* Footer */
  .footer {
    padding: 2rem 1rem 1.5rem;
    margin-top: 3rem;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    text-align: center;
  }

  .footer-section h3 {
    font-size: 1rem;
  }

  .footer-section p,
  .footer-section a {
    font-size: 0.8125rem;
  }

  .footer-bottom {
    padding-top: 1.5rem;
    font-size: 0.8125rem;
  }

  /* Toast Notifications */
  .toast-container {
    top: 4rem;
    right: 1rem;
    left: 1rem;
  }

  .toast {
    min-width: auto;
    width: 100%;
    padding: 0.875rem 1rem;
  }

  .toast-icon {
    font-size: 1.25rem;
  }

  .toast-message {
    font-size: 0.8125rem;
  }

  .toast-close {
    font-size: 1.125rem;
  }
}

/* ============================================
   SMALL MOBILE (< 480px)
   ============================================ */

@media (max-width: 480px) {
  .hero-title {
    font-size: 1.75rem;
  }

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

  .stat-number {
    font-size: 1.75rem;
  }

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

  .app-card {
    padding: 1rem;
  }

  .app-icon {
    width: 48px;
    height: 48px;
  }

  .app-name {
    font-size: 0.9375rem;
  }
}

/* ============================================
   LANDSCAPE MOBILE
   ============================================ */

@media (max-width: 768px) and (orientation: landscape) {
  .hero {
    padding: 2rem 1rem;
  }

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

  .hero-subtitle {
    font-size: 0.9375rem;
    margin-bottom: 1rem;
  }

  .hero-stats {
    flex-direction: row;
    gap: 2rem;
  }

  .stat-number {
    font-size: 1.5rem;
  }

  .apps-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================
   LARGE DESKTOP (> 1400px)
   ============================================ */

@media (min-width: 1400px) {
  .apps-grid {
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  }

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

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

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */

@media (hover: none) and (pointer: coarse) {
  /* Larger touch targets */
  .category-chip {
    padding: 0.75rem 1.25rem;
    min-height: 44px;
  }

  .theme-toggle,
  .admin-btn {
    min-height: 44px;
    min-width: 44px;
  }

  /* Remove hover effects on touch devices */
  .app-card:hover {
    transform: none;
  }

  .app-card:active {
    transform: scale(0.98);
  }

  .category-chip:hover {
    transform: none;
  }

  .category-chip:active {
    transform: scale(0.95);
  }

  /* Disable rotation on touch */
  .logo-section:hover {
    transform: none;
  }

  .theme-toggle:hover {
    transform: none;
  }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  .header,
  .hero,
  .category-section,
  .footer,
  .theme-toggle,
  .admin-btn,
  .toast-container {
    display: none;
  }

  .app-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
  }

  body {
    background: white;
    color: black;
  }
}

/* ============================================
   REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .hero::before {
    animation: none;
  }

  .featured-badge {
    animation: none;
  }
}

/* ============================================
   STORE APP SECTION RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
  .store-app-content {
    gap: 1.5rem;
  }

  .store-app-icon {
    width: 80px;
    height: 80px;
  }

  .store-app-title {
    font-size: 1.5rem;
  }

  .download-store-btn {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
  }
}

@media (max-width: 768px) {
  .store-app-card {
    padding: 2rem 1.5rem;
  }

  .store-app-content {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 1.5rem;
  }

  .store-app-icon {
    margin: 0 auto;
  }

  .store-app-info {
    text-align: center;
  }

  .store-app-description {
    max-width: 100%;
  }

  .store-app-meta {
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
  }

  .store-app-action {
    justify-content: center;
  }

  .download-store-btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .store-app-card {
    padding: 1.5rem 1rem;
  }

  .store-app-header {
    flex-direction: column;
    text-align: center;
  }

  .store-app-title {
    font-size: 1.25rem;
    flex-direction: column;
    gap: 0.5rem;
  }

  .store-app-description {
    font-size: 0.9rem;
  }

  .store-download-label {
    font-size: 0.9rem;
    justify-content: center;
  }

  .store-download-buttons {
    grid-template-columns: 1fr;
  }

  .store-download-btn {
    padding: 1rem;
  }

  .store-download-btn .btn-icon {
    width: 40px;
    height: 40px;
  }

  .store-download-btn .btn-icon i {
    font-size: 1.25rem;
  }

  .store-download-btn .btn-title {
    font-size: 1rem;
  }

  .store-download-btn .btn-subtitle {
    font-size: 0.8rem;
  }
}

/* ============================================
   HIGH CONTRAST MODE
   ============================================ */

@media (prefers-contrast: high) {
  .app-card {
    border: 2px solid var(--border-color);
  }

  .category-chip {
    border-width: 3px;
  }

  .search-box {
    border-width: 3px;
  }
}
