/* ============================================
   QUESCO SOLAR - MOBILE UX/UI OPTIMIZATION
   Touch-first, performance-focused
   ============================================ */

/* ========== GLOBAL MOBILE FIXES ========== */

/* Ensure all images load and display properly on mobile */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Prevent horizontal scroll */
html, body {
  overflow-x: hidden;
}

/* Touch-friendly tap targets (minimum 44px) */
a, button, .btn, input, select, textarea {
  min-height: 44px;
}

/* Better text rendering on mobile */
body {
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

/* ========== MOBILE BREAKPOINT: < 768px ========== */
@media (max-width: 767.98px) {

  /* --- NAVBAR --- */
  .navbar {
    padding: 0.5rem 0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
  }

  .navbar-brand img {
    height: 36px;
  }

  .navbar-brand span {
    font-size: 1rem;
  }

  .navbar-collapse {
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* --- TRUST BAR --- */
  .trust-bar {
    padding: 8px 0;
  }

  .trust-item {
    padding: 0 16px;
  }

  .trust-item i {
    font-size: 0.9rem;
  }

  .trust-item span {
    font-size: 0.8rem;
  }

  /* --- HERO SECTION --- */
  .hero-slider .carousel-item {
    height: auto;
    min-height: 420px;
    padding: 0;
  }

  .hero-content {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    width: 100%;
    max-width: 100%;
    padding: 100px 20px 60px;
  }

  .hero-content h1 {
    font-size: 1.6rem !important;
    line-height: 1.4;
    margin-bottom: 0.75rem;
  }

  .hero-content p {
    font-size: 0.9rem !important;
    margin-bottom: 1rem;
    line-height: 1.5;
  }

  .floating-badge {
    font-size: 0.75rem;
    padding: 6px 12px;
  }

  .hero-buttons {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
  }

  .hero-buttons .btn {
    width: 100%;
    max-width: 280px;
  }

  .hero-buttons .btn.ms-2 {
    margin-left: 0 !important;
  }

  /* Hide carousel controls on mobile - use swipe instead */
  .hero-slider .carousel-control-prev,
  .hero-slider .carousel-control-next {
    display: none;
  }

  .hero-slider .carousel-indicators {
    bottom: 15px;
  }

  .hero-slider .carousel-indicators button {
    width: 8px;
    height: 8px;
  }

  /* --- SECTIONS --- */
  .section-padding {
    padding: 3rem 0;
  }

  .section-title {
    font-size: 1.4rem !important;
    margin-bottom: 1.5rem;
  }

  .section-title::after {
    width: 50px;
    height: 3px;
    margin-top: 10px;
  }

  .lead {
    font-size: 0.95rem;
  }

  /* --- COUNTER BOXES --- */
  .counter-box {
    padding: 1.25rem 1rem;
    margin-bottom: 1rem;
    border-radius: 12px;
  }

  .counter-icon {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
  }

  .counter-box h2 {
    font-size: 2rem;
    margin-bottom: 0.25rem;
  }

  .counter-box p {
    font-size: 0.8rem;
  }

  /* --- SERVICE CARDS --- */
  .service-card {
    margin-bottom: 1.5rem;
    border-radius: 12px;
  }

  .service-image img {
    height: 180px;
  }

  .service-card .card-body {
    padding: 1.25rem;
  }

  .service-card .card-title {
    font-size: 1rem;
  }

  .service-card .card-text {
    font-size: 0.85rem;
    line-height: 1.6;
  }

  .service-icon {
    width: 45px;
    height: 45px;
    bottom: -15px;
    right: 15px;
    font-size: 1.2rem;
  }

  /* --- CALCULATOR --- */
  .calculator-card {
    margin-bottom: 1.5rem;
  }

  .calculator-card .card-header {
    padding: 1rem;
  }

  .calculator-card .card-header h4 {
    font-size: 1.05rem;
  }

  .calculator-card form {
    padding: 1.25rem;
  }

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

  .result-item {
    padding: 0.75rem;
    margin-bottom: 1rem;
  }

  .result-icon {
    width: 45px;
    height: 45px;
    font-size: 1.2rem;
    margin-right: 0.75rem;
  }

  .result-details h6 {
    font-size: 0.75rem;
  }

  .result-details h3 {
    font-size: 1.3rem;
  }

  /* --- PROJECT CARDS --- */
  .project-card {
    margin-bottom: 1.25rem;
  }

  .project-image img {
    height: 200px;
  }

  .project-body {
    padding: 1rem;
  }

  .project-body h5 {
    font-size: 1rem;
  }

  .project-tags {
    gap: 0.35rem;
  }

  .tag {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
  }

  /* --- TESTIMONIALS --- */
  .testimonials-section {
    padding: 3rem 0;
  }

  .testimonial-card {
    padding: 2rem 1.25rem 1.5rem;
    margin: 1.5rem 0.25rem 0.5rem;
  }

  .testimonial-icon {
    width: 40px;
    height: 40px;
    top: -20px;
    font-size: 1rem;
  }

  .testimonial-card .quote {
    font-size: 0.9rem;
    line-height: 1.7;
  }

  .author-avatar {
    width: 45px;
    height: 45px;
    font-size: 1.5rem;
  }

  .author-info h5 {
    font-size: 0.95rem;
  }

  .author-info p {
    font-size: 0.8rem;
  }

  .testimonial-rating {
    font-size: 0.95rem;
  }

  .carousel-controls {
    margin-top: 1rem;
  }

  .carousel-control-btn {
    width: 36px;
    height: 36px;
    font-size: 0.8rem;
  }

  .custom-indicators button {
    width: 8px;
    height: 8px;
    margin: 0 3px;
  }

  .custom-indicators button.active {
    width: 24px;
  }

  /* --- CTA SECTION --- */
  .cta-section {
    padding: 3rem 0;
  }

  .cta-content {
    padding: 1.5rem;
  }

  .cta-section h2 {
    font-size: 1.4rem !important;
    line-height: 1.4;
    margin-bottom: 1rem;
  }

  .cta-section .lead {
    font-size: 0.9rem;
  }

  .cta-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 1.5rem 0;
  }

  .cta-buttons .btn {
    width: 100%;
  }

  .cta-features {
    gap: 1rem !important;
    margin-top: 2rem !important;
  }

  .feature-item {
    width: 100%;
  }

  .feature-icon {
    width: 48px;
    height: 48px;
    font-size: 1.2rem;
  }

  .feature-text h5 {
    font-size: 0.95rem;
  }

  .feature-text p {
    font-size: 0.8rem;
  }

  /* --- CONTACT SECTION --- */
  .contact-section {
    padding: 3rem 0;
  }

  .contact-card {
    padding: 1.25rem;
    margin-bottom: 1.5rem;
  }

  .contact-item {
    margin-bottom: 1.25rem;
  }

  .contact-icon {
    width: 40px;
    height: 40px;
    font-size: 1rem;
    margin-right: 0.75rem;
  }

  .contact-text h5 {
    font-size: 0.95rem;
  }

  .contact-text p {
    font-size: 0.85rem;
  }

  .contact-form-card {
    padding: 1.25rem;
    border-radius: 12px;
  }

  .form-floating > .form-control,
  .form-floating > .form-select {
    height: 52px;
    font-size: 0.9rem;
  }

  .form-floating > label {
    font-size: 0.85rem;
  }

  /* --- FAQ SECTION --- */
  .faq-section {
    padding: 3rem 0 !important;
  }

  .faq-categories {
    gap: 6px;
    padding-bottom: 0.5rem !important;
    margin-bottom: 1rem !important;
  }

  .faq-category {
    padding: 6px 12px !important;
    font-size: 0.8rem !important;
  }

  .faq-search {
    height: 44px !important;
    font-size: 0.9rem;
    padding-left: 44px !important;
  }

  .faq-search-icon {
    left: 15px !important;
    font-size: 1rem !important;
  }

  .accordion-button {
    padding: 1rem !important;
    font-size: 0.9rem !important;
  }

  .accordion-body {
    padding: 0.75rem 1rem 1rem !important;
    font-size: 0.85rem;
  }

  .accordion-body ul {
    padding-left: 1.25rem;
  }

  .accordion-body li {
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
  }

  /* --- SERVICE AREAS SECTION --- */
  #service-areas .h5 {
    font-size: 0.95rem;
  }

  #service-areas .btn-sm {
    font-size: 0.75rem;
    padding: 0.35rem 0.75rem;
    min-height: 36px;
  }

  #service-areas .btn-outline-success {
    font-size: 0.85rem;
  }

  /* --- FOOTER --- */
  footer {
    padding: 2.5rem 0 0;
  }

  .footer-logo img {
    height: 60px;
  }

  .footer-about p {
    font-size: 0.85rem;
  }

  .footer-contact h4,
  .footer-links h4 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
  }

  .footer-contact p,
  .footer-links a {
    font-size: 0.85rem;
  }

  .footer-social a {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }

  .footer-bottom {
    margin-top: 2rem;
    padding: 1rem 0;
    font-size: 0.8rem;
  }

  /* --- GLASS CARD --- */
  .glass-card {
    border-radius: 12px;
  }

  .glass-card:hover {
    transform: none;
  }

  /* --- DISABLE HOVER EFFECTS ON TOUCH --- */
  .counter-box:hover,
  .service-card:hover,
  .project-card:hover,
  .tilt-card:hover {
    transform: none;
  }

  .service-card:hover .service-image img,
  .project-card:hover .project-image img {
    transform: none;
  }

  .service-card:hover .service-icon {
    transform: none;
  }

  /* --- MAP --- */
  .map-responsive iframe {
    height: 250px;
  }

  /* --- PRELOADER --- */
  .preloader-logo {
    width: 60px;
    height: 60px;
  }

  .preloader-bar {
    width: 150px;
  }

  /* --- BACK TO TOP & CHAT --- */
  .back-to-top {
    width: 40px;
    height: 40px;
    font-size: 1rem;
    bottom: 150px;
    right: 15px;
  }

  .chat-widget {
    bottom: 80px !important;
    right: 15px !important;
  }

  .chat-toggle {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
  }

  .chat-option {
    width: 42px;
    height: 42px;
  }

  .mode-toggle {
    bottom: 150px !important;
    right: 15px !important;
  }

  .dark-mode-btn {
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }

  /* --- MOBILE BOTTOM NAV --- */
  .mobile-bottom-nav {
    display: block;
  }

  body {
    padding-bottom: 70px;
  }

  .mobile-bottom-nav .nav-item {
    font-size: 0.65rem;
    padding: 4px 8px;
  }

  .mobile-bottom-nav .nav-item i {
    font-size: 1.1rem;
  }

  .mobile-bottom-nav .nav-item.cta-item {
    padding: 6px 14px;
    font-size: 0.7rem;
  }

  /* --- SCROLL PROGRESS --- */
  .scroll-progress {
    height: 2px;
  }

  /* --- LOCATION PAGE SPECIFICS --- */
  .hero-slider .hero-content[style] {
    padding: 90px 15px 50px !important;
  }

  .breadcrumb {
    font-size: 0.8rem;
  }

  .breadcrumb-item + .breadcrumb-item::before {
    font-size: 0.75rem;
  }

  /* Card grid on location pages */
  .card.h-100 {
    margin-bottom: 0.75rem;
  }

  .card .card-body {
    padding: 1rem;
  }

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

  .card .card-text {
    font-size: 0.85rem;
    line-height: 1.6;
  }

  .alert {
    padding: 1rem;
    font-size: 0.85rem;
  }

  .alert h4, .alert h5 {
    font-size: 1rem;
  }

  /* Other locations links */
  .d-flex.flex-wrap.gap-3 {
    gap: 0.5rem !important;
  }

  .d-flex.flex-wrap .btn-outline-primary {
    font-size: 0.8rem;
    padding: 0.35rem 0.75rem;
    min-height: 36px;
  }

  /* About carousel */
  .about-carousel-wrapper {
    margin-top: 2rem;
  }
}

