/**
 * MAKTOUB Responsive Styles
 * Version: 1.0.0
 * Author: WEBDEV
 *
 * WD-055 to WD-061: Complete Responsive Implementation
 *
 * Breakpoints:
 * - Mobile: < 768px
 * - Tablet: 768px - 1023px
 * - Desktop: >= 1024px
 *
 * Contents:
 * 1. Mobile Navigation (WD-055)
 * 2. Responsive Landing Page (WD-056)
 * 3. Responsive Auth Pages (WD-057)
 * 4. Responsive Account Pages (WD-058)
 * 5. Responsive Payment Flow (WD-059)
 * 6. Touch Interactions (WD-060)
 * 7. Mobile Bottom Navigation (WD-061)
 */

/* ========================================
 * 1. MOBILE NAVIGATION (WD-055)
 * ======================================== */

/* Hamburger Menu */
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  gap: 5px;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--text);
  transition: all var(--transition-fast);
  transform-origin: center;
}

.hamburger.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

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

.hamburger.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile Menu */
.mobile-menu {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--white);
  z-index: var(--z-modal);
  transform: translateX(100%);
  transition: transform var(--transition-base);
  overflow-y: auto;
  padding: var(--space-xl);
}

[dir="rtl"] .mobile-menu {
  transform: translateX(-100%);
}

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

.mobile-menu-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.mobile-menu-nav .nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
}

.mobile-menu-nav .nav-item:active {
  background-color: var(--brand-light);
}

.mobile-menu-nav .nav-item.active {
  background-color: var(--brand);
  color: var(--white);
}

.mobile-menu-divider {
  height: 1px;
  background-color: var(--border);
  margin: var(--space-md) 0;
}

/* Header responsive */
@media (max-width: 767px) {
  .header-inner {
    padding: 0 var(--space-md);
  }

  .header .logo img {
    height: 32px;
  }

  .header .nav-desktop {
    display: none;
  }
}

@media (min-width: 768px) {
  .hamburger {
    display: none;
  }

  .mobile-menu {
    display: none;
  }
}

/* ========================================
 * 2. RESPONSIVE LANDING PAGE (WD-056)
 * ======================================== */

