/* =============================================
   GLOBAL MOBILE RESPONSIVE FIXES
   Covers: Public pages, Admin dashboard, Client dashboard, Login/Auth
   ============================================= */

/* --- Prevent horizontal overflow on all pages --- */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* =============================================
   TABLET (max-width: 1024px)
   ============================================= */
@media (max-width: 1024px) {

  /* Admin tabs: horizontal scroll */
  .admin-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    white-space: nowrap;
    flex-wrap: nowrap;
  }
  .admin-tabs::-webkit-scrollbar { display: none; }
  .admin-tab {
    flex-shrink: 0;
    padding: 12px 18px;
    font-size: 13px;
  }

  /* Analytics charts: single column */
  .admin-tab-content [style*="grid-template-columns:repeat(auto-fit,minmax(400px"] {
    grid-template-columns: 1fr !important;
  }
}

/* =============================================
   MOBILE LANDSCAPE / SMALL TABLET (max-width: 768px)
   ============================================= */
@media (max-width: 768px) {

  /* --- HEADER / NAV --- */
  .brand-name {
    font-size: 14px;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .brand-logo {
    width: 36px;
    height: 36px;
  }
  .header-inner {
    padding: 12px 0;
  }
  .search-dropdown {
    min-width: 260px;
    right: -40px;
  }

  /* --- ADMIN TABS --- */
  .admin-tabs {
    margin-bottom: 20px;
    gap: 0;
  }
  .admin-tab {
    padding: 10px 14px;
    font-size: 13px;
  }

  /* --- ADMIN SECTION HEADER --- */
  .section-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 12px;
  }
  .section-header h1 {
    font-size: 24px;
  }
  .card-row {
    flex-direction: column;
    gap: 12px;
  }
  .card-actions {
    width: 100%;
    justify-content: flex-start;
  }

  /* --- ADMIN ANALYTICS --- */
  /* Stats cards: single column on mobile */
  .admin-tab-content > div[style*="grid-template-columns:repeat(auto-fit,minmax(240px"] {
    grid-template-columns: 1fr !important;
  }
  /* Charts: single column */
  .admin-tab-content > div[style*="grid-template-columns:repeat(auto-fit,minmax(400px"] {
    grid-template-columns: 1fr !important;
  }
  /* Analytics filter row */
  .admin-tab-content > .card > .card-row {
    flex-direction: column;
    align-items: stretch !important;
  }

  /* --- TABLES --- */
  .table-wrap {
    margin: 0 -16px;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  .table {
    min-width: 600px;
  }
  .table th, .table td {
    padding: 10px 12px;
    font-size: 13px;
  }

  /* --- NOTIFICATIONS DROPDOWN --- */
  .notif-dropdown {
    width: 320px;
    right: -20px;
  }

  /* --- MODALS --- */
  .modal-content {
    width: 94%;
    padding: 20px;
    margin: 20px auto;
  }
  .modal-box {
    padding: 20px;
    max-width: 94%;
  }

  /* --- LOGIN / AUTH --- */
  .auth-tabs {
    flex-direction: row;
  }
  .auth-tab {
    padding: 10px 12px;
    font-size: 13px;
  }

  /* --- CLIENT DASHBOARD --- */
  .dash-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .dash-bookings-list {
    max-height: 400px;
  }
  .dash-booking-item {
    padding: 12px;
  }
  .dash-booking-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  /* --- CALENDAR (client + admin) --- */
  .month-cell {
    min-height: 70px;
    padding: 4px;
  }
  .mc-day {
    font-size: 11px;
  }
  .mc-booking {
    font-size: 9px;
    padding: 1px 4px;
  }
  .mc-status-badge {
    font-size: 8px;
    padding: 1px 4px;
  }
  .cal-cell {
    min-height: 50px;
    padding: 4px;
  }

  /* --- FOOTER --- */
  .footer-contacts {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .footer-contact-item {
    justify-content: center;
    width: 100%;
  }

  /* --- BOOKING LAYOUT --- */
  .booking-layout {
    grid-template-columns: 1fr;
  }
  .payment-breakdown-section {
    position: static;
  }

  /* --- PRODUCTS GRID --- */
  .products-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* --- PAYMENT OPTIONS --- */
  .payment-options {
    grid-template-columns: 1fr;
  }

  /* --- PHOTO GRID --- */
  .photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
  }

  /* --- CERTIFICATIONS --- */
  .certifications-grid {
    grid-template-columns: 1fr;
  }

  /* --- CLIENT GALLERY MODAL --- */
  .client-gallery-content {
    width: 95vw;
    padding: 20px 12px 12px;
    max-height: 95vh;
  }
  .client-gallery-slider {
    min-height: 200px;
    max-height: 280px;
  }
  .client-gallery-main {
    min-height: 200px;
    max-height: 280px;
  }
  .client-gallery-nav {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }
  .client-gallery-title {
    font-size: 16px;
    padding: 0 28px;
  }

  /* --- CHAT ADMIN LAYOUT --- */
  .chat-admin-layout {
    grid-template-columns: 1fr !important;
  }

  /* --- LIGHTBOX --- */
  .lightbox img {
    max-width: 95vw;
    max-height: 60vh;
  }
  .lightbox-nav {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  .lightbox-prev { left: 8px; }
  .lightbox-next { right: 8px; }
}

/* =============================================
   MOBILE PHONE (max-width: 480px)
   ============================================= */
@media (max-width: 480px) {

  /* --- GLOBAL --- */
  .container {
    padding: 0 12px;
  }
  .section {
    padding: 28px 0;
  }

  /* --- HEADER --- */
  .brand-name {
    font-size: 13px;
    max-width: 120px;
  }
  .brand-logo {
    width: 32px;
    height: 32px;
  }
  .brand {
    gap: 8px;
  }
  .header-inner {
    padding: 10px 0;
    gap: 8px;
  }
  .header-icon-btn {
    padding: 6px;
  }
  .header-icon-btn svg {
    width: 18px;
    height: 18px;
  }

  /* --- NAV DROPDOWN --- */
  .nav-dropdown {
    padding: 8px;
  }
  .nav-dropdown .nav-link {
    font-size: 14px;
    padding: 10px;
  }

  /* --- ADMIN TABS --- */
  .admin-tab {
    padding: 8px 12px;
    font-size: 12px;
  }

  /* --- ADMIN DASHBOARD HEADER --- */
  .section-header h1 {
    font-size: 20px;
  }
  .section-header p.muted {
    font-size: 13px;
  }

  /* --- ANALYTICS STATS --- */
  .admin-tab-content > div[style*="grid-template-columns:repeat(auto-fit,minmax(240px"] {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .admin-tab-content > div[style*="grid-template-columns:repeat(auto-fit,minmax(400px"] {
    gap: 12px !important;
  }

  /* --- CARDS --- */
  .card {
    padding: 14px;
    border-radius: 12px;
  }
  .card-title {
    font-size: 15px;
  }
  .card-subtitle {
    font-size: 12px;
  }

  /* --- TABLES --- */
  .table-wrap {
    margin: 0 -12px;
  }
  .table th, .table td {
    padding: 8px 10px;
    font-size: 12px;
  }
  .table th {
    font-size: 10px;
  }

  /* --- BUTTONS --- */
  .btn {
    padding: 10px 14px;
    font-size: 13px;
  }
  .btn-primary {
    min-width: auto;
    padding: 14px 24px;
    width: 100%;
  }
  .btn-hero {
    padding: 14px 24px;
    font-size: 14px;
  }

  /* --- FORMS --- */
  .field input, .field select, .field textarea {
    padding: 10px 12px;
    font-size: 14px;
  }
  .field label {
    font-size: 13px;
  }

  /* --- NOTIFICATIONS --- */
  .notif-dropdown {
    position: fixed;
    top: 56px;
    left: 8px;
    right: 8px;
    width: auto;
    max-height: 70vh;
  }

  /* --- USER MENU --- */
  .user-menu-dropdown-content {
    min-width: 180px;
  }

  /* --- SEARCH DROPDOWN --- */
  .search-dropdown {
    position: fixed;
    top: 56px;
    left: 8px;
    right: 8px;
    min-width: auto;
  }

  /* --- BOOKING SEARCH RESULT --- */
  .booking-search-result {
    min-width: auto;
    left: -60px;
    right: -10px;
  }

  /* --- LOGIN PAGE --- */
  .auth-tabs {
    gap: 0;
  }
  .auth-tab {
    padding: 8px 10px;
    font-size: 12px;
  }

  /* --- CLIENT DASHBOARD --- */
  .dash-calendar-month {
    font-size: 14px;
  }
  .cal-header-cell {
    font-size: 10px;
    padding: 6px 2px;
  }
  .month-header-cell {
    font-size: 10px;
    padding: 6px 0;
  }
  .month-cell {
    min-height: 56px;
    padding: 3px;
  }
  .mc-day {
    font-size: 10px;
    gap: 3px;
  }
  .mc-today-badge {
    font-size: 8px;
    padding: 0px 4px;
  }
  .mc-booking {
    font-size: 8px;
    padding: 1px 3px;
  }
  .mc-more {
    font-size: 8px;
  }
  .mc-slots {
    font-size: 8px;
  }

  /* Calendar view toggle */
  .cal-view-toggle {
    flex-wrap: wrap;
  }
  .cal-view-btn {
    padding: 5px 12px;
    font-size: 12px;
  }

  /* Legend */
  .dash-calendar-legend {
    gap: 10px;
    flex-wrap: wrap;
  }
  .legend-item {
    font-size: 11px;
  }

  /* --- MODALS --- */
  .modal-content {
    width: 96%;
    padding: 16px;
    margin: 12px auto;
    max-height: 90vh;
    overflow-y: auto;
  }

  /* --- FOOTER --- */
  .site-footer {
    padding: 24px 0;
  }
  .footer-logo {
    width: 56px;
    height: 56px;
  }
  .footer-brand {
    font-size: 15px;
  }
  .footer-copyright {
    font-size: 12px;
    gap: 10px;
  }
  .footer-contact-item {
    font-size: 12px;
    padding: 8px 12px;
  }

  /* --- HOMEPAGE HERO --- */
  .hero-title {
    font-size: 26px !important;
  }
  .hero-subtitle {
    font-size: 15px !important;
  }
  .hero-modern {
    padding: 36px 0;
  }

  /* --- HOMEPAGE STATS --- */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px;
  }
  .stat-card {
    padding: 12px 8px;
  }
  .stat-number {
    font-size: 28px;
  }
  .stat-label {
    font-size: 12px;
  }
  .stat-icon {
    width: 48px;
    height: 48px;
  }

  /* --- HOMEPAGE WHY CHOOSE US --- */
  .why-choose-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px;
  }
  .why-card {
    padding: 16px 12px;
  }
  .why-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
  }
  .why-icon svg {
    width: 28px;
    height: 28px;
  }
  .why-card h3 {
    font-size: 14px;
    margin-bottom: 8px;
  }
  .why-card p {
    font-size: 12px;
    line-height: 1.4;
  }

  /* --- HOMEPAGE SERVICES --- */
  .service-grid {
    gap: 10px !important;
  }
  .service-grid .service-card-wizard {
    flex: 0 1 calc(50% - 5px) !important;
    max-width: calc(50% - 5px) !important;
    min-width: 0 !important;
  }
  .service-card-wizard {
    padding: 16px 10px !important;
  }
  .service-card-wizard h4 {
    font-size: 14px !important;
  }
  .service-card-wizard p {
    font-size: 12px !important;
    line-height: 1.4 !important;
  }
  .service-icon-wizard {
    width: 44px !important;
    height: 44px !important;
    margin-bottom: 10px !important;
  }
  .service-icon-wizard svg {
    width: 22px !important;
    height: 22px !important;
  }

  /* --- SECTION HEADERS --- */
  .section-header-center h2 {
    font-size: 22px;
  }
  .section-header-center .muted {
    font-size: 14px;
  }

  /* --- CLIENT LOGOS / PYRAMID --- */
  .client-logo {
    width: calc(50% - 6px);
    min-height: 100px;
    padding: 12px 8px;
  }
  .client-logo-img {
    max-height: 80px;
  }
  .clients-row {
    gap: 8px;
  }
  .clients-pyramid {
    gap: 8px;
  }

  /* --- PHOTO GRID --- */
  .photo-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* --- SOCIAL LOGIN BUTTONS --- */
  .social-login-btn {
    font-size: 13px;
    padding: 10px 14px;
  }

  /* --- CART DROPDOWN --- */
  .cart-dropdown {
    width: 100vw;
    max-width: 100vw;
  }

  /* --- PRICING CALCULATOR --- */
  .pricing-calc-grid {
    grid-template-columns: 1fr !important;
  }

  /* --- CONTACT PAGE --- */
  .contact-grid {
    grid-template-columns: 1fr !important;
  }

  /* --- FEEDBACK CAROUSEL --- */
  .fb-carousel-track {
    min-height: 160px;
  }
  .feedback-item {
    padding: 14px;
  }
  .feedback-header strong {
    font-size: 13px;
  }
  .feedback-text {
    font-size: 12px;
  }
}

