/**
 * Responsive Stylesheet for Colin's Professional Building Services
 * Desktop-first approach using max-width media queries
 *
 * Breakpoints:
 * - Desktop: > 960px (default in main.css)
 * - Tablet: 768px - 959px
 * - Mobile: < 768px
 * - Small mobile: < 480px
 */

/* ==========================================================================
   Tablet Styles (768px - 959px)
   ========================================================================== */

@media (max-width: 959px) {
    /* Layout */
    .container {
        max-width: 100%;
        padding: 0 20px;
    }

    /* Top Bar - Hidden on tablet */
    .top-bar {
        display: none;
    }

    /* Header & Navigation */
    .logo img {
        max-width: 250px;
        height: auto;
    }

    .nav-menu {
        gap: 1.5rem;
    }

    .nav-link {
        font-size: 0.95rem;
    }

    /* Hero Section */
    .hero {
        min-height: 70vh;
    }

    .hero-title {
        font-size: 3rem;
    }

    .hero-subtitle {
        font-size: 1.3rem;
    }

    .hero-description {
        font-size: 1rem;
    }

    /* Hero Slider */
    .hero-slider {
        height: 600px;
    }

    .hero-slide {
        height: 600px;
    }

    /* Typography */
    h1 {
        font-size: 2.5rem;
    }

    h2 {
        font-size: 2rem;
    }

    h3 {
        font-size: 1.75rem;
    }

    /* Grid System - Tablet columns */
    .row {
        margin: 0 -10px;
    }

    .col-md-6 {
        width: 50%;
        padding: 0 10px;
    }

    .col-md-12 {
        width: 100%;
        padding: 0 10px;
    }

    /* Two-Column Layouts - Adjust 8/4 split to 6/6 */
    .grid-8-4 {
        grid-template-columns: 1fr 1fr;
    }

    .col-8 {
        grid-column: span 1;
    }

    .col-4 {
        grid-column: span 1;
    }

    /* Masonry Grid - 2 columns on tablet */
    .masonry-grid {
        column-count: 2;
        column-gap: 1.5rem;
    }

    .masonry-item {
        break-inside: avoid;
        margin-bottom: 1.5rem;
    }

    /* Gallery Grid */
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    /* Testimonials Grid - 2 columns */
    .testimonials-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    /* Services Grid */
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    /* Accreditations Grid */
    .accreditations-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
    }

    /* Footer - 2x2 grid */
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }

    /* Spacing adjustments */
    .section {
        padding: 3rem 0;
    }

    .section-header {
        margin-bottom: 2.5rem;
    }

    /* Cards */
    .card {
        padding: 1.75rem;
    }

    /* Process Steps */
    .process-steps {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Contact Info Grid */
    .contact-info {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

/* ==========================================================================
   Mobile Styles (< 768px)
   ========================================================================== */

@media (max-width: 767px) {
    /* Layout */
    .container {
        max-width: 100%;
        padding: 0 15px;
    }

    /* Top Bar - Hidden */
    .top-bar {
        display: none;
    }

    /* Header & Navigation */
    .header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
    }

    .nav {
        padding: 0.75rem 0;
    }

    .logo img {
        max-width: 180px;
        height: auto;
    }

    /* Mobile Menu Toggle */
    .mobile-menu-toggle {
        display: block;
        z-index: 1001;
    }

    /* Mobile Navigation */
    .nav-menu {
        display: none;
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background-color: var(--color-background);
        box-shadow: var(--box-shadow);
        flex-direction: column;
        padding: 1rem;
        gap: 0;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-menu li {
        width: 100%;
        border-bottom: 1px solid var(--color-light-gray);
    }

    .nav-menu li:last-child {
        border-bottom: none;
    }

    .nav-link {
        display: block;
        padding: 1rem;
        font-size: 1rem;
    }

    .nav-link::after {
        display: none;
    }

    /* Hero Section */
    .hero {
        min-height: 60vh;
        padding-top: 60px;
    }

    .hero-title {
        font-size: 2rem;
        margin-bottom: 0.75rem;
    }

    .hero-subtitle {
        font-size: 1.1rem;
        margin-bottom: 1.5rem;
    }

    .hero-description {
        font-size: 0.95rem;
        margin-bottom: 2rem;
    }

    /* Hero Slider */
    .hero-slider {
        height: 400px;
    }

    .hero-slide {
        height: 400px;
    }

    /* Hide slider navigation arrows on mobile */
    .slider-nav,
    .slider-prev,
    .slider-next {
        display: none !important;
    }

    /* Keep slider dots visible */
    .slider-dots {
        display: flex !important;
    }

    /* Typography */
    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    h4 {
        font-size: 1.125rem;
    }

    h5 {
        font-size: 1rem;
    }

    h6 {
        font-size: 0.95rem;
    }

    p {
        font-size: 0.95rem;
    }

    /* Section Spacing */
    .section {
        padding: 2.5rem 0;
    }

    .section-header {
        margin-bottom: 2rem;
    }

    .section-title {
        font-size: 1.75rem;
    }

    .section-subtitle {
        font-size: 0.95rem;
    }

    /* Grid System - All columns stack */
    .row {
        margin: 0 -7.5px;
        flex-direction: column;
    }

    .col-sm-12,
    [class*="col-"] {
        width: 100%;
        padding: 0 7.5px;
        margin-bottom: 1rem;
    }

    /* Grid Layouts - Single column */
    .grid,
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    /* Two-Column Layouts - Stack */
    .grid-8-4 {
        grid-template-columns: 1fr;
    }

    .col-8,
    .col-4 {
        grid-column: span 1;
    }

    /* Masonry Grid - Single column */
    .masonry-grid {
        column-count: 1;
        column-gap: 0;
    }

    .masonry-item {
        margin-bottom: 1.5rem;
    }

    /* Gallery Grid - Single column */
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .gallery-item {
        height: 250px;
    }

    /* Testimonials Grid - Single column */
    .testimonials-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .testimonial-card {
        padding: 1.5rem;
    }

    .testimonial-text {
        font-size: 1rem;
    }

    /* Services Grid - Single column */
    .services-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .service-card {
        max-width: 500px;
        margin: 0 auto;
    }

    /* Accreditations Grid - 2 columns on mobile */
    .accreditations-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .accreditation-item {
        padding: 0.75rem;
    }

    .accreditation-logo {
        width: 60px;
        height: 60px;
    }

    /* Process Steps - Single column */
    .process-steps {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    /* Contact Info Grid - Single column */
    .contact-info {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .contact-item {
        padding: 1.5rem;
    }

    /* Cards */
    .card {
        padding: 1.5rem;
    }

    .card-icon {
        font-size: 2.5rem;
    }

    .card-title {
        font-size: 1.25rem;
    }

    /* Buttons */
    .btn {
        width: 100%;
        max-width: 100%;
        padding: 0.875rem 1.5rem;
        font-size: 0.95rem;
    }

    .btn-large {
        padding: 1rem 2rem;
        font-size: 1rem;
    }

    .btn-group {
        flex-direction: column;
        gap: 0.75rem;
    }

    .btn-group .btn {
        width: 100%;
    }

    /* Forms */
    .form-row {
        flex-direction: column;
    }

    .form-group {
        width: 100%;
        margin-bottom: 1rem;
    }

    .form-control {
        width: 100%;
        font-size: 1rem;
        padding: 0.75rem;
    }

    .form-label {
        font-size: 0.95rem;
    }

    /* Footer - Single column */
    .footer {
        padding: 2.5rem 0 1rem;
        margin-top: 3rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }

    .footer-section {
        margin-bottom: 1.5rem;
    }

    .footer-section h3 {
        font-size: 1.25rem;
        margin-bottom: 0.75rem;
    }

    .footer-bottom {
        padding-top: 1rem;
        font-size: 0.875rem;
    }

    .social-links {
        margin-top: 1rem;
        gap: 0.75rem;
    }

    .social-link {
        width: 36px;
        height: 36px;
        line-height: 36px;
    }

    /* Flexbox Utilities */
    .flex-center,
    .flex-between {
        flex-direction: column;
        gap: 1rem;
    }

    /* Utility Spacing */
    .mb-1 { margin-bottom: 0.5rem; }
    .mb-2 { margin-bottom: 0.75rem; }
    .mb-3 { margin-bottom: 1rem; }
    .mb-4 { margin-bottom: 1.5rem; }

    .mt-1 { margin-top: 0.5rem; }
    .mt-2 { margin-top: 0.75rem; }
    .mt-3 { margin-top: 1rem; }
    .mt-4 { margin-top: 1.5rem; }

    /* Modal adjustments */
    .modal-content {
        width: 95%;
        margin: 1rem auto;
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
    }

    /* Calendar/Booking adjustments */
    .calendar-grid {
        grid-template-columns: repeat(7, 1fr);
        gap: 0.25rem;
    }

    .calendar-day {
        font-size: 0.875rem;
        padding: 0.5rem 0.25rem;
    }

    /* Chatbot adjustments */
    .chatbot-container {
        bottom: 10px;
        right: 10px;
        width: calc(100% - 20px);
        max-width: 100%;
    }

    .chatbot-messages {
        max-height: 250px;
    }

    /* Tables */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 0.875rem;
    }

    /* Images */
    img {
        max-width: 100%;
        height: auto;
    }

    /* Video embeds */
    .video-container {
        position: relative;
        padding-bottom: 56.25%;
        height: 0;
        overflow: hidden;
    }

    .video-container iframe,
    .video-container video {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }

    /* Background attachment fix for mobile */
    .hero-background {
        background-attachment: scroll;
    }
}

/* ==========================================================================
   Small Mobile Styles (< 480px)
   ========================================================================== */

@media (max-width: 479px) {
    /* Container */
    .container {
        padding: 0 10px;
    }

    /* Logo */
    .logo img {
        max-width: 150px;
    }

    /* Hero */
    .hero {
        min-height: 50vh;
    }

    .hero-title {
        font-size: 1.5rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .hero-description {
        font-size: 0.875rem;
        margin-bottom: 1.5rem;
    }

    .hero-slider {
        height: 300px;
    }

    .hero-slide {
        height: 300px;
    }

    /* Typography - Further reduction */
    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1.125rem;
    }

    h4 {
        font-size: 1rem;
    }

    /* Section Spacing */
    .section {
        padding: 2rem 0;
    }

    .section-header {
        margin-bottom: 1.5rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .section-subtitle {
        font-size: 0.875rem;
    }

    /* Cards */
    .card {
        padding: 1.25rem;
    }

    .card-icon {
        font-size: 2rem;
    }

    .card-title {
        font-size: 1.125rem;
    }

    /* Buttons */
    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.875rem;
    }

    .btn-large {
        padding: 0.875rem 1.75rem;
        font-size: 0.95rem;
    }

    /* Grid gaps */
    .grid,
    .grid-2,
    .grid-3,
    .grid-4 {
        gap: 1rem;
    }

    /* Masonry */
    .masonry-item {
        margin-bottom: 1rem;
    }

    /* Gallery */
    .gallery-item {
        height: 200px;
    }

    /* Services */
    .service-image {
        height: 180px;
    }

    /* Accreditations - 2 columns, smaller */
    .accreditations-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .accreditation-logo {
        width: 50px;
        height: 50px;
    }

    .accreditation-name {
        font-size: 0.875rem;
    }

    .accreditation-number {
        font-size: 0.8rem;
    }

    /* Contact */
    .contact-item {
        padding: 1rem;
    }

    .contact-icon {
        font-size: 2rem;
    }

    /* Forms */
    .form-control {
        font-size: 0.95rem;
        padding: 0.625rem;
    }

    /* Footer */
    .footer {
        padding: 2rem 0 1rem;
        margin-top: 2rem;
    }

    .footer-content {
        gap: 1.5rem;
    }

    .footer-section h3 {
        font-size: 1.125rem;
    }

    .footer-section p,
    .footer-section li {
        font-size: 0.875rem;
    }

    .social-link {
        width: 32px;
        height: 32px;
        line-height: 32px;
        font-size: 0.875rem;
    }

    /* Testimonials */
    .testimonial-text {
        font-size: 0.95rem;
    }

    .star {
        font-size: 1rem;
    }

    /* Chatbot */
    .chatbot-container {
        width: calc(100% - 10px);
        bottom: 5px;
        right: 5px;
    }

    .chatbot-messages {
        max-height: 200px;
    }

    /* Calendar */
    .calendar-day {
        font-size: 0.75rem;
        padding: 0.375rem 0.125rem;
    }

    /* Tables */
    table {
        font-size: 0.8rem;
    }

    th, td {
        padding: 0.5rem 0.25rem;
    }

    /* Utility spacing - smaller */
    .mb-1 { margin-bottom: 0.375rem; }
    .mb-2 { margin-bottom: 0.625rem; }
    .mb-3 { margin-bottom: 0.875rem; }
    .mb-4 { margin-bottom: 1.25rem; }

    .mt-1 { margin-top: 0.375rem; }
    .mt-2 { margin-top: 0.625rem; }
    .mt-3 { margin-top: 0.875rem; }
    .mt-4 { margin-top: 1.25rem; }
}

/* ==========================================================================
   Landscape Orientation (Small Screens)
   ========================================================================== */

@media (max-height: 500px) and (orientation: landscape) {
    /* Reduce hero height on landscape */
    .hero {
        min-height: 100vh;
        padding: 6rem 0 2rem;
    }

    .hero-slider {
        height: 100vh;
    }

    .hero-slide {
        height: 100vh;
    }

    /* Reduce section padding */
    .section {
        padding: 2rem 0;
    }

    /* Smaller navigation */
    .nav {
        padding: 0.5rem 0;
    }

    /* Compact header */
    .logo img {
        max-width: 120px;
    }
}

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

@media print {
    /* Hide non-essential elements */
    .header,
    .nav,
    .mobile-menu-toggle,
    .hero-slider,
    .slider-nav,
    .btn,
    .chatbot-container,
    .modal,
    .footer,
    .social-links {
        display: none !important;
    }

    /* Adjust layout for print */
    .container {
        max-width: 100%;
        padding: 0;
    }

    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
        background: #fff;
    }

    /* Remove shadows and transitions */
    .card,
    .service-card,
    .testimonial-card {
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }

    /* Single column for print */
    .grid,
    .grid-2,
    .grid-3,
    .grid-4 {
        display: block;
    }

    .grid > *,
    .grid-2 > *,
    .grid-3 > *,
    .grid-4 > * {
        margin-bottom: 1rem;
        page-break-inside: avoid;
    }

    /* Links */
    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
    }

    /* Images */
    img {
        max-width: 100%;
        page-break-inside: avoid;
    }

    /* Headings */
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
        page-break-inside: avoid;
    }
}

/* ==========================================================================
   Accessibility Enhancements (Prefers Reduced Motion)
   ========================================================================== */

@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;
    }

    .fade-in,
    .slide-in-up {
        animation: none;
    }

    .hero-background {
        background-attachment: scroll;
    }
}

/* ==========================================================================
   High Contrast Mode Support
   ========================================================================== */

@media (prefers-contrast: high) {
    .card,
    .service-card,
    .testimonial-card {
        border: 2px solid currentColor;
    }

    .btn {
        border: 2px solid currentColor;
    }

    .nav-link::after {
        height: 3px;
    }
}
