/**
 * BS Solar Website - Responsive Stylesheet
 * Mobile-first responsive styles
 */

/* ========================================
   EXTRA SMALL DEVICES (Portrait phones, < 576px)
   ======================================== */
@media (max-width: 575.98px) {
    /* Typography */
    h1, .h1 {
        font-size: 1.75rem;
    }

    h2, .h2 {
        font-size: 1.5rem;
    }

    h3, .h3 {
        font-size: 1.25rem;
    }

    /* Section spacing */
    .section {
        padding: 40px 0;
    }

    .section-header {
        margin-bottom: 30px;
    }

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

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

    .hero-content h1 {
        font-size: 1.75rem;
    }

    .hero-content p {
        font-size: 0.9rem;
    }

    /* Buttons */
    .btn {
        padding: 10px 20px;
        font-size: 14px;
        width: 100%;
    }

    .hero-buttons {
        flex-direction: column;
        gap: 12px;
    }

    /* Statistics */
    .stat-number {
        font-size: 2rem;
    }

    .stat-label {
        font-size: 0.85rem;
    }

    /* Cards */
    .card-content {
        padding: 16px;
    }

    .service-card {
        padding: 24px 16px;
    }

    .service-card .icon {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }

    /* Page header */
    .page-header {
        padding: 100px 0 40px;
    }

    /* Gallery */
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .gallery-item img {
        height: 200px;
    }

    /* Blog */
    .blog-card-image {
        height: 160px;
    }

    /* Testimonials */
    .testimonial-card {
        padding: 20px;
    }

    /* Forms */
    .form-input,
    .form-select,
    .form-textarea {
        padding: 10px 14px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Footer */
    footer {
        text-align: center;
    }

    footer .grid > div {
        margin-bottom: 30px;
    }

    /* WhatsApp button */
    .whatsapp-btn {
        right: 16px;
        bottom: 16px;
        width: 50px;
        height: 50px;
    }

    /* Back to top */
    #backToTop {
        right: 72px;
        width: 40px;
        height: 40px;
    }

    /* Highlight banner */
    .highlight-price {
        font-size: 2rem;
    }

    .highlight-price small {
        font-size: 1rem;
    }
}

/* ========================================
   SMALL DEVICES (Landscape phones, >= 576px)
   ======================================== */
