/* Responsive CSS for Chat Egy */

/* Tablet (768px and above) */
@media (max-width: 768px) {
  :root {
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.1);
  }

  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }
  h4 { font-size: 1.1rem; }
  h5 { font-size: 1rem; }
  h6 { font-size: 0.95rem; }

  .container {
    padding: 0 15px;
  }

  /* Navigation */
  .navbar-menu {
    gap: 1rem;
  }

  .nav-link {
    font-size: 0.9rem;
  }

  .nav-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }

  /* Hero */
  .hero {
    padding: 3rem 0;
  }

  .hero h2 {
    font-size: 2rem;
  }

  .hero p {
    font-size: 1.1rem;
  }

  .hero-actions {
    flex-direction: column;
    gap: 0.75rem;
  }

  .hero-actions .btn {
    width: 100%;
  }

  /* Topics Grid */
  .topics-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
  }

  .topic-image {
    height: 150px;
  }

  /* Modal */
  .modal-content {
    width: 95%;
    max-width: 450px;
  }

  .auth-container {
    padding: 1.5rem;
  }

  /* Dashboard Grid */
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .stat {
    font-size: 2rem;
  }

  /* Footer */
  .footer {
    padding: 2rem 0;
  }

  .footer-links {
    gap: 1rem;
  }
}

/* Mobile (576px and below) */
@media (max-width: 576px) {
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  h3 { font-size: 1.1rem; }

  .container {
    padding: 0 12px;
  }

  /* Navigation - Mobile Menu */
  .navbar .container {
    flex-wrap: wrap;
  }

  .navbar-menu {
    width: 100%;
    gap: 0.5rem;
    flex-wrap: wrap;
    order: 3;
    margin-top: 1rem;
  }

  .nav-link {
    flex: 1;
    min-width: 45%;
    text-align: center;
    font-size: 0.85rem;
    padding: 0.5rem 0.25rem;
  }

  .nav-btn {
    flex: 1;
    min-width: 45%;
    padding: 0.5rem;
    font-size: 0.8rem;
  }

  /* Hero */
  .hero {
    padding: 2rem 0;
  }

  .hero h2 {
    font-size: 1.5rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .hero-actions {
    flex-direction: column;
    gap: 0.5rem;
  }

  .hero-actions .btn {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
  }

  /* Topics Section */
  .topics-section {
    padding: 2rem 0;
  }

  .topics-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
  }

  .topics-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .topic-card {
    border-radius: 0.5rem;
  }

  .topic-image {
    height: 120px;
    font-size: 2rem;
  }

  .topic-content {
    padding: 1rem;
  }

  .topic-title {
    font-size: 1.1rem;
  }

  .topic-description {
    font-size: 0.85rem;
  }

  .topic-actions {
    gap: 0.25rem;
  }

  .topic-btn {
    padding: 0.5rem;
    font-size: 0.8rem;
  }

  /* Modal */
  .modal-content {
    width: 98%;
    max-width: 100%;
    border-radius: 0.75rem;
    max-height: 90vh;
    overflow-y: auto;
  }

  .modal-close {
    top: 0.5rem;
    left: 0.5rem;
    font-size: 1.5rem;
  }

  .auth-container {
    padding: 1.25rem;
  }

  .auth-tabs {
    gap: 0.5rem;
    margin-bottom: 1.5rem;
  }

  .auth-tab {
    flex: 1;
    padding: 0.5rem;
    font-size: 0.9rem;
  }

  .auth-form input,
  .auth-form textarea {
    padding: 0.6rem;
    margin-bottom: 0.75rem;
    font-size: 16px; /* Prevents zoom on iOS */
  }

  /* Buttons */
  .btn {
    padding: 0.7rem 1.25rem;
    font-size: 0.95rem;
  }

  /* Dashboard */
  .user-dashboard {
    padding: 2rem 0;
  }

  .user-dashboard h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
  }

  .dashboard-card {
    padding: 1.5rem;
    border-radius: 0.5rem;
  }

  .dashboard-card h3 {
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
  }

  .stat {
    font-size: 2rem;
  }

  /* Footer */
  .footer {
    padding: 1.5rem 0;
    font-size: 0.9rem;
  }

  .footer p {
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
  }

  .footer-links {
    flex-direction: column;
    gap: 0.75rem;
    font-size: 0.85rem;
  }

  .footer-links a {
    display: block;
  }

  /* Typography */
  p {
    margin-bottom: 0.75rem;
  }

  /* Utility spacing */
  .mb-1 { margin-bottom: 0.25rem; }
  .mb-2 { margin-bottom: 0.5rem; }
  .mb-3 { margin-bottom: 1rem; }
  .mt-1 { margin-top: 0.25rem; }
  .mt-2 { margin-top: 0.5rem; }
  .mt-3 { margin-top: 1rem; }
}

/* Extra Small (360px and below) */
@media (max-width: 360px) {
  h1 { font-size: 1.25rem; }
  h2 { font-size: 1.1rem; }
  h3 { font-size: 1rem; }

  .container {
    padding: 0 10px;
  }

  .navbar-menu {
    margin-top: 0.75rem;
  }

  .nav-link {
    font-size: 0.75rem;
  }

  .nav-btn {
    font-size: 0.75rem;
    padding: 0.4rem 0.6rem;
  }

  .hero h2 {
    font-size: 1.25rem;
  }

  .hero p {
    font-size: 0.95rem;
  }

  .topics-grid {
    gap: 0.75rem;
  }

  .topic-image {
    height: 100px;
  }

  .stat {
    font-size: 1.75rem;
  }
}

/* Landscape Mode */
@media (max-height: 600px) and (orientation: landscape) {
  .hero {
    padding: 2rem 0;
  }

  .hero h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
  }

  .hero p {
    font-size: 0.95rem;
    margin-bottom: 1rem;
  }

  .modal-content {
    max-height: 90vh;
    overflow-y: auto;
  }
}

/* Touch Devices Optimization */
@media (hover: none) and (pointer: coarse) {
  .btn,
  .nav-btn,
  .auth-tab,
  .topic-btn,
  .nav-link {
    padding: 0.75rem 1.25rem;
    min-height: 44px;
    min-width: 44px;
  }

  .topic-card:active {
    transform: scale(0.98);
  }

  .btn:active {
    transform: scale(0.95);
  }

  input:focus,
  textarea:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
  }
}

/* Print Styles */
@media print {
  .navbar,
  .footer,
  .auth-modal,
  .hero-actions {
    display: none;
  }

  .topic-card {
    page-break-inside: avoid;
  }

  .topic-actions {
    display: none;
  }
}

/* Accessibility: Prefers Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  body {
    background-color: var(--dark-bg);
    color: #f3f4f6;
  }

  .topic-card,
  .auth-container,
  .modal-content,
  .dashboard-card {
    background-color: #374151;
    color: #f3f4f6;
  }

  .auth-form input,
  .auth-form textarea {
    background-color: #4b5563;
    border-color: #555;
    color: #f3f4f6;
  }

  .topic-description,
  p {
    color: #d1d5db;
  }

  .alert-success {
    background-color: #064e3b;
    color: #d1fae5;
  }

  .alert-error {
    background-color: #7f1d1d;
    color: #fee2e2;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: more) {
  .btn,
  .nav-btn {
    border: 2px solid currentColor;
  }

  .topic-card,
  .dashboard-card {
    border: 2px solid currentColor;
  }
}
