/* ========================================
   MWG HOSTELS - MASTER RESPONSIVE FIX
   Complete responsive solution for all devices
   Author: SAMA GREAT
   Version: 2.0 Production-Ready
   ======================================== */

/* ========================================
   CRITICAL BASE FIXES
   ======================================== */

/* Prevent horizontal overflow on ALL devices */
* {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    width: 100%;
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden;
    width: 100%;
    margin: 0;
    padding: 0;
    min-width: 320px; /* Minimum supported width */
}

/* Fix for images overflowing containers */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Ensure container never exceeds viewport */
.container,
[class*="container"] {
    max-width: 100%;
    overflow-x: hidden;
}

/* ========================================
   MOBILE-FIRST BASE (320px+)
   All devices start with these styles
   ======================================== */

/* Touch-friendly minimum targets (Apple's guidelines) */
button,
a,
.btn,
[role="button"] {
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation; /* Prevents double-tap zoom */
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

/* Prevent auto-zoom on iOS when focusing inputs */
input,
select,
textarea {
    font-size: 16px !important; /* CRITICAL: Prevents iOS zoom */
    -webkit-appearance: none;
    appearance: none;
}

/* Fix iOS input/button rendering */
@supports (-webkit-touch-callout: none) {
    input,
    select,
    textarea,
    button {
        font-size: 16px !important;
    }
}

/* ========================================
   NAVIGATION RESPONSIVE FIX
   ======================================== */

/* Mobile Navigation (up to 768px) */
@media (max-width: 768px) {
    .navbar {
        padding: 0.75rem 1rem;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }
    
    .nav-container {
        flex-wrap: nowrap;
        justify-content: space-between;
        align-items: center;
    }
    
    .nav-brand {
        font-size: 1.1rem;
        flex-shrink: 0;
    }
    
    .logo {
        height: 36px;
        width: auto;
    }
    
    /* Hamburger menu button */
    .mobile-toggle,
    .mobile-menu-toggle {
        display: flex !important;
        flex-direction: column;
        gap: 4px;
        background: none;
        border: none;
        padding: 8px;
        cursor: pointer;
        z-index: 1001;
    }
    
    .mobile-toggle span,
    .mobile-menu-toggle span {
        width: 24px;
        height: 3px;
        background: var(--gray-700, #334155);
        border-radius: 2px;
        transition: all 0.3s ease;
    }
    
    /* Hamburger animation when active */
    .mobile-toggle.active span:nth-child(1),
    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    
    .mobile-toggle.active span:nth-child(2),
    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-toggle.active span:nth-child(3),
    .mobile-menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }
    
    /* Mobile menu dropdown */
    .nav-menu {
        position: fixed;
        top: 60px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 60px);
        background: var(--white, #ffffff);
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        padding: 1.5rem 0;
        transition: left 0.3s ease;
        box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
        z-index: 999;
        overflow-y: auto;
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-link {
        padding: 1rem 1.5rem;
        font-size: 1.05rem;
        width: 100%;
        text-align: left;
        border-bottom: 1px solid var(--gray-200, #e2e8f0);
        display: block;
    }
    
    .realtor-link {
        margin: 1rem 1.5rem;
        width: calc(100% - 3rem);
        text-align: center;
        justify-content: center;
    }
}

/* ========================================
   HERO SECTION RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .hero {
        min-height: 90vh;
        padding: 4rem 1rem 3rem;
        background-attachment: scroll !important; /* Fix for mobile */
    }
    
    .landing-hero {
        min-height: 100vh;
        padding: 4rem 1rem 2rem;
    }
    
    .hero-title,
    .landing-title {
        font-size: 2rem !important;
        line-height: 1.2;
        margin-bottom: 1rem;
    }
    
    .hero-subtitle,
    .landing-subtitle {
        font-size: 1rem !important;
        margin-bottom: 1.5rem;
        padding: 0 0.5rem;
    }
    
    .landing-description {
        font-size: 0.95rem !important;
        padding: 0 0.5rem;
    }
    
    .sama-logo {
        max-width: 250px !important;
        width: 85% !important;
        margin-bottom: 1.5rem;
    }
    
    /* Hero CTAs stack on mobile */
    .hero-cta,
    .landing-cta {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 0 1rem;
    }
    
    .cta-button,
    .btn {
        width: 100% !important;
        justify-content: center;
        padding: 0.875rem 1.5rem !important;
        font-size: 0.95rem !important;
        margin: 0 0 0.5rem 0 !important;
    }
    
    .hero-stats {
        grid-template-columns: 1fr !important;
        gap: 1rem;
        padding: 0 1rem;
        margin-top: 2rem;
    }
    
    .registration-notice {
        margin: 1.5rem 0;
        padding: 1rem;
        font-size: 0.9rem;
    }
}

/* Extra small devices (320px - 375px) */
@media (max-width: 375px) {
    .hero-title,
    .landing-title {
        font-size: 1.75rem !important;
    }
    
    .sama-logo {
        max-width: 220px !important;
    }
    
    .cta-button,
    .btn {
        padding: 0.75rem 1.25rem !important;
        font-size: 0.9rem !important;
    }
}

/* ========================================
   GRID LAYOUTS RESPONSIVE
   ======================================== */

/* All grid layouts responsive */
.hostels-grid,
.roommate-grid,
.quick-access-grid,
.campus-grid,
.features-grid,
.landing-features,
.dashboard-stats,
.listings-grid {
    display: grid;
    gap: 1.5rem;
}

/* Mobile: Single column */
@media (max-width: 768px) {
    .hostels-grid,
    .roommate-grid,
    .quick-access-grid,
    .campus-grid,
    .features-grid,
    .landing-features,
    .dashboard-stats,
    .listings-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem;
        padding: 0 1rem;
    }
}

