/**
 * Mobile-Responsive Design Optimization
 *
 * Comprehensive mobile optimization for all templates and components
 *
 * @package DATAsoft_Escort_Core
 * @since 3.4.26
 */

/* ========================================
   Base Mobile Optimizations
   ======================================== */

@media (max-width: 1024px) {
    /* Container adjustments */
    .ds-archive-page,
    .ds-customer-dashboard,
    .ds-setcard-container {
        padding: 20px 15px !important;
    }

    /* Grid layouts */
    .ds-profiles-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
        gap: 15px !important;
    }

    /* Font sizes */
    h1 {
        font-size: 2rem !important;
    }

    h2 {
        font-size: 1.5rem !important;
    }

    h3 {
        font-size: 1.2rem !important;
    }
}

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

@media (max-width: 1024px) and (min-width: 769px) {
    /* Profile cards - 2 columns */
    .ds-profiles-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Filter sidebar */
    .ds-filters-sidebar {
        width: 250px !important;
    }

    /* Dashboard navigation */
    .ds-dashboard-nav ul {
        flex-wrap: wrap !important;
    }

    .ds-dashboard-menu-item {
        flex: 0 0 calc(33.333% - 10px) !important;
    }
}

/* ========================================
   Mobile (max-width: 768px)
   ======================================== */

