/* Mobile Responsive Styles */

/* Apple status bar */
@supports (padding: max(0px)) {
  body {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
}

/* Services Grid Responsive Layout */
.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

/* Base mobile settings */
@media (max-width: 767px) {
  html, body {
    font-size: 14px;
    overflow-x: hidden;
  }

  h1 {
    font-size: 1.8rem !important;
  }

  h2 {
    font-size: 1.5rem !important;
  }

  h3 {
    font-size: 1.3rem !important;
  }

  h4 {
    font-size: 1.1rem !important;
  }

  p {
    font-size: 0.95rem !important;
  }

  /* Hero section */
  .hero-section {
    padding: 60px 0 !important;
    background-position: center center !important;
  }

  .hero-section .col-lg-6 {
    width: 100% !important;
    margin-bottom: 30px;
  }

  .hero-content h1 {
    font-size: 2.2rem !important;
    line-height: 1.3 !important;
    margin-bottom: 15px !important;
  }

  .hero-content p {
    font-size: 1rem !important;
    margin-bottom: 25px !important;
  }

  .buttons {
    flex-direction: column !important;
    gap: 10px !important;
  }

  .buttons a {
    width: 100% !important;
    text-align: center !important;
    padding: 14px 25px !important;
    font-size: 0.95rem !important;
  }

  /* Navigation */
  .header-area .container {
    padding: 0 15px;
  }

  .main-nav {
    flex-wrap: wrap;
  }

  .main-nav .logo img {
    max-height: 50px;
  }

  /* Card layout */
  .col-lg-4 {
    width: 100% !important;
    margin-bottom: 20px;
  }

  .col-lg-3 {
    width: 100% !important;
    margin-bottom: 20px;
  }

  .col-lg-6 {
    width: 100% !important;
    margin-bottom: 20px;
  }

  .service-card img {
    height: 200px !important;
  }

  /* Padding adjustments */
  section {
    padding: 40px 0 !important;
  }

  .container {
    padding: 0 15px;
  }

  /* Why Choose Us icons */
  [style*="width: 80px; height: 80px"] {
    width: 60px !important;
    height: 60px !important;
  }

  [style*="font-size: 2rem; color: #00d4ff"] {
    font-size: 1.5rem !important;
  }

  /* Process section circles */
  [style*="width: 60px; height: 60px"] {
    width: 50px !important;
    height: 50px !important;
    font-size: 1.3rem !important;
  }

  /* CTA Section */
  .cta-section h3 {
    font-size: 1.5rem !important;
    margin-bottom: 15px !important;
  }

  .cta-section p {
    font-size: 0.95rem !important;
  }

  .cta-section .col-lg-4 {
    margin-top: 20px !important;
  }

  /* Footer adjustments */
  footer {
    padding: 30px 0 15px !important;
  }

  footer .col-lg-3 {
    margin-bottom: 25px;
  }

  footer h5 {
    font-size: 1.1rem !important;
    margin-bottom: 15px !important;
  }

  footer p, footer ul {
    font-size: 0.9rem !important;
  }

  /* Buttons touch target */
  a[style*="padding: 15px 40px"],
  a[style*="padding: 12px 30px"],
  .btn {
    min-height: 44px !important;
    min-width: 44px !important;
    padding: 12px 30px !important;
  }

  /* Page heading */
  [style*="padding: 80px 0"] {
    padding: 40px 0 !important;
  }

  [style*="font-size: 3rem"] {
    font-size: 1.8rem !important;
  }

  /* Energy solutions section */
  [style*="min-height: 400px"] {
    min-height: 300px !important;
    padding: 30px !important;
  }

  /* Ensure text remains readable */
  [style*="text-shadow"] {
    text-shadow: 0 2px 10px rgba(0,0,0,0.4) !important;
  }

  /* Stack inline elements */
  .row > div {
    flex: 0 0 100%;
    max-width: 100%;
  }

  /* Tab and form elements */
  input, select, textarea {
    font-size: 16px !important;
  }

  /* Avoid zoom on input focus (iOS) */
  input, select, textarea, button {
    font-size: 16px;
  }

  /* Services grid mobile (1 column) */
  .services-grid {
    grid-template-columns: 1fr !important;
    gap: 15px !important;
  }
}

/* Small phones (320px - 480px) */
@media (max-width: 480px) {
  html, body {
    font-size: 13px;
  }

  .hero-content h1 {
    font-size: 1.8rem !important;
    margin-bottom: 12px !important;
  }

  .hero-content p {
    font-size: 0.95rem !important;
    margin-bottom: 20px !important;
  }

  .buttons a {
    padding: 12px 20px !important;
    font-size: 0.9rem !important;
  }

  h2 {
    font-size: 1.3rem !important;
  }

  /* Even tighter padding */
  .container {
    padding: 0 12px;
  }

  section {
    padding: 30px 0 !important;
  }

  /* Smaller card images */
  .service-card img {
    height: 180px !important;
  }

  /* Mobile icon sizes */
  [style*="font-size: 4rem"] {
    font-size: 2.5rem !important;
  }

  [style*="font-size: 2.5rem"] {
    font-size: 1.8rem !important;
  }

  /* Energy cards */
  [style*="min-height: 400px"] {
    min-height: 250px !important;
    padding: 20px !important;
  }

  [style*="font-size: 2.2rem"] {
    font-size: 1.5rem !important;
  }

  /* Footer text size */
  footer {
    padding: 25px 0 12px !important;
  }

  footer h5 {
    font-size: 1rem !important;
    margin-bottom: 12px !important;
  }

  footer p, footer ul {
    font-size: 0.85rem !important;
  }

  footer [style*="margin-right: 10px"] {
    margin-right: 6px !important;
  }

  /* Services grid small phones (1 column) */
  .services-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
}

/* Tablets (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
  h1 {
    font-size: 2.2rem !important;
  }

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

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

  .col-lg-4 {
    width: calc(50% - 10px) !important;
    display: inline-block;
    margin-right: 10px;
    margin-bottom: 20px;
  }

  .col-lg-4:nth-child(odd) {
    margin-right: 10px;
  }

  .col-lg-4:nth-child(even) {
    margin-right: 0;
  }

  .col-lg-3 {
    width: calc(50% - 10px) !important;
    display: inline-block;
    margin-bottom: 20px;
  }

  .service-card img {
    height: 220px !important;
  }

  section {
    padding: 50px 0 !important;
  }

  /* Services grid tablets (2 columns) */
  .services-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 18px !important;
  }
}