/* Tablet: 2 columns */
@media (min-width: 769px) and (max-width: 1024px) {
    .hostels-grid,
    .roommate-grid,
    .features-grid,
    .landing-features {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.5rem;
    }
    
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Desktop: 3-4 columns */
@media (min-width: 1025px) {
    .hostels-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .features-grid,
    .landing-features {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .dashboard-stats {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Large desktop: 4 columns */
@media (min-width: 1400px) {
    .hostels-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ========================================
   CARDS RESPONSIVE FIX
   ======================================== */

@media (max-width: 768px) {
    .hostel-card,
    .feature-card,
    .location-card,
    .access-card,
    .stat-card {
        margin: 0 0 1rem 0;
        border-radius: 12px;
        overflow: hidden;
    }
    
    /* Hostel card mobile optimization */
    .hostel-card {
        display: flex;
        flex-direction: column;
    }
    
    .hostel-image {
        height: 200px !important;
        width: 100%;
    }
    
    .hostel-content {
        padding: 1rem !important;
    }
    
    .hostel-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .hostel-name,
    .hostel-header h3 {
        font-size: 1.1rem !important;
        margin-bottom: 0.5rem;
    }
    
    .hostel-price .price {
        font-size: 1.25rem !important;
    }
    
    /* Card actions stack vertically */
    .hostel-actions,
    .action-buttons {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }
    
    .hostel-actions .btn,
    .action-buttons .btn,
    .action-buttons button {
        width: 100% !important;
        margin: 0 !important;
        padding: 0.75rem !important;
        justify-content: center;
    }
}

/* ========================================
   FORMS RESPONSIVE FIX
   ======================================== */

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr !important;
        gap: 0.75rem;
    }
    
    .form-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem;
    }
    
    .form-group,
    .form-field {
        margin-bottom: 1rem;
    }
    
    /* Mobile-optimized form inputs */
    .form-group input,
    .form-group select,
    .form-group textarea,
    .form-field input,
    .form-field select,
    .form-field textarea {
        width: 100%;
        font-size: 16px !important; /* Prevents iOS zoom */
        padding: 0.875rem 1rem;
        border-radius: 8px;
        border: 2px solid #e2e8f0;
        min-height: 48px; /* Touch-friendly */
    }
    
    /* Select dropdowns mobile fix */
    select {
        background-image: url('data:image/svg+xml;utf8,<svg fill="%23333" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
        background-repeat: no-repeat;
        background-position: right 12px center;
        background-size: 20px;
        padding-right: 40px !important;
    }
    
    /* Textarea mobile */
    textarea {
        min-height: 120px;
        resize: vertical;
    }
    
    /* Form labels mobile */
    label {
        font-size: 0.95rem;
        font-weight: 600;
        display: block;
        margin-bottom: 0.5rem;
    }
    
    /* Checkbox and radio mobile */
    .checkbox-group,
    .checkbox-label {
        padding: 1rem;
        min-height: 48px;
        display: flex;
        align-items: center;
    }
    
    input[type="checkbox"],
    input[type="radio"] {
        width: 20px !important;
        height: 20px !important;
        min-height: 20px !important;
        min-width: 20px !important;
        margin-right: 0.75rem;
        flex-shrink: 0;
    }
    
    /* Submit buttons mobile */
    .form-group button[type="submit"],
    .submit-section button,
    .modal-actions button {
        width: 100%;
        padding: 1rem !important;
        font-size: 1rem !important;
        min-height: 48px;
        margin-bottom: 0.5rem;
    }
}

/* ========================================
   MODALS RESPONSIVE FIX
   ======================================== */

@media (max-width: 768px) {
    .modal {
        padding: 0;
        align-items: flex-end;
    }
    
    .modal-content,
    .modal-container {
        width: 100%;
        max-width: 100%;
        max-height: 95vh;
        border-radius: 20px 20px 0 0;
        margin: 0;
        animation: slideUp 0.3s ease-out;
    }
    
    @keyframes slideUp {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }
    
    .modal-header {
        padding: 1rem;
        position: sticky;
        top: 0;
        background: var(--white, #ffffff);
        z-index: 10;
        border-bottom: 1px solid #e2e8f0;
    }
    
    .modal-title,
    .modal-header h2 {
        font-size: 1.1rem !important;
    }
    
    .modal-body {
        padding: 1rem;
        max-height: calc(95vh - 150px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch; /* iOS smooth scroll */
    }
    
    .modal-close {
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.5rem;
    }
    
    .modal-actions {
        padding: 1rem;
        position: sticky;
        bottom: 0;
        background: var(--white, #ffffff);
        border-top: 1px solid #e2e8f0;
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .modal-actions button,
    .modal-actions .btn {
        width: 100% !important;
        margin: 0 !important;
    }
}

/* iOS-specific modal fix */
@supports (-webkit-touch-callout: none) {
    .modal-content,
    .modal-body {
        max-height: -webkit-fill-available;
    }
}

/* ========================================
   DASHBOARD RESPONSIVE FIX
   ======================================== */

@media (max-width: 768px) {
    .dashboard-container {
        padding: 1rem 0.75rem;
    }
    
    .dashboard-header {
        padding: 1.5rem 1rem;
        border-radius: 12px;
        margin-bottom: 1.5rem;
    }
    
    .dashboard-header h1 {
        font-size: 1.5rem !important;
    }
    
    .dashboard-header p {
        font-size: 0.9rem;
    }
    
    .dashboard-header .flex {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .dashboard-header .text-right {
        text-align: left;
    }
    
    /* Dashboard stats mobile */
    .dashboard-stats {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1.25rem;
    }
    
    /* Dashboard actions stack */
    .dashboard-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .dashboard-actions button,
    .dashboard-actions .btn {
        width: 100%;
    }
    
    /* Hostel management section */
    .hostel-management {
        border-radius: 12px;
        margin-top: 1.5rem;
    }
    
    .search-filter {
        padding: 1rem;
    }
    
    .search-input {
        width: 100%;
        font-size: 16px !important;
        padding: 0.875rem;
    }
    
    .filter-tabs {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 0.5rem;
        padding: 0.75rem 0;
        flex-wrap: nowrap;
    }
    
    .filter-tab {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    /* Hostel card in dashboard */
    .hostel-card {
        flex-direction: column;
        padding: 1rem;
        align-items: stretch;
    }
    
    .hostel-image {
        width: 100%;
        height: 150px;
        margin: 0 0 1rem 0;
    }
    
    .hostel-info {
        margin-bottom: 1rem;
    }
    
    .action-buttons {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
        margin: 0;
    }
    
    .action-buttons button,
    .action-buttons .btn {
        width: 100%;
        margin: 0;
    }
    
    /* Pending banner mobile */
    #pendingBanner {
        margin: 0 0 1rem 0;
        padding: 1rem;
        border-radius: 8px;
    }
    
    .pending-banner-content {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ========================================
   FOOTER RESPONSIVE FIX
   ======================================== */

@media (max-width: 768px) {
    .footer {
        padding: 2rem 0;
    }
    
    .footer-content {
        grid-template-columns: 1fr !important;
        text-align: center;
        gap: 2rem;
    }
    
    .footer-section {
        padding: 1rem 0;
    }
    
    .footer-brand {
        justify-content: center;
    }
    
    .footer-logo {
        height: 40px;
    }
    
    .social-links {
        justify-content: center;
        gap: 1rem;
    }
    
    .social-links a {
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .footer-bottom {
        padding: 1.5rem 1rem;
        font-size: 0.875rem;
        text-align: center;
    }
}

/* ========================================
   APPLICATION FORM MOBILE FIX
   ======================================== */

@media (max-width: 768px) {
    .application-container {
        padding: 1.5rem 1rem;
        border-radius: 12px;
        margin: 1rem auto;
    }
    
    .header h1 {
        font-size: 1.5rem !important;
    }
    
    .hostel-name {
        font-size: 1rem !important;
    }
    
    .hostel-summary {
        grid-template-columns: 1fr !important;
        padding: 1rem;
        gap: 0.75rem;
    }
    
    .hostel-detail {
        padding: 0.75rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    .hostel-detail:last-child {
        border-bottom: none;
    }
    
    .form-section {
        margin-bottom: 1.5rem;
    }
    
    .form-section h2 {
        font-size: 1.1rem !important;
        margin-bottom: 1rem;
    }
    
    .submit-section {
        margin-top: 2rem;
    }
    
    .success-message {
        padding: 1.5rem 1rem;
    }
    
    .success-message h3 {
        font-size: 1.2rem;
    }
    
    .success-message > div {
        flex-direction: column !important;
        gap: 0.75rem;
    }
    
    .btn-whatsapp {
        width: 100% !important;
        justify-content: center;
        padding: 1rem !important;
    }
}

/* ========================================
   FLOATING ACTION BUTTON MOBILE
   ======================================== */

@media (max-width: 768px) {
    .floating-action,
    .floating-action-btn {
        bottom: 1rem;
        right: 1rem;
        padding: 0.875rem 1.25rem;
        font-size: 0.9rem;
    }
    
    .fab-main {
        width: 56px;
        height: 56px;
        font-size: 1.25rem;
    }
    
    .fab-menu {
        bottom: 65px;
    }
    
    .fab-option {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
}

/* ========================================
   TABLET OPTIMIZATIONS (769px - 1024px)
   ======================================== */

@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        max-width: 720px;
        padding: 0 1.5rem;
    }
    
    .hero-title,
    .landing-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle,
    .landing-subtitle {
        font-size: 1.1rem;
    }
    
    .hostels-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .registration-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .cta-content {
        grid-template-columns: 2fr 1fr;
    }
}

/* ========================================
   DESKTOP OPTIMIZATIONS (1025px+)
   ======================================== */

@media (min-width: 1025px) {
    .container {
        max-width: 1200px;
        margin: 0 auto;
        padding: 0 2rem;
    }
    
    .hostels-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
    
    .dashboard-stats {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ========================================
   LARGE DESKTOP OPTIMIZATIONS (1400px+)
   ======================================== */

@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
    
    .hostels-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .campus-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ========================================
   TOUCH DEVICE OPTIMIZATIONS
   ======================================== */

@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .card:hover,
    .btn:hover,
    .nav-link:hover,
    .hostel-card:hover {
        transform: none;
    }
    
    /* Better tap feedback */
    .btn:active,
    button:active,
    .card:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
    
    /* Ensure all interactive elements are touch-friendly */
    a,
    button,
    [role="button"],
    [onclick] {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* ========================================
   HIGH CONTRAST MODE SUPPORT
   ======================================== */

@media (prefers-contrast: high) {
    .card,
    .modal-content,
    .btn,
    input,
    select,
    textarea {
        border: 2px solid currentColor !important;
    }
    
    .btn-outline {
        background: var(--white, #ffffff);
    }
    
    .hostel-card,
    .feature-card {
        border: 3px solid #000;
    }
}

/* ========================================
   REDUCED MOTION SUPPORT
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .sama-logo,
    .scroll-indicator,
    .floating-action-btn,
    .particle {
        animation: none !important;
    }
}

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

@media print {
    .navbar,
    .footer,
    .floating-action,
    .floating-action-btn,
    .theme-toggle,
    .modal,
    .fab-main,
    .mobile-toggle,
    button:not(.btn-print) {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .container {
        max-width: 100% !important;
    }
    
    .hostel-card,
    .feature-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    a {
        color: #000 !important;
        text-decoration: underline;
    }
    
    .hero {
        padding: 1rem 0;
        background: white !important;
    }
}

/* ========================================
   ACCESSIBILITY IMPROVEMENTS
   ======================================== */

/* Focus visible for keyboard navigation */
.btn:focus-visible,
.nav-link:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
    outline: 3px solid #3b82f6;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Skip to main content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #3b82f6;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 10000;
    border-radius: 4px;
    font-weight: 600;
}

.skip-link:focus {
    top: 6px;
}

/* ========================================
   LOADING STATES
   ======================================== */

.loading {
    pointer-events: none;
    opacity: 0.6;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   ERROR & SUCCESS STATES
   ======================================== */

.error-message,
.success-message {
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 2px solid #ef4444;
    color: #dc2626;
}

.success-message {
    background: rgba(34, 197, 94, 0.1);
    border: 2px solid #22c55e;
    color: #16a34a;
}

@media (max-width: 768px) {
    .error-message,
    .success-message {
        font-size: 0.9rem;
        padding: 0.875rem;
    }
}

/* ========================================
   PERFORMANCE OPTIMIZATIONS
   ======================================== */

/* Enable hardware acceleration for transforms */
.hostel-card,
.feature-card,
.btn,
.modal-content {
    will-change: transform;
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* Optimize images */
img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* Lazy loading support */
.lazy-image {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lazy-image.loaded {
    opacity: 1;
}

/* ========================================
   UTILITY CLASSES FOR RESPONSIVE CONTROL
   ======================================== */

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

/* Hide on tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    .hide-tablet {
        display: none !important;
    }
}

/* Hide on desktop */
@media (min-width: 1025px) {
    .hide-desktop {
        display: none !important;
    }
}

/* Show only on mobile */
.show-mobile {
    display: none !important;
}

@media (max-width: 768px) {
    .show-mobile {
        display: block !important;
    }
    
    .show-mobile-flex {
        display: flex !important;
    }
    
    .show-mobile-grid {
        display: grid !important;
    }
}

/* ========================================
   CRITICAL FIX: Prevent layout shift
   ======================================== */

/* Ensure consistent box-sizing */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Prevent images from causing layout shift */
img[width],
img[height] {
    height: auto;
}

/* Reserve space for async content */
.placeholder {
    min-height: 200px;
    background: #f1f5f9;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ========================================
   END OF MASTER RESPONSIVE FIX
   ======================================== */