@media (min-width: 576px) and (max-width: 767.98px) {
    .section {
        padding: 50px 0;
    }

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

    .hero-content h1 {
        font-size: 2rem;
    }

    .stat-number {
        font-size: 2.5rem;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .highlight-price {
        font-size: 2.5rem;
    }
}

/* ========================================
   MEDIUM DEVICES (Tablets, >= 768px)
   ======================================== */
@media (min-width: 768px) and (max-width: 991.98px) {
    .section {
        padding: 60px 0;
    }

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

    .hero-content h1 {
        font-size: 2.5rem;
    }

    /* 2-column layouts */
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .blog-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Stats */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========================================
   LARGE DEVICES (Desktops, >= 992px)
   ======================================== */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .section {
        padding: 70px 0;
    }

    /* 3-column layouts */
    .services-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .blog-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ========================================
   EXTRA LARGE DEVICES (Large desktops, >= 1200px)
   ======================================== */
@media (min-width: 1200px) {
    .container {
        max-width: 1200px;
    }

    .section {
        padding: 80px 0;
    }

    /* 4-column stats */
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    /* 4-column gallery on xl */
    .gallery-grid-xl {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ========================================
   EXTRA EXTRA LARGE DEVICES (>= 1400px)
   ======================================== */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
}

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

/* Mobile navigation (< 1024px) */
@media (max-width: 1023.98px) {
    .desktop-nav {
        display: none;
    }

    .mobile-menu-btn {
        display: block;
    }

    .mobile-menu {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: white;
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    .mobile-menu.active {
        left: 0;
    }

    .mobile-menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease;
    }

    .mobile-menu-overlay.active {
        opacity: 1;
        visibility: visible;
    }
}

/* Desktop navigation (>= 1024px) */
@media (min-width: 1024px) {
    .desktop-nav {
        display: flex;
    }

    .mobile-menu-btn {
        display: none;
    }

    .mobile-menu {
        display: none;
    }
}

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

@media (max-width: 991.98px) {
    .hero-section {
        min-height: 85vh;
    }

    .hero-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-image {
        display: none;
    }

    .scroll-indicator {
        display: none;
    }
}

@media (min-width: 992px) {
    .hero-section {
        min-height: 100vh;
    }

    .hero-grid {
        grid-template-columns: 1fr 1fr;
        align-items: center;
        gap: 60px;
    }

    .hero-content {
        text-align: left;
    }
}

/* ========================================
   SIDEBAR RESPONSIVE (Blog/Contact)
   ======================================== */

@media (max-width: 991.98px) {
    .content-with-sidebar {
        grid-template-columns: 1fr;
    }

    .sidebar {
        margin-top: 40px;
    }
}

@media (min-width: 992px) {
    .content-with-sidebar {
        grid-template-columns: 1fr 350px;
        gap: 40px;
    }
}

/* ========================================
   TABLE RESPONSIVE
   ======================================== */

@media (max-width: 767.98px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-responsive table {
        min-width: 600px;
    }

    /* Card view for tables on mobile */
    .table-to-cards thead {
        display: none;
    }

    .table-to-cards tbody tr {
        display: block;
        margin-bottom: 16px;
        background: white;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        padding: 16px;
    }

    .table-to-cards tbody td {
        display: flex;
        justify-content: space-between;
        padding: 8px 0;
        border-bottom: 1px solid #eee;
    }

    .table-to-cards tbody td:last-child {
        border-bottom: none;
    }

    .table-to-cards tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        margin-right: 16px;
    }
}

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

@media (max-width: 575.98px) {
    .form-row {
        flex-direction: column;
    }

    .form-row .form-group {
        width: 100%;
    }
}

@media (min-width: 576px) {
    .form-row {
        display: flex;
        gap: 20px;
    }

    .form-row .form-group {
        flex: 1;
    }
}

/* ========================================
   SWIPER RESPONSIVE
   ======================================== */

@media (max-width: 575.98px) {
    .testimonials-slider .swiper-slide {
        padding: 0 10px;
    }

    .swiper-button-prev,
    .swiper-button-next {
        display: none;
    }

    .swiper-pagination {
        position: relative;
        margin-top: 20px;
    }
}

@media (min-width: 768px) {
    .swiper-button-prev,
    .swiper-button-next {
        width: 40px;
        height: 40px;
    }

    .swiper-button-prev::after,
    .swiper-button-next::after {
        font-size: 18px;
    }
}

/* ========================================
   PRINT RESPONSIVE
   ======================================== */

@media print {
    /* Remove backgrounds */
    *,
    *::before,
    *::after {
        background: transparent !important;
        color: #000 !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    /* Hide non-essential elements */
    header,
    footer,
    nav,
    .no-print,
    .scroll-indicator,
    #backToTop,
    .whatsapp-btn {
        display: none !important;
    }

    /* Ensure content is visible */
    body {
        font-size: 12pt;
        line-height: 1.5;
    }

    /* Page breaks */
    .section {
        page-break-inside: avoid;
    }

    h1, h2, h3 {
        page-break-after: avoid;
    }

    img {
        max-width: 100% !important;
        page-break-inside: avoid;
    }

    /* Links */
    a {
        text-decoration: underline;
    }

    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 10pt;
    }

    a[href^="#"]::after,
    a[href^="javascript"]::after {
        content: "";
    }
}

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

@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .hover-lift:hover {
        transform: none;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }

    .hover-scale:hover {
        transform: none;
    }

    /* Increase touch targets */
    .btn,
    .nav-link,
    .form-input,
    .form-select {
        min-height: 44px;
    }

    /* Show gallery overlay by default on touch */
    .gallery-overlay {
        transform: translateY(0);
        background: linear-gradient(transparent 50%, rgba(30, 58, 95, 0.9));
    }
}

/* ========================================
   LANDSCAPE ORIENTATION
   ======================================== */

@media (max-height: 500px) and (orientation: landscape) {
    .hero-section {
        min-height: auto;
        padding: 60px 0;
    }

    .hero-content h1 {
        font-size: 1.5rem;
    }

    .hero-buttons {
        flex-direction: row;
    }
}

/* ========================================
   HIGH DPI DISPLAYS
   ======================================== */

@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 192dpi) {
    /* Use higher resolution images if available */
    .logo-retina {
        background-image: url('../images/logo/logo@2x.png');
        background-size: contain;
    }
}

/* ========================================
   DARK MODE SUPPORT (Optional)
   ======================================== */

@media (prefers-color-scheme: dark) {
    /* Uncomment to enable dark mode
    :root {
        --solar-gray: #1a1a2e;
        --text-dark: #e0e0e0;
        --text-light: #a0a0a0;
        --white: #16213e;
    }

    body {
        background-color: #0f0f1a;
    }

    .card {
        background: #1a1a2e;
    }
    */
}
