/* Mobile First Responsive Design */

/* Base Mobile Styles (320px - 767px) */
@media screen and (max-width: 767px) {
    /* Typography */
    h1 {
        font-size: 2rem !important;
        line-height: 1.2;
    }
    
    h2 {
        font-size: 1.75rem !important;
    }
    
    h3 {
        font-size: 1.25rem !important;
    }
    
    p {
        font-size: 0.9rem;
        line-height: 1.6;
    }
    
    /* Container Spacing */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Hero Section */
    .hero-section {
        padding: 4rem 0;
        min-height: 60vh;
        background-attachment: scroll;
    }
    
    /* Navigation */
    .nav-link {
        display: block;
        padding: 0.75rem 1rem;
        border-bottom: 1px solid #e5e5e5;
    }
    
    /* Buttons */
    .btn-primary,
    .btn-secondary {
        display: block;
        width: 100%;
        margin-bottom: 0.5rem;
        padding: 0.75rem 1rem;
        text-align: center;
    }
    
    /* Grid Layouts */
    .grid {
        gap: 1rem;
    }
    
    .md\\:grid-cols-2,
    .md\\:grid-cols-3,
    .md\\:grid-cols-4,
    .lg\\:grid-cols-3,
    .lg\\:grid-cols-4 {
        grid-template-columns: 1fr;
    }
    
    /* Service Cards */
    .service-card {
        margin-bottom: 1rem;
    }
    
    /* Forms */
    .form-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Modal */
    .modal {
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }
    
    /* Chat Widget */
    #chat-widget {
        bottom: 1rem;
        right: 1rem;
    }
    
    #chat-window {
        width: calc(100vw - 2rem);
        right: 0;
        left: 0;
        bottom: 4rem;
        max-width: none;
        border-radius: 0.5rem;
    }
    
    #chat-messages {
        height: 200px;
        max-height: 50vh;
    }
    
    #chat-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Footer */
    .footer-content {
        text-align: center;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    /* Touch Targets */
    button,
    .btn-primary,
    .btn-secondary,
    input[type="submit"] {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Spacing */
    .py-16 {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }
    
    .py-20 {
        padding-top: 4rem !important;
        padding-bottom: 4rem !important;
    }
    
    /* Images */
    img {
        max-width: 100%;
        height: auto;
    }
}

/* Tablet Styles (768px - 1023px) */
@media screen and (min-width: 768px) and (max-width: 1023px) {
    /* Grid Layouts */
    .md\\:grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .md\\:grid-cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .md\\:grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Typography */
    h1 {
        font-size: 3rem;
    }
    
    h2 {
        font-size: 2.5rem;
    }
    
    /* Container */
    .container {
        max-width: 768px;
        margin: 0 auto;
        padding-left: 2rem;
        padding-right: 2rem;
    }
    
    /* Hero Section */
    .hero-section {
        padding: 6rem 0;
        min-height: 70vh;
    }
    
    /* Chat Widget */
    #chat-window {
        width: 350px;
    }
    
    /* Forms */
    .md\\:flex {
        display: flex;
    }
    
    .md\\:space-x-4 > * + * {
        margin-left: 1rem;
    }
    
    /* Grid Gaps */
    .gap-8 {
        gap: 1.5rem;
    }
}

/* Desktop Styles (1024px and above) */
@media screen and (min-width: 1024px) {
    /* Grid Layouts */
    .lg\\:grid-cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .lg\\:grid-cols-4 {
        grid-template-columns: repeat(4, 1fr);
    }
    
    /* Container */
    .container {
        max-width: 1200px;
        margin: 0 auto;
        padding-left: 2rem;
        padding-right: 2rem;
    }
    
    /* Hero Section */
    .hero-section {
        padding: 8rem 0;
        min-height: 80vh;
        background-attachment: fixed;
    }
    
    /* Typography */
    h1 {
        font-size: 4rem;
    }
    
    h2 {
        font-size: 3rem;
    }
    
    /* Hover Effects (Desktop Only) */
    .hover\\:shadow-lg:hover {
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    }
    
    .hover\\:scale-105:hover {
        transform: scale(1.05);
    }
    
    .hover\\:-translate-y-1:hover {
        transform: translateY(-0.25rem);
    }
}

/* Large Desktop Styles (1440px and above) */
@media screen and (min-width: 1440px) {
    .container {
        max-width: 1400px;
    }
    
    /* Typography */
    h1 {
        font-size: 4.5rem;
    }
    
    /* Hero Section */
    .hero-section {
        min-height: 90vh;
    }
}

/* Ultra-wide Screens (1920px and above) */
@media screen and (min-width: 1920px) {
    .container {
        max-width: 1600px;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Provide higher quality images for retina displays */
    .hero-section {
        background-image: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.6)), 
                         url('../images/others/hero-background-coffee.jpg');
    }
}

/* Print Styles */
@media print {
    * {
        color: black !important;
        background: white !important;
    }
    
    .no-print,
    nav,
    .chat-widget,
    .modal,
    footer {
        display: none !important;
    }
    
    .container {
        max-width: none;
        margin: 0;
        padding: 0;
    }
    
    h1, h2, h3 {
        page-break-after: avoid;
    }
    
    p {
        orphans: 3;
        widows: 3;
    }
    
    .page-break {
        page-break-before: always;
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (prefers-color-scheme: dark) {
    /* Dark mode styles if needed */
    :root {
        --coffee-dark: #D2B48C;
        --cream: #2D1B69;
    }
}

/* Orientation Changes */
@media screen and (orientation: landscape) and (max-height: 500px) {
    .hero-section {
        min-height: 100vh;
        padding: 2rem 0;
    }
    
    .hero-section h1 {
        font-size: 2.5rem;
    }
}

/* Custom Breakpoints */
@media screen and (min-width: 480px) and (max-width: 767px) {
    /* Large mobile phones */
    .sm\\:grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .hero-section h1 {
        font-size: 2.5rem;
    }
    
    /* Chat Widget for larger mobile screens */
    #chat-window {
        width: 350px;
        right: 0;
        left: auto;
    }
}

/* Extra small mobile devices */
@media screen and (max-width: 375px) {
    #chat-widget {
        bottom: 0.5rem;
        right: 0.5rem;
    }
    
    #chat-window {
        width: calc(100vw - 1rem);
        right: 0;
        left: 0;
        bottom: 3.5rem;
    }
    
    #chat-button {
        width: 3rem;
        height: 3rem;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    #chat-button svg {
        width: 1.25rem;
        height: 1.25rem;
    }
}

/* IE11 Support */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
    .grid {
        display: -ms-grid;
    }
    
    .flex {
        display: -ms-flexbox;
    }
}

/* Container Queries (Future-proofing) */
@supports (container-type: inline-size) {
    .card-container {
        container-type: inline-size;
    }
    
    @container (max-width: 300px) {
        .card {
            padding: 0.5rem;
        }
    }
}