/* ========================================
   Responsive Utilities & Mobile-First Enhancements
   ======================================== */

/* =============================================================================
   RESPONSIVE TYPOGRAPHY
   ============================================================================= */

/* Mobile-first: smaller sizes by default */
h1, .h1 {
    font-size: 24px;
    line-height: 1.2;
}

h2, .h2 {
    font-size: 20px;
    line-height: 1.3;
}

h3, .h3 {
    font-size: 18px;
    line-height: 1.3;
}

h4, .h4 {
    font-size: 16px;
    line-height: 1.4;
}

h5, .h5,
h6, .h6 {
    font-size: 14px;
    line-height: 1.4;
}

p {
    font-size: 14px;
    line-height: 1.6;
}

small, .small {
    font-size: 12px;
}

/* Tablet and up: Scale up typography */
@media (min-width: 768px) {
    h1, .h1 {
        font-size: 28px;
    }
    h2, .h2 {
        font-size: 24px;
    }
    h3, .h3 {
        font-size: 20px;
    }
    h4, .h4 {
        font-size: 18px;
    }
    p {
        font-size: 15px;
    }
}

/* Desktop: Normal sizes */
@media (min-width: 1024px) {
    h1, .h1 {
        font-size: 32px;
    }
    h2, .h2 {
        font-size: 28px;
    }
    h3, .h3 {
        font-size: 24px;
    }
    p {
        font-size: 16px;
    }
}

/* =============================================================================
   RESPONSIVE SPACING - Mobile-first approach
   ============================================================================= */

/* Padding utilities - mobile first (smaller) */
.p-mobile      { padding: 12px; }
.pt-mobile     { padding-top: 12px; }
.pb-mobile     { padding-bottom: 12px; }
.pl-mobile     { padding-left: 12px; }
.pr-mobile     { padding-right: 12px; }
.px-mobile     { padding-left: 12px; padding-right: 12px; }
.py-mobile     { padding-top: 12px; padding-bottom: 12px; }

.p-tablet      { padding: 16px; }
.p-desktop     { padding: 24px; }

/* Margin utilities - mobile first */
.m-mobile      { margin: 12px; }
.mt-mobile     { margin-top: 12px; }
.mb-mobile     { margin-bottom: 12px; }
.ml-mobile     { margin-left: 12px; }
.mr-mobile     { margin-right: 12px; }
.mx-mobile     { margin-left: 12px; margin-right: 12px; }
.my-mobile     { margin-top: 12px; margin-bottom: 12px; }

@media (min-width: 768px) {
    .p-mobile      { padding: 16px; }
    .pt-mobile     { padding-top: 16px; }
    .pb-mobile     { padding-bottom: 16px; }
    .pl-mobile     { padding-left: 16px; }
    .pr-mobile     { padding-right: 16px; }
    .px-mobile     { padding-left: 16px; padding-right: 16px; }
    .py-mobile     { padding-top: 16px; padding-bottom: 16px; }
    
    .m-mobile      { margin: 16px; }
    .mt-mobile     { margin-top: 16px; }
    .mb-mobile     { margin-bottom: 16px; }
    .ml-mobile     { margin-left: 16px; }
    .mr-mobile     { margin-right: 16px; }
    .mx-mobile     { margin-left: 16px; margin-right: 16px; }
    .my-mobile     { margin-top: 16px; margin-bottom: 16px; }
}

/* =============================================================================
   TOUCH TARGETS - Ensure 44px+ height on mobile for accessibility
   ============================================================================= */

/* Touch-friendly button sizes on mobile only */
@media (max-width: 768px) {
    button:not(.sidebar-section-toggle):not(.sidebar-menu-toggle):not(.admin-sidebar-toggle):not(.wiz-qty-btn):not(.lang-option):not(.pricing-tab):not(.lang-tab):not(.week-cal-tab):not(.offer-tab):not(.confirm-modal-close):not(.wiz-item-modal-close),
    .btn,
    [role="button"],
    input[type="submit"],
    input[type="button"] {
        min-height: 44px;
    }
}

/* Links in nav/action areas should have adequate spacing for touch */
nav a,
.sidebar-nav a,
.action-btn {
    /* min-height: 44px; */
}

/* =============================================================================
   RESPONSIVE FLEXBOX UTILITIES
   ============================================================================= */

.flex-mobile-column {
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .flex-mobile-column {
        flex-direction: row;
    }
}