@media (max-width: 768px) {
    /* ===== Archive Page ===== */
    
    /* Header */
    .archive-header h1 {
        font-size: 1.8rem !important;
        margin-bottom: 15px !important;
    }

    /* Filter sidebar - convert to dropdown/accordion */
    .ds-filters-sidebar {
        position: static !important;
        width: 100% !important;
        margin-bottom: 20px !important;
        max-height: none !important;
    }

    .ds-filter-toggle {
        display: block !important;
        width: 100%;
        padding: 15px;
        background: #667eea;
        color: #fff;
        border: none;
        border-radius: 8px;
        font-weight: 600;
        cursor: pointer;
        margin-bottom: 15px;
    }

    .ds-filters-sidebar.collapsed {
        display: none;
    }

    /* Profile grid - single column */
    .ds-profiles-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }

    /* Profile cards */
    .ds-profile-card {
        margin-bottom: 15px !important;
    }

    .ds-profile-card .profile-image {
        height: 250px !important;
    }

    /* Badges */
    .profile-badges {
        top: 5px !important;
        left: 5px !important;
        gap: 3px !important;
    }

    .profile-badges .badge {
        font-size: 0.7rem !important;
        padding: 4px 8px !important;
    }

    /* Profile info */
    .profile-info {
        padding: 15px !important;
    }

    .profile-info h3 {
        font-size: 1.1rem !important;
    }

    /* Action buttons */
    .ds-profile-card .ds-btn-view,
    .ds-comparison-btn,
    .ds-favorite-btn {
        padding: 8px 15px !important;
        font-size: 0.85rem !important;
    }

    /* ===== Single Profile (SetCard) ===== */
    
    .ds-setcard-container {
        margin: 20px 10px !important;
        border-radius: 8px !important;
    }

    .profile-header {
        padding: 20px 15px !important;
    }

    .profile-header h1 {
        font-size: 1.8rem !important;
    }

    .profile-gallery {
        grid-template-columns: 1fr !important;
    }

    .profile-main-image {
        height: 300px !important;
    }

    .profile-thumbnails {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 5px !important;
    }

    .profile-content {
        flex-direction: column !important;
    }

    .profile-main-content,
    .profile-sidebar {
        width: 100% !important;
        padding: 15px !important;
    }

    .profile-sidebar {
        margin-top: 20px !important;
    }

    /* Price grid */
    .profile-prices {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    /* Services */
    .profile-services {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .profile-extra-services {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* ===== Customer Dashboard ===== */
    
    .ds-customer-dashboard {
        padding: 15px 10px !important;
    }

    /* Dashboard header */
    .ds-customer-dashboard header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 15px !important;
    }

    .ds-customer-dashboard header > div:last-child {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .ds-customer-dashboard header .ds-btn {
        width: 100% !important;
        text-align: center;
    }

    /* Dashboard navigation */
    .ds-dashboard-nav ul {
        flex-direction: column !important;
    }

    .ds-dashboard-menu-item {
        width: 100% !important;
        border-bottom: 1px solid #e0e0e0;
    }

    .ds-dashboard-menu-item:last-child {
        border-bottom: none;
    }

    .ds-dashboard-menu-item a {
        padding: 15px 20px !important;
        display: flex;
        align-items: center;
        gap: 10px;
    }

    /* Messages */
    .ds-messages-container {
        flex-direction: column !important;
        height: auto !important;
    }

    .ds-conversations-list {
        width: 100% !important;
        max-height: 300px;
        border-right: none !important;
        border-bottom: 1px solid #e0e0e0;
    }

    .ds-chat-window {
        width: 100% !important;
        height: 500px !important;
    }

    /* Favorites grid */
    .ds-favorites-grid {
        grid-template-columns: 1fr !important;
    }

    /* Stats grid */
    .ds-stats-container > div[style*="grid"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* ===== Forms ===== */
    
    .ds-wizard-container,
    .ds-quick-registration-form {
        padding: 20px 15px !important;
    }

    .wizard-step {
        padding: 20px 15px !important;
    }

    .form-row {
        flex-direction: column !important;
    }

    .form-group {
        width: 100% !important;
        margin-bottom: 15px !important;
    }

    /* Form buttons */
    .wizard-navigation,
    .form-actions {
        flex-direction: column-reverse !important;
        gap: 10px !important;
    }

    .wizard-navigation button,
    .form-actions button {
        width: 100% !important;
    }

    /* ===== Comparison Modal ===== */
    
    .ds-comparison-modal-content {
        width: 100% !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
    }

    .ds-comparison-grid {
        grid-template-columns: 1fr !important;
    }

    /* ===== Maps ===== */
    
    #ds-map-container {
        height: 400px !important;
    }

    .ds-map-controls {
        flex-direction: column !important;
        gap: 10px !important;
    }

    /* ===== Filters ===== */
    
    .ds-filter-group {
        margin-bottom: 15px !important;
    }

    .filter-options {
        max-height: 200px !important;
    }

    /* ===== Tables ===== */
    
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .ds-booking-card table,
    .comparison-section table {
        font-size: 0.85rem !important;
    }
}

/* ========================================
   Small Mobile (max-width: 480px)
   ======================================== */

@media (max-width: 480px) {
    /* Base adjustments */
    body {
        font-size: 14px !important;
    }

    /* Headers */
    h1 {
        font-size: 1.5rem !important;
    }

    h2 {
        font-size: 1.3rem !important;
    }

    h3 {
        font-size: 1.1rem !important;
    }

    /* Buttons */
    .ds-btn,
    button {
        padding: 10px 15px !important;
        font-size: 0.9rem !important;
    }

    /* Profile cards */
    .ds-profile-card .profile-image {
        height: 200px !important;
    }

    /* Price grid - single column */
    .profile-prices {
        grid-template-columns: 1fr !important;
    }

    /* Services - single column */
    .profile-services,
    .profile-extra-services {
        grid-template-columns: 1fr !important;
    }

    /* Stats - single column */
    .ds-stats-container > div[style*="grid"] {
        grid-template-columns: 1fr !important;
    }

    /* Thumbnails - 2 columns */
    .profile-thumbnails {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Chat messages */
    .ds-message {
        max-width: 85% !important;
    }

    /* Badges */
    .ds-badge,
    .badge {
        font-size: 0.7rem !important;
        padding: 4px 8px !important;
    }

    /* Modal padding */
    .ds-modal-content {
        padding: 15px !important;
    }

    .ds-modal-header h2 {
        font-size: 1.2rem !important;
    }

    /* Comparison bar */
    .ds-comparison-bar {
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        transform: none !important;
        border-radius: 0 !important;
        padding: 10px 15px !important;
    }

    .comparison-bar-inner {
        flex-direction: column !important;
        gap: 10px !important;
    }

    .comparison-bar-actions {
        width: 100%;
        flex-direction: column !important;
    }

    .ds-btn-compare,
    .ds-btn-clear {
        width: 100% !important;
    }

    /* Form inputs */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    select,
    textarea {
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
}

/* ========================================
   Landscape Mobile
   ======================================== */

@media (max-width: 768px) and (orientation: landscape) {
    .ds-chat-window {
        height: 400px !important;
    }

    #ds-map-container {
        height: 300px !important;
    }

    .profile-main-image {
        height: 250px !important;
    }
}

/* ========================================
   Touch Optimizations
   ======================================== */

@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    button,
    a,
    input[type="checkbox"],
    input[type="radio"] {
        min-height: 44px;
        min-width: 44px;
    }

    /* Remove hover effects on touch devices */
    .ds-profile-card:hover,
    .ds-btn:hover,
    button:hover {
        transform: none !important;
    }

    /* Tap highlight */
    * {
        -webkit-tap-highlight-color: rgba(102, 126, 234, 0.2);
    }
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    /* Hide navigation and non-essential elements */
    .ds-dashboard-nav,
    .ds-filters-sidebar,
    .ds-comparison-bar,
    .ds-modal,
    button,
    .ds-btn {
        display: none !important;
    }

    /* Optimize for print */
    body {
        font-size: 12pt;
        color: #000;
        background: #fff;
    }

    .ds-profile-card,
    .ds-setcard-container {
        page-break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #000 !important;
    }
}

/* ========================================
   Accessibility Enhancements
   ======================================== */

/* Focus states for keyboard navigation */
@media (max-width: 768px) {
    *:focus {
        outline: 3px solid #667eea !important;
        outline-offset: 2px !important;
    }

    /* Skip to content link */
    .skip-to-content {
        position: absolute;
        top: -40px;
        left: 0;
        background: #667eea;
        color: #fff;
        padding: 8px 16px;
        text-decoration: none;
        z-index: 100;
    }

    .skip-to-content:focus {
        top: 0;
    }
}

/* ========================================
   Performance Optimizations
   ======================================== */

@media (max-width: 768px) {
    /* Reduce animations on mobile */
    * {
        animation-duration: 0.3s !important;
        transition-duration: 0.2s !important;
    }

    /* Lazy load images */
    img {
        loading: lazy;
    }

    /* Reduce shadows for performance */
    .ds-profile-card,
    .ds-modal-content {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    }
}