/* ========== EXTRA SMALL: < 576px ========== */
@media (max-width: 575.98px) {

  .hero-content h1 {
    font-size: 1.35rem !important;
  }

  .hero-content p {
    font-size: 0.85rem !important;
  }

  .section-title {
    font-size: 1.25rem !important;
  }

  .counter-box h2 {
    font-size: 1.75rem;
  }

  .counter-box p {
    font-size: 0.75rem;
  }

  .cta-section h2 {
    font-size: 1.25rem !important;
  }

  .service-image img {
    height: 160px;
  }

  .testimonial-card {
    padding: 1.75rem 1rem 1.25rem;
  }

  .testimonial-card .quote {
    font-size: 0.85rem;
  }

  /* Stack contact info nicely */
  .contact-item {
    flex-direction: column;
    text-align: center;
  }

  .contact-icon {
    margin-right: 0;
    margin-bottom: 0.5rem;
  }

  /* Full width buttons */
  .btn-lg {
    padding: 0.7rem 1.5rem;
    font-size: 0.9rem;
  }

  .btn-premium {
    padding: 12px 24px;
    font-size: 0.9rem;
  }
}

/* ========== LANDSCAPE PHONE ========== */
@media (max-width: 767.98px) and (orientation: landscape) {
  .hero-slider .carousel-item {
    min-height: 300px;
  }

  .hero-content {
    padding: 80px 20px 30px;
  }

  .hero-content h1 {
    font-size: 1.3rem !important;
  }

  .hero-content p {
    font-size: 0.8rem !important;
    margin-bottom: 0.5rem;
  }

  .hero-buttons {
    flex-direction: row;
    gap: 8px;
  }

  .hero-buttons .btn {
    width: auto;
    font-size: 0.8rem;
    padding: 8px 16px;
  }

  .floating-badge {
    display: none;
  }
}