/* =============================================
   VERY SMALL PHONES (max-width: 360px)
   ============================================= */
@media (max-width: 360px) {
  .brand-name {
    font-size: 11px;
    max-width: 100px;
  }
  .brand-logo {
    width: 28px;
    height: 28px;
  }

  .admin-tab {
    padding: 7px 10px;
    font-size: 11px;
  }

  .hero-title {
    font-size: 22px !important;
  }

  .why-choose-grid {
    gap: 8px;
  }
  .why-card {
    padding: 12px 8px;
  }
  .why-card h3 {
    font-size: 13px;
  }
  .why-card p {
    font-size: 11px;
  }

  .service-card-wizard {
    padding: 12px 8px !important;
  }
  .service-card-wizard h4 {
    font-size: 13px !important;
  }
  .service-card-wizard p {
    font-size: 11px !important;
  }
  .service-icon-wizard {
    width: 38px !important;
    height: 38px !important;
  }
  .service-icon-wizard svg {
    width: 18px !important;
    height: 18px !important;
  }

  .month-cell {
    min-height: 48px;
    padding: 2px;
  }
  .mc-day {
    font-size: 9px;
  }
  .mc-booking {
    display: none;
  }
  .mc-status-badge {
    font-size: 7px;
  }

  .stat-number {
    font-size: 24px;
  }
  .stat-label {
    font-size: 11px;
  }

  .client-logo {
    width: calc(50% - 4px);
    min-height: 80px;
    padding: 8px 6px;
  }
  .client-logo-img {
    max-height: 60px;
  }
}