.flex-mobile-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

@media (min-width: 768px) {
    .flex-mobile-wrap {
        gap: 16px;
    }
}

/* =============================================================================
   RESPONSIVE GRID UTILITIES
   ============================================================================= */

/* 1 col on mobile, 2 on tablet, 3 on desktop */
.grid-mobile-1 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

@media (min-width: 768px) {
    .grid-mobile-1 {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

@media (min-width: 1024px) {
    .grid-mobile-1 {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

/* 1 col on mobile, 2 on tablet+ */
.grid-mobile-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

@media (min-width: 768px) {
    .grid-mobile-2 {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

/* 1 col on mobile, full-width on desktop */
.grid-mobile-3 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

@media (min-width: 1024px) {
    .grid-mobile-3 {
        grid-template-columns: auto 1fr;
        gap: 24px;
    }
}

/* =============================================================================
   RESPONSIVE VISIBILITY
   ============================================================================= */

.hide-mobile {
    display: none;
}

@media (min-width: 768px) {
    .hide-mobile {
        display: block;
    }
}

.show-mobile {
    display: block;
}

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

/* =============================================================================
   RESPONSIVE IMAGE & MEDIA
   ============================================================================= */

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.img-fluid {
    width: 100%;
    height: auto;
}

.img-cover {
    object-fit: cover;
    object-position: center;
}

.responsive-video {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: 8px;
}

.responsive-video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* =============================================================================
   RESPONSIVE OVERFLOW HANDLING
   ============================================================================= */

/* Tables and code blocks scroll on mobile */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.code-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* =============================================================================
   RESPONSIVE CARD LAYOUT
   ============================================================================= */

.card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

@media (min-width: 640px) {
    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 16px;
    }
}

@media (min-width: 1024px) {
    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 20px;
    }
}

/* =============================================================================
   RESPONSIVE MODAL ENHANCEMENTS
   ============================================================================= */

.modal-responsive {
    position: fixed;
    inset: 0;
    display: none;
    align-items: flex-end;
    justify-content: center;
    background: rgba(0,0,0,0.4);
    z-index: 100;
}

.modal-responsive.open {
    display: flex;
}

.modal-content-responsive {
    background: #fff;
    border-radius: 12px 12px 0 0;
    padding: 20px;
    width: 100%;
    max-width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Tablet and up: Center modal */
@media (min-width: 768px) {
    .modal-responsive {
        align-items: center;
        justify-content: center;
    }
    
    .modal-content-responsive {
        max-width: 600px;
        max-height: 85vh;
        border-radius: 12px;
    }
}

/* =============================================================================
   RESPONSIVE LIST/DETAIL LAYOUT
   ============================================================================= */

.list-detail-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.list-detail-sidebar {
    width: 100%;
}

.list-detail-main {
    width: 100%;
}

@media (min-width: 1024px) {
    .list-detail-layout {
        flex-direction: row;
    }
    
    .list-detail-sidebar {
        width: 300px;
        flex-shrink: 0;
    }
    
    .list-detail-main {
        flex: 1;
        min-width: 0;
    }
}

/* =============================================================================
   MICRO INTERACTIONS FOR MOBILE
   ============================================================================= */

/* Smooth scrolling for mobile */
html {
    scroll-behavior: smooth;
}

/* Reduce motion on mobile if preferred */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* =============================================================================
   RESPONSIVE FORM IMPROVEMENTS
   ============================================================================= */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
textarea,
select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 16px; /* Prevents zoom on iOS */
    line-height: 1.5;
}

/* Focus states for accessibility */
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #061D5B;
    box-shadow: 0 0 0 3px rgba(6,29,91,0.1);
}

/* =============================================================================
   GLOBAL OVERFLOW PREVENTION
   ============================================================================= */

/* Prevent horizontal scrolling on mobile — the body already has overflow-x:hidden
   in styles.css, but these help on key layout containers. */
.container,
.dashboard-main {
    max-width: 100%;
}

/* Tables scroll inside their dedicated wrapper — NOT the whole card */
.admin-table-scroll,
.history-section,
.career-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Long text doesn't break layout */
.booking-summary-value,
.admin-info-item .info-value,
.planned-moves-addr,
td {
    overflow-wrap: break-word;
    word-break: break-word;
}

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

@media print {
    body {
        background: #fff;
    }
    
    .no-print,
    .hide-on-print {
        display: none !important;
    }
}