/* Landscape orientation adjustments */
@media (max-height: 500px) {
  .hero-section {
    padding: 40px 0 !important;
  }

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

  .hero-content p {
    font-size: 0.9rem !important;
    margin-bottom: 15px !important;
  }

  section {
    padding: 30px 0 !important;
  }
}

/* Fix for touch devices - no hover effects on actual touch */
@media (hover: none) and (pointer: coarse) {
  a:active {
    opacity: 0.8;
  }

  button:active {
    opacity: 0.8;
  }

  .service-card:active {
    transform: translateY(-5px) !important;
  }
}

/* Print styles */
@media print {
  header, footer, .no-print {
    display: none;
  }

  body {
    background: white;
  }
}

/* Mobile Menu Fixes */
@media (max-width: 767px) {
  .header-area .menu-trigger {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    right: 15px !important;
    z-index: 999 !important;
    width: 45px;
    height: 45px;
    top: 18px !important;
    padding: 0;
    border: none;
    background: transparent;
  }

  .header-area .main-nav .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    background: #fff;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    margin: 0 !important;
    padding: 0 !important;
    border-top: 1px solid #eee;
    z-index: 98;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
  }

  .header-area {
    position: relative;
    z-index: 100;
  }

  .header-area .main-nav .nav li {
    width: 100%;
    display: block !important;
    border-bottom: 1px solid #eee;
    padding: 0 !important;
    margin: 0 !important;
  }

  .header-area .main-nav .nav li a {
    display: block;
    padding: 15px 20px !important;
    min-height: 44px;
    line-height: 1.5;
    border: none !important;
    background: #fff !important;
    color: #1e3c72 !important;
    font-size: 0.95rem;
    text-decoration: none;
    word-break: break-word;
  }

  .header-area .main-nav .nav li a:active,
  .header-area .main-nav .nav li a:hover {
    background: #f0f0f0 !important;
    color: #1e3c72 !important;
  }

  .header-area .main-nav .nav li.has-sub > a:after {
    float: right;
    margin-right: 10px;
  }

  .header-area .main-nav .nav li.has-sub ul.sub-menu {
    position: static;
    visibility: visible;
    opacity: 1;
    transform: none;
    height: auto;
    box-shadow: none;
    background: #f7f7f7;
    width: 100%;
    top: auto;
    left: auto;
  }

  .header-area .main-nav .nav li.has-sub ul.sub-menu li a {
    padding: 12px 20px 12px 35px !important;
    font-size: 0.9rem;
  }

  .header-area .main-nav .menu-trigger span,
  .header-area .main-nav .menu-trigger span:before,
  .header-area .main-nav .menu-trigger span:after {
    background-color: #1e3c72 !important;
    width: 24px !important;
    height: 2px !important;
    display: block;
    transition: all 0.3s ease;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }

  .header-area .main-nav .menu-trigger span {
    top: 50%;
    margin-top: -1px;
  }

  .header-area .main-nav .menu-trigger span:before {
    content: "";
    top: -8px;
  }

  .header-area .main-nav .menu-trigger span:after {
    content: "";
    top: 8px;
  }

  .header-area .main-nav .menu-trigger.active span {
    background-color: transparent !important;
  }

  .header-area .main-nav .menu-trigger.active span:before {
    transform: translateX(-50%) rotate(45deg) translateY(0) !important;
    top: 0;
  }

  .header-area .main-nav .menu-trigger.active span:after {
    transform: translateX(-50%) rotate(-45deg) translateY(0) !important;
    top: 0;
  }

  .background-header .menu-trigger span,
  .background-header .menu-trigger span:before,
  .background-header .menu-trigger span:after {
    background-color: #1e3c72 !important;
  }
}

/* iPhone X notch support */
@supports (padding: max(0px)) {
  body {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  header {
    padding-top: max(0px, env(safe-area-inset-top));
  }

  footer {
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }
}