/* =============================================
   ANALYTICS GRID CLASSES
   ============================================= */
.analytics-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}
.analytics-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

/* =============================================
   ADMIN-SPECIFIC ANALYTICS CHART FIX
   Force charts to be responsive on mobile
   ============================================= */
@media (max-width: 768px) {
  .analytics-stats-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .analytics-charts-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  #salesChart, #bookingsChart {
    max-height: 250px;
  }
  /* Analytics filter selects */
  select#analyticsPeriod,
  select#analyticsCategory {
    width: 100%;
    min-width: 0;
  }
}

/* =============================================
   ADMIN CALENDAR VIEW FIX
   ============================================= */
@media (max-width: 768px) {
  .week-body .month-cell {
    height: 120px;
  }
  .month-body.week-body {
    grid-auto-rows: 120px;
  }
}
@media (max-width: 480px) {
  .week-body .month-cell {
    height: 90px;
  }
  .month-body.week-body {
    grid-auto-rows: 90px;
  }
}

/* =============================================
   ADMIN TABLE ROW ACTIONS
   ============================================= */
@media (max-width: 768px) {
  .row-actions {
    flex-direction: column;
    gap: 4px;
  }
  .row-actions .btn {
    width: 100%;
    justify-content: center;
    padding: 6px 10px;
    font-size: 12px;
  }
}