/* ========== TABLET: 768px - 991px ========== */
@media (min-width: 768px) and (max-width: 991.98px) {

  .hero-content h1 {
    font-size: 2.2rem !important;
  }

  .service-image img {
    height: 200px;
  }

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

  .testimonial-card {
    padding: 2.5rem 1.5rem 1.5rem;
  }

  .cta-section h2 {
    font-size: 1.8rem !important;
  }

  .cta-features {
    flex-wrap: wrap;
    justify-content: center;
  }

  .feature-item {
    flex: 0 0 45%;
  }
}

/* ========== TOUCH DEVICE OPTIMIZATIONS ========== */
@media (pointer: coarse) {
  /* Larger tap targets */
  .btn {
    min-height: 44px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  /* Disable hover-dependent animations on touch */
  .tilt-card .tilt-inner {
    transform: none !important;
  }

  .tilt-card .tilt-shine {
    display: none;
  }

  .cursor-glow {
    display: none;
  }

  /* Disable hover transforms */
  .counter-box:hover {
    transform: none;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
  }

  .service-card:hover {
    transform: none;
  }

  .glass-card:hover {
    transform: none;
  }

  /* Add active states for touch feedback */
  .btn:active {
    transform: scale(0.97);
    transition: transform 0.1s ease;
  }

  .service-card:active {
    transform: scale(0.98);
    transition: transform 0.15s ease;
  }

  .accordion-button:active {
    background-color: rgba(68, 119, 254, 0.08);
  }

  /* Smoother scrolling */
  * {
    -webkit-overflow-scrolling: touch;
  }
}

/* ========== PWA / STANDALONE MODE ========== */
@media (display-mode: standalone) {
  .mobile-bottom-nav {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  body {
    padding-bottom: 80px;
  }
}

/* ========== HIGH DPI / RETINA ========== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .scroll-progress {
    height: 2px;
  }
}
