/* ==========================================
   COMPREHENSIVE MOBILE OPTIMIZATION
   Mobile-First Responsive Design
   ========================================== */

/* ===== MOBILE MENU TOGGLE ===== */
.menu-toggle {
  display: none;
  width: 48px;
  height: 48px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
  z-index: 1001;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  pointer-events: auto !important;
  -webkit-user-select: none;
  user-select: none;
}

.menu-toggle:hover {
  opacity: 0.8;
}

.menu-toggle:active {
  opacity: 0.6;
}

.menu-toggle span {
  display: block;
  width: 24px;
  height: 2.5px;
  background: currentColor;
  transition: all 0.3s ease;
  border-radius: 2px;
  transform-origin: center;
}

.menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(10px, 10px);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

/* ===== MOBILE NAVIGATION ===== */
.mobile-nav-overlay {
  display: none !important;
}

.mobile-nav {
  display: none !important;
}

/* ===== RESPONSIVE HEADER ===== */
@media (max-width: 992px) {
  .site-header {
    min-height: 70px;
  }

  .header-inner {
    display: flex;
    align-items: center;
    min-height: 70px;
    gap: 8px;
    padding: 0 12px;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .logo {
    font-size: 16px;
    flex: 0 0 auto;
  }

  .logo img {
    height: 36px;
  }

  .nav {
    display: flex !important;
    flex: 1;
    justify-content: flex-start;
    margin: 0 auto;
  }

  .nav-list {
    gap: 12px;
  }

  .nav-link {
    font-size: 12px;
    font-weight: 400;
  }

  .header-cta {
    display: flex !important;
    justify-content: flex-end;
    flex: 0 0 auto;
  }

  .header-cta .btn {
    padding: 8px 12px;
    font-size: 11px;
  }

  .menu-toggle {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .header-inner {
    gap: 6px;
    padding: 0 10px;
  }

  .logo {
    font-size: 14px;
  }

  .logo img {
    height: 32px;
  }

  .nav-list {
    gap: 8px;
  }

  .nav-link {
    font-size: 11px;
    padding: 4px 6px;
  }

  .nav-link::after {
    bottom: -5px;
  }

  .header-cta .btn {
    padding: 6px 10px;
    font-size: 10px;
  }
}

@media (max-width: 480px) {
  .header-inner {
    gap: 4px;
    padding: 0 8px;
  }

  .logo {
    font-size: 12px;
  }

  .logo img {
    height: 28px;
  }

  .logo span {
    display: none;
  }

  .nav-list {
    gap: 4px;
  }

  .nav-link {
    font-size: 10px;
    padding: 2px 4px;
  }

  .nav-link::after {
    bottom: -4px;
    height: 1px;
  }

  .header-cta {
    display: none !important;
  }

  .dropdown-menu {
    display: none;
  }
}

/* ===== RESPONSIVE SECTIONS ===== */
@media (max-width: 768px) {
  .container {
    width: min(100% - 32px, var(--container));
    margin: 0 auto;
  }

  .section {
    padding: 50px 0;
  }

  .section-sm {
    padding: 40px 0;
  }

  .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 28px;
  }

  .section-title {
    font-size: clamp(20px, 6vw, 40px);
  }

  .section-desc {
    font-size: 14px;
  }
}

/* ===== RESPONSIVE HERO ===== */
@media (max-width: 768px) {
  .hero-card,
  .hero-card img {
    min-height: 60vh;
    height: 60vh;
  }

  .hero-content {
    left: 20px;
    right: 20px;
    bottom: 40px;
    gap: 16px;
  }

  .hero-title {
    font-size: clamp(20px, 8vw, 36px);
    line-height: 1.1;
  }

  .hero-text {
    font-size: 14px;
    max-width: 100%;
  }

  .hero-actions {
    flex-direction: column;
    gap: 10px;
  }

  .hero-actions .btn {
    width: 100%;
  }
}

/* ===== RESPONSIVE GRIDS ===== */
@media (max-width: 1200px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .team-grid {
    grid-template-columns: 1fr;
  }

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

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

  .offer-wrap,
  .contact-grid,
  .content-grid-2,
  .service-detail-grid,
  .blog-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .projects-grid,
  .stats-grid,
  .team-grid,
  .services-grid,
  .blog-grid,
  .team-grid,
  .form-grid,
  .content-grid-2 {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .project-card-title {
    font-size: 20px;
    padding: 16px 12px;
  }

  .offer-wrap,
  .contact-grid,
  .service-detail-grid,
  .blog-detail-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

/* ===== RESPONSIVE PAGE HERO ===== */
@media (max-width: 768px) {
  .page-hero {
    padding: 70px 0 20px;
  }

  .page-hero-card {
    border-radius: 16px;
    padding: 24px 16px;
  }

  .page-hero-title {
    font-size: clamp(20px, 6vw, 32px);
    margin-bottom: 12px;
  }

  .page-hero-text {
    font-size: 14px;
    line-height: 1.8;
    margin-bottom: 20px;
  }
}

/* ===== RESPONSIVE CARDS ===== */
@media (max-width: 768px) {
  .card,
  .page-hero-card,
  .about-card,
  .feature-card,
  .service-card,
  .blog-card,
  .team-card,
  .offer-content,
  .offer-form,
  .contact-box {
    padding: 16px;
    border-radius: 16px;
  }

  .team-card {
    max-width: 100%;
  }

  .team-card img {
    height: 180px;
  }

  .team-card-body {
    padding: 12px;
  }
}

/* ===== RESPONSIVE TYPOGRAPHY ===== */
@media (max-width: 768px) {
  h1 {
    font-size: clamp(20px, 6vw, 36px);
  }

  h2 {
    font-size: clamp(18px, 5vw, 28px);
  }

  h3 {
    font-size: clamp(16px, 4vw, 22px);
  }

  .hero-title {
    font-size: clamp(20px, 8vw, 36px);
  }

  .section-title {
    font-size: clamp(18px, 5vw, 28px);
    margin-bottom: 12px;
  }

  .eyebrow {
    font-size: 10px;
    margin-bottom: 10px;
  }

  body {
    font-size: 14px;
  }
}

/* ===== RESPONSIVE BUTTONS ===== */
@media (max-width: 768px) {
  .btn {
    padding: 12px 16px;
    font-size: 13px;
    min-height: 44px;
    border-radius: 10px;
  }

  .btn-group,
  .hero-actions,
  .contact-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .btn-group .btn,
  .hero-actions .btn,
  .contact-actions .btn {
    width: 100%;
  }
}

/* ===== RESPONSIVE FORMS ===== */
@media (max-width: 768px) {
  .form-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .form-group.full {
    grid-column: span 1;
  }

  .form-control {
    padding: 12px 12px;
    font-size: 16px;
    border-radius: 10px;
  }

  textarea.form-control {
    min-height: 100px;
  }

  .form-control:focus {
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
  }
}

/* ===== RESPONSIVE IMAGES ===== */
@media (max-width: 768px) {
  .detail-main-image,
  .service-detail-image img,
  .blog-detail-image img {
    border-radius: 12px;
  }

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

  .detail-gallery-image {
    height: 140px;
  }

  .project-card-media {
    aspect-ratio: 4 / 3;
  }

  .service-card-image {
    min-height: 180px;
  }

  .blog-card img {
    height: 180px;
  }
}

/* ===== RESPONSIVE FOOTER ===== */
@media (max-width: 768px) {
  .site-footer {
    padding: 40px 0 20px;
    margin-top: 40px;
  }

  .footer-top {
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 24px;
  }

  .footer-brand h3 {
    font-size: 20px;
    margin-bottom: 10px;
  }

  .footer-col h4 {
    font-size: 13px;
    margin-bottom: 10px;
  }

  .footer-col ul {
    gap: 8px;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 10px;
    padding-top: 12px;
    font-size: 11px;
  }
}

/* ===== RESPONSIVE SIDEBAR ===== */
@media (max-width: 768px) {
  .service-sidebar-card,
  .blog-sidebar-card,
  .project-detail-sidebar {
    position: relative;
    top: auto;
    margin-top: 24px;
  }
}

/* ===== RESPONSIVE TABLES ===== */
@media (max-width: 768px) {
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    font-size: 12px;
  }

  table th,
  table td {
    padding: 10px 8px;
  }
}

/* ===== RESPONSIVE CONTACT ===== */
@media (max-width: 768px) {
  .contact-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .contact-box {
    padding: 20px;
    border-radius: 16px;
  }

  .contact-box h3 {
    font-size: 18px;
    margin-bottom: 10px;
  }

  .map-box iframe {
    min-height: 250px;
  }
}

/* ===== TOUCH OPTIMIZATION ===== */
@media (hover: none) and (pointer: coarse) {
  .btn,
  a,
  button {
    min-height: 44px;
    min-width: 44px;
  }

  .nav-link,
  .dropdown-menu a {
    padding: 12px 8px;
  }

  .form-control {
    padding: 14px;
    font-size: 16px;
  }

  .menu-toggle {
    width: 48px;
    height: 48px;
  }
}

/* ===== EXTRA SMALL DEVICES ===== */
@media (max-width: 480px) {
  .container {
    width: min(100% - 24px, var(--container));
  }

  .section {
    padding: 32px 0;
  }

  .header-inner {
    gap: 6px;
  }

  .logo {
    font-size: 14px;
  }

  .logo img {
    height: 32px;
  }

  .btn {
    padding: 10px 12px;
    font-size: 12px;
    border-radius: 8px;
  }

  .page-hero-card {
    padding: 16px 12px;
  }

  .page-hero-text {
    font-size: 13px;
  }

  .hero-content {
    left: 12px;
    right: 12px;
    bottom: 24px;
  }

  .project-gallery {
    grid-template-columns: 1fr;
  }

  .detail-gallery-image {
    height: 180px;
  }

  .card,
  .page-hero-card,
  .service-card,
  .blog-card,
  .team-card {
    padding: 12px;
  }

  .team-card img {
    height: 160px;
  }

  h1,
  h2 {
    font-size: clamp(16px, 5vw, 24px);
  }

  .form-control,
  .btn {
    border-radius: 8px;
  }

  .contact-box {
    padding: 12px;
  }

  .map-box iframe {
    min-height: 200px;
  }

  .stats-grid,
  .projects-grid,
  .services-grid,
  .blog-grid,
  .team-grid,
  .form-grid {
    gap: 12px;
  }

  .hero-title {
    font-size: clamp(16px, 7vw, 28px);
  }

  .hero-text {
    font-size: 12px;
  }
}

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

/* ===== PROJECT DETAIL RESPONSIVE ===== */
@media (max-width: 768px) {
  .project-detail-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .project-detail-main {
    order: 1;
  }

  .project-detail-sidebar {
    order: 2;
    position: relative;
    top: auto;
  }

  .detail-main-image {
    width: 100%;
    height: auto;
    border-radius: 12px;
    margin-bottom: 16px;
  }

  .project-gallery {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 16px;
  }

  .detail-gallery-image {
    height: 130px;
    cursor: pointer;
  }

  .project-meta-card,
  .project-map-card {
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 12px;
  }

  .project-meta-card h4,
  .project-map-card h4 {
    font-size: 14px;
    margin-bottom: 12px;
  }

  .project-meta-list {
    font-size: 13px;
  }

  .project-meta-list li {
    margin-bottom: 10px;
  }

  .project-description {
    font-size: 14px;
    line-height: 1.7;
    margin-top: 16px;
  }
}

@media (max-width: 480px) {
  .project-gallery {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .detail-gallery-image {
    height: 180px;
  }

  .project-meta-card,
  .project-map-card {
    padding: 12px;
  }

  .project-meta-list li {
    font-size: 12px;
    margin-bottom: 8px;
  }
}

/* ===== LIGHTBOX MODAL RESPONSIVE ===== */
@media (max-width: 768px) {
  .modal-gallery {
    padding: 0;
  }

  .modal-gallery-content {
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    max-height: 80vh;
    overflow: auto;
  }

  .modal-gallery-image {
    width: 100%;
    height: auto;
    max-height: 75vh;
    object-fit: contain;
  }

  .modal-gallery-close {
    top: 16px;
    right: 16px;
    font-size: 32px;
    background: rgba(0, 0, 0, 0.6);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
  }

  .modal-gallery-nav {
    font-size: 24px;
    padding: 12px 16px;
    width: auto;
    height: auto;
    background: rgba(0, 0, 0, 0.5);
  }

  .modal-gallery-prev {
    left: 12px;
  }

  .modal-gallery-next {
    right: 12px;
  }

  .modal-gallery-counter {
    bottom: 16px;
    font-size: 13px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
  }
}

@media (max-width: 480px) {
  .modal-gallery-nav {
    font-size: 20px;
    padding: 10px 12px;
  }

  .modal-gallery-close {
    top: 12px;
    right: 12px;
    font-size: 24px;
    width: 36px;
    height: 36px;
  }

  .modal-gallery-counter {
    bottom: 12px;
    font-size: 12px;
  }
}

/* ===== SERVICE DETAIL RESPONSIVE ===== */
@media (max-width: 768px) {
  .service-detail-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .service-detail-image {
    margin-bottom: 0;
  }

  .service-detail-image img {
    border-radius: 12px;
  }

  .service-detail-text {
    font-size: 14px;
    line-height: 1.7;
  }

  .service-sidebar-card {
    position: relative;
    top: auto;
    background: var(--surface);
    padding: 16px;
  }

  .service-detail-cta {
    flex-direction: column;
    gap: 10px;
  }

  .service-detail-cta .btn {
    width: 100%;
  }
}

/* ===== BLOG DETAIL RESPONSIVE ===== */
@media (max-width: 768px) {
  .blog-detail-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .blog-detail-image {
    margin-bottom: 0;
  }

  .blog-detail-image img {
    border-radius: 12px;
  }

  .blog-detail-text {
    font-size: 14px;
    line-height: 1.7;
  }

  .blog-detail-text h2,
  .blog-detail-text h3 {
    margin-top: 20px;
    margin-bottom: 12px;
    font-size: 18px;
  }

  .blog-sidebar-card {
    position: relative;
    top: auto;
    background: var(--surface);
    padding: 16px;
  }

  .related-posts {
    gap: 12px;
  }

  .related-post-item {
    padding: 10px;
    gap: 10px;
  }

  .related-post-image {
    width: 50px;
    height: 50px;
  }

  .related-post-content h4 {
    font-size: 11px;
  }

  .related-post-date {
    font-size: 10px;
  }
}

/* ===== SERVICE PAGE RESPONSIVE ===== */
@media (max-width: 768px) {
  .services-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .service-card {
    border-radius: 12px;
    overflow: hidden;
  }

  .service-card-image {
    min-height: 160px;
  }

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

  .service-card h3 {
    font-size: 18px;
    margin-bottom: 8px;
  }

  .service-card p {
    font-size: 13px;
    line-height: 1.6;
  }

  .service-card-link {
    font-size: 12px;
    margin-top: 10px;
  }
}

/* ===== BLOG PAGE RESPONSIVE ===== */
@media (max-width: 768px) {
  .blog-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .blog-card {
    border-radius: 12px;
    overflow: hidden;
  }

  .blog-card img {
    height: 160px;
  }

  .blog-info {
    padding: 16px;
  }

  .blog-info h3 {
    font-size: 16px;
    margin-bottom: 8px;
  }

  .blog-info p {
    font-size: 13px;
    line-height: 1.6;
  }

  .blog-meta {
    font-size: 11px;
    margin-bottom: 8px;
  }
}

/* ===== CONTACT FORM RESPONSIVE ===== */
@media (max-width: 768px) {
  .contact-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .contact-box {
    padding: 16px;
    border-radius: 12px;
  }

  .contact-box h3 {
    font-size: 16px;
    margin-bottom: 12px;
  }

  .contact-list {
    gap: 10px;
  }

  .contact-list li {
    font-size: 13px;
  }

  .map-box iframe {
    min-height: 280px;
    border-radius: 12px;
  }
}

/* ===== OFFER FORM RESPONSIVE ===== */
@media (max-width: 768px) {
  .offer-wrap {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .offer-content,
  .offer-form {
    padding: 16px;
    border-radius: 12px;
  }

  .offer-content h2 {
    font-size: 18px;
  }

  .offer-content p {
    font-size: 13px;
  }

  .offer-points li {
    font-size: 13px;
    gap: 10px;
  }

  .offer-form {
    padding: 16px;
  }

  .form-grid {
    gap: 12px;
  }

  .form-group label {
    font-size: 12px;
  }

  .form-control {
    font-size: 14px;
    padding: 12px;
  }
}

/* ===== OVERFLOW & CONTAINER FIXES ===== */
@media (max-width: 768px) {
  /* Prevent horizontal scrolling */
  html,
  body {
    width: 100%;
    overflow-x: hidden !important;
  }

  main {
    width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
  }

  .container {
    box-sizing: border-box;
    width: 100% !important;
    padding: 0 16px;
    margin: 0 auto;
  }

  /* Ensure all content respects viewport width */
  img {
    width: 100%;
    height: auto;
    max-width: 100%;
  }

  iframe {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Detail pages and cards */
  .project-detail-grid,
  .service-detail-grid,
  .blog-detail-grid {
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }

  .card,
  [class*="card-"] {
    box-sizing: border-box;
    width: 100%;
  }

  /* Section padding */
  .section {
    padding: 40px 0;
    width: 100%;
    overflow-x: hidden;
  }

  .section-sm {
    padding: 30px 0;
    width: 100%;
    overflow-x: hidden;
  }

  /* Remove back button margin issues */
  .mt-4 {
    margin-top: 16px !important;
  }

  .mt-5 {
    margin-top: 20px !important;
  }
}

@media (max-width: 480px) {
  .container {
    width: 100% !important;
    padding: 0 12px !important;
  }

  .section {
    padding: 24px 0;
  }

  .section-sm {
    padding: 20px 0;
  }

  .mt-4 {
    margin-top: 12px !important;
  }

  .mt-5 {
    margin-top: 16px !important;
  }
}

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