/* =============================================
   TRANSACTION FILTERS
   ============================================= */
@media (max-width: 768px) {
  .txn-filters {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  .txn-filters .btn-ghost {
    padding: 6px 12px;
    font-size: 12px;
  }
}

/* =============================================
   ADMIN PRICING TABLE FIX
   ============================================= */
@media (max-width: 768px) {
  .admin-table {
    min-width: 800px;
  }
  .admin-table th, .admin-table td {
    padding: 8px 10px;
    font-size: 12px;
  }
  .admin-table .price-input {
    width: 70px;
    font-size: 12px;
    padding: 4px 6px;
  }
}

/* =============================================
   CLIENT DASHBOARD SEARCH BAR FIX
   ============================================= */
@media (max-width: 480px) {
  .dash-bookings-card form > div[style*="display: flex"] {
    flex-wrap: wrap;
  }
  .dash-bookings-card form > div[style*="display: flex"] input {
    width: 100%;
    flex: 1 1 100% !important;
  }
  .dash-bookings-card form > div[style*="display: flex"] .btn {
    width: auto;
    flex: 1;
  }
}

/* =============================================
   LOGIN PAGE WIDTH FIX
   ============================================= */
@media (max-width: 480px) {
  .section > .container[style*="max-width:440px"] {
    max-width: 100% !important;
    margin: 24px auto !important;
    padding: 0 12px;
  }
}

/* =============================================
   HOMEPAGE ABOUT SECTION GRID FIX
   ============================================= */
@media (max-width: 768px) {
  .section-alt .container > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
}

/* =============================================
   TEXT CAPITALIZATION CONSISTENCY
   ============================================= */
/* Ensure all headings use proper title case */
h1, h2, h3, h4, h5, h6,
.card-title,
.section-header h1,
.section-header h2,
.section-header-center h2,
.footer-heading {
  text-transform: capitalize;
}

/* Table headers should be title case */
.table th,
.admin-table th {
  text-transform: capitalize;
}

/* Form labels should be title case */
.field label,
label {
  text-transform: capitalize;
}

/* Button text should be title case */
.btn,
.auth-tab,
.admin-tab,
.nav-link {
  text-transform: capitalize;
}

/* Service cards */
.service-card-wizard h4,
.why-card h3 {
  text-transform: capitalize;
}

/* Override for specific elements that should NOT be capitalized */
.mono,
.dash-booking-ref,
input[type="email"],
input[type="url"],
.client-logo,
code,
pre {
  text-transform: none !important;
}

/* =============================================
   PRINT-FRIENDLY: Hide non-essential on print
   ============================================= */
@media print {
  .site-header,
  .site-footer,
  .admin-tabs,
  .nav-toggle,
  .nav-dropdown,
  .chatbot-toggle,
  .chatbot-window,
  .notif-dropdown,
  .btn-danger,
  .card-actions {
    display: none !important;
  }
}