@media (max-width: 767px) {
  /* Hero Section */
  .hero {
    padding: var(--space-xl) 0;
    text-align: center;
  }

  .hero-title {
    font-size: var(--text-2xl);
    line-height: 1.3;
  }

  .hero-description {
    font-size: var(--text-base);
    padding: 0 var(--space-md);
  }

  .hero-actions {
    flex-direction: column;
    width: 100%;
    padding: 0 var(--space-md);
  }

  .hero-actions .btn {
    width: 100%;
  }

  /* Features Section */
  .feature-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .feature-card {
    padding: var(--space-lg);
  }

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

  .feature-icon svg {
    width: 24px;
    height: 24px;
  }

  /* How It Works */
  .how-it-works-item {
    flex-direction: column;
    text-align: center;
    gap: var(--space-md);
  }

  /* Pricing Section */
  .pricing-grid {
    grid-template-columns: 1fr;
  }

  .pricing-card.popular {
    order: -1;
  }

  /* Testimonials */
  .testimonials-grid {
    grid-template-columns: 1fr;
  }

  /* FAQ Section - Collapsible */
  .faq-list {
    padding: 0 var(--space-md);
  }

  .faq-question {
    font-size: var(--text-sm);
    padding: var(--space-md) 0;
  }

  .faq-answer {
    font-size: var(--text-sm);
    padding-bottom: var(--space-md);
  }

  /* Section Headers */
  .section-header {
    padding: 0 var(--space-md);
  }

  .section-title {
    font-size: var(--text-xl);
  }

  .section-description {
    font-size: var(--text-sm);
  }

  /* Footer */
  .footer-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .footer-brand {
    max-width: 100%;
  }

  .footer-social {
    justify-content: center;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .hero-title {
    font-size: var(--text-3xl);
  }

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

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

/* ========================================
 * 3. RESPONSIVE AUTH PAGES (WD-057)
 * ======================================== */

@media (max-width: 767px) {
  .auth-layout {
    min-height: 100vh;
  }

  .auth-form-section {
    padding: var(--space-lg);
    padding-top: var(--space-xl);
  }

  .auth-form-container {
    max-width: 100%;
  }

  .auth-header {
    margin-bottom: var(--space-xl);
    text-align: center;
  }

  .auth-title {
    font-size: var(--text-2xl);
  }

  .auth-subtitle {
    font-size: var(--text-sm);
  }

  /* Hide visual section on mobile */
  .auth-visual-section {
    display: none !important;
  }

  /* Full-width form inputs */
  .auth-form .form-input {
    font-size: 16px; /* Prevent zoom on iOS */
  }

  /* Social buttons */
  .auth-social-buttons {
    gap: var(--space-sm);
  }

  .auth-social-buttons .btn {
    font-size: var(--text-sm);
    padding: var(--space-md);
  }

  /* Phone input */
  .phone-input-group {
    flex-direction: row;
  }

  .phone-country-code {
    width: 90px;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .auth-form-section {
    max-width: 100%;
    padding: var(--space-2xl);
  }

  .auth-visual-section {
    display: none;
  }

  .auth-form-container {
    max-width: 400px;
  }
}

/* ========================================
 * 4. RESPONSIVE ACCOUNT PAGES (WD-058)
 * ======================================== */

@media (max-width: 767px) {
  .account-layout {
    flex-direction: column;
  }

  /* Hide sidebar on mobile (use bottom nav) */
  .account-sidebar {
    display: none;
  }

  .account-content {
    padding: var(--space-md);
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
  }

  /* Page header */
  .account-page-header {
    margin-bottom: var(--space-lg);
  }

  .account-page-title {
    font-size: var(--text-xl);
  }

  .account-page-subtitle {
    font-size: var(--text-sm);
  }

  /* Section titles */
  .account-section-title {
    font-size: var(--text-base);
  }

  /* Quick actions */
  .quick-actions {
    grid-template-columns: repeat(2, 1fr);
  }

  .quick-action {
    padding: var(--space-md);
  }

  .quick-action-icon {
    width: 40px;
    height: 40px;
  }

  .quick-action-label {
    font-size: var(--text-xs);
  }

  /* Cards */
  .card {
    border-radius: var(--radius-lg);
  }

  /* Welcome card */
  .welcome-card {
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
  }

  .welcome-name {
    font-size: var(--text-xl);
  }

  /* Address cards */
  .address-list {
    gap: var(--space-sm);
  }

  .address-card {
    padding: var(--space-md);
  }

  /* Subscription details */
  .subscription-details-grid {
    flex-direction: column;
  }

  /* Data tables - horizontal scroll */
  .table-responsive {
    margin: 0 calc(-1 * var(--space-md));
    padding: 0 var(--space-md);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .data-table {
    min-width: 500px;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .account-content {
    padding: var(--space-lg);
  }

  /* Collapsible sidebar */
  .account-sidebar {
    position: fixed;
    top: var(--header-height);
    right: 0;
    width: 280px;
    height: calc(100vh - var(--header-height));
    background-color: var(--white);
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    transition: transform var(--transition-base);
    z-index: var(--z-modal);
  }

  [dir="rtl"] .account-sidebar {
    right: auto;
    left: 0;
    transform: translateX(-100%);
  }

  .account-sidebar.open {
    transform: translateX(0);
  }

  .quick-actions {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ========================================
 * 5. RESPONSIVE PAYMENT FLOW (WD-059)
 * ======================================== */

@media (max-width: 767px) {
  .payment-layout {
    padding: var(--space-md);
  }

  .payment-container {
    padding: 0;
  }

  /* Stepper - full width */
  .payment-stepper {
    margin-bottom: var(--space-xl);
  }

  .stepper {
    gap: var(--space-xs);
  }

  .step {
    padding: var(--space-xs);
  }

  .step-number {
    width: 28px;
    height: 28px;
    font-size: var(--text-xs);
  }

  .step-title {
    font-size: var(--text-xs);
  }

  .step-connector {
    display: none;
  }

  /* Payment card */
  .payment-card {
    padding: var(--space-lg);
  }

  .payment-card-title {
    font-size: var(--text-lg);
  }

  /* Plan options - stack */
  .plan-options {
    grid-template-columns: 1fr;
  }

  .plan-option {
    padding: var(--space-md);
  }

  /* Order summary */
  .order-summary {
    margin-top: var(--space-md);
    padding: var(--space-md);
  }

  /* Payment buttons */
  .payment-card-footer {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .payment-card-footer .btn {
    width: 100%;
  }

  /* TAP card input */
  .tap-card-container {
    padding: var(--space-md);
  }

  /* Success page */
  .success-card {
    padding: var(--space-xl);
  }

  .success-icon {
    width: 64px;
    height: 64px;
  }

  .success-title {
    font-size: var(--text-xl);
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .payment-container {
    max-width: 600px;
  }
}

/* ========================================
 * 6. TOUCH INTERACTIONS (WD-060)
 * ======================================== */

/* Touch-friendly tap targets */
@media (pointer: coarse) {
  .btn,
  .nav-item,
  .dropdown-trigger,
  .form-input,
  .form-select,
  a {
    min-height: 44px;
  }

  /* Larger checkbox/radio */
  .form-checkbox,
  .form-radio {
    width: 24px;
    height: 24px;
  }

  /* Larger close buttons */
  .modal-close,
  .toast-close {
    min-width: 44px;
    min-height: 44px;
  }
}

/* Touch feedback */
@media (hover: none) and (pointer: coarse) {
  .btn {
    transition: transform 0.1s ease, background-color 0.1s ease;
  }

  .btn:active {
    transform: scale(0.96);
  }

  .card {
    transition: transform 0.1s ease;
  }

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

  /* Remove hover effects */
  .btn:hover,
  .card:hover,
  .nav-item:hover {
    transform: none;
  }

  /* Swipe hint */
  .swipeable {
    cursor: grab;
  }

  .swipeable:active {
    cursor: grabbing;
  }
}

/* Prevent text selection on interactive elements */
.btn,
.nav-item,
.tab-button,
.filter-tab {
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Smooth scrolling for touch */
.scroll-container {
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* Hide scrollbar but keep functionality */
.hide-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.hide-scrollbar::-webkit-scrollbar {
  display: none;
}

/* ========================================
 * 7. MOBILE BOTTOM NAVIGATION (WD-061)
 * ======================================== */

/* Already defined in pages.css, additional RTL support */
[dir="rtl"] .bottom-nav-item svg {
  transform: none;
}

/* Active indicator animation */
.bottom-nav-item::after {
  content: '';
  position: absolute;
  bottom: calc(100% + var(--space-xs));
  left: 50%;
  transform: translateX(-50%) scale(0);
  width: 4px;
  height: 4px;
  background-color: var(--brand);
  border-radius: var(--radius-full);
  transition: transform var(--transition-fast);
}

.bottom-nav-item.active::after {
  transform: translateX(-50%) scale(1);
}

/* Safe area handling for notched devices */
@supports (padding: max(0px)) {
  .bottom-nav {
    padding-bottom: max(var(--space-sm), env(safe-area-inset-bottom));
  }

  .fab {
    bottom: calc(max(80px, 80px + env(safe-area-inset-bottom)));
  }
}

/* ========================================
 * 8. ADDITIONAL RESPONSIVE UTILITIES
 * ======================================== */

/* Container responsive padding */
.container,
.container-wide {
  padding-left: var(--space-md);
  padding-right: var(--space-md);
}

@media (min-width: 768px) {
  .container,
  .container-wide {
    padding-left: var(--space-lg);
    padding-right: var(--space-lg);
  }
}

@media (min-width: 1024px) {
  .container,
  .container-wide {
    padding-left: var(--space-xl);
    padding-right: var(--space-xl);
  }
}

/* Responsive spacing utilities */
@media (max-width: 767px) {
  .mb-xl-mobile {
    margin-bottom: var(--space-xl) !important;
  }

  .p-md-mobile {
    padding: var(--space-md) !important;
  }

  .gap-sm-mobile {
    gap: var(--space-sm) !important;
  }
}

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

  .text-right-mobile {
    text-align: right !important;
  }
}

/* Responsive flex utilities */
@media (max-width: 767px) {
  .flex-col-mobile {
    flex-direction: column !important;
  }

  .items-center-mobile {
    align-items: center !important;
  }

  .justify-center-mobile {
    justify-content: center !important;
  }
}

/* Responsive display utilities */
.hide-on-mobile {
  display: block;
}

.show-on-mobile {
  display: none;
}

@media (max-width: 767px) {
  .hide-on-mobile {
    display: none !important;
  }

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

/* ========================================
 * 9. PRINT STYLES
 * ======================================== */

@media print {
  .header,
  .footer,
  .bottom-nav,
  .sidebar,
  .fab,
  .btn,
  .mobile-menu {
    display: none !important;
  }

  .account-content {
    padding: 0;
  }

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

  a {
    text-decoration: none;
    color: inherit;
  }

  body {
    font-size: 12pt;
    line-height: 1.5;
  }
}
