/* Mobile-First Optimizations for Portfolio Website */
/* ================================================= */

/* Base Mobile Styles (Mobile-First Approach) */
@media screen and (max-width: 991px) {
  /* Improved Mobile Navigation */
  header.mobile-header-1 {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(249, 249, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    padding: 15px 0;
  }

  /* Larger Touch Targets for Menu Button */
  .menu-icon button {
    padding: 15px;
    min-width: 48px;
    min-height: 48px;
  }

  /* Smoother Menu Animation */
  header.desktop-header-1 {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 5px 0 30px rgba(0, 0, 0, 0.1);
  }

  /* Optimize Main Content Spacing */
  main.content {
    margin-left: 0 !important;
    padding-top: 60px; /* Account for fixed header */
  }

  /* Mobile-Optimized Home Section */
  section.home {
    padding: 120px 0 80px 0 !important;
    min-height: 100vh;
    display: flex;
    align-items: center;
  }

  /* Smaller Profile Image on Mobile */
  section.home img.circle {
    width: 180px !important;
    height: 180px !important;
    margin-bottom: 20px;
  }

  /* Responsive Typography */
  h1 {
    font-size: 28px !important;
    line-height: 1.3;
  }

  h2.section-title {
    font-size: 24px !important;
    margin-bottom: 10px;
  }

  .text-rotating {
    font-size: 16px !important;
    line-height: 1.6;
  }

  /* Hide Parallax Icons on Mobile (Performance) */
  .parallax {
    display: none !important;
  }

  /* Mobile Terminal Optimization */
  .Terminal__body {
    font-size: 14px !important;
    padding: 15px !important;
  }

  .terminal-content {
    padding: 10px !important;
  }

  .terminal-line {
    margin-bottom: 15px !important;
    line-height: 1.6;
  }

  /* Responsive Skill Tags */
  .skills-container {
    flex-wrap: wrap;
    gap: 8px;
  }

  .skill-tag {
    font-size: 12px !important;
    padding: 4px 10px !important;
  }

  /* Mobile Stats Grid */
  .stats-row {
    margin: 0 -10px;
  }

  .stat-box {
    padding: 20px 10px !important;
    margin-bottom: 15px;
  }

  .stat-number {
    font-size: 24px !important;
  }

  .stat-text {
    font-size: 12px !important;
  }

  /* Mobile Service Cards */
  .services-grid {
    padding: 0 10px;
  }

  .service-card {
    margin-bottom: 20px;
    padding: 25px 20px !important;
  }

  .service-card h3 {
    font-size: 20px !important;
  }

  .service-features {
    padding-left: 40px !important;
  }

  .service-features li {
    font-size: 14px !important;
    padding: 8px 0 !important;
  }

  /* Mobile Contact Form */
  .ios-contact-form {
    padding: 0 10px;
  }

  .ios-form-group {
    margin-bottom: 20px !important;
  }

  .ios-form-control {
    font-size: 16px !important; /* Prevent zoom on iOS */
    padding: 15px 15px 15px 50px !important;
  }

  .ios-textarea {
    min-height: 120px !important;
  }

  /* Mobile Buttons */
  .ios-button {
    width: 100% !important;
    padding: 15px 25px !important;
    font-size: 16px !important;
    margin-bottom: 15px;
  }

  /* Mobile CTA Banner */
  .cta-banner {
    padding: 40px 20px !important;
    text-align: center;
  }

  .cta-banner h2 {
    font-size: 22px !important;
    margin-bottom: 15px;
  }

  /* Mobile Globe Container */
  #globe-container {
    max-width: 250px !important;
    margin: 30px auto !important;
  }

  /* Mobile Collaborators Grid */
  .collaborators-grid {
    padding: 0 20px;
  }

  .collaborator-logo {
    width: 100px !important;
    height: 40px !important;
  }

  /* Mobile Footer */
  .footer {
    padding: 20px 15px !important;
    text-align: center;
  }

  /* Language Flags Mobile */
  .footer .list-inline {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
  }

  .footer .list-inline-item {
    margin: 0 !important;
  }

  /* Mobile Scroll Performance */
  * {
    -webkit-overflow-scrolling: touch;
  }

  /* Disable hover effects on touch devices */
  @media (hover: none) {
    .service-card:hover {
      transform: none !important;
      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1) !important;
    }

    .ios-button:hover {
      transform: none !important;
    }
  }
}

/* Small Mobile Devices (max-width: 576px) */
@media screen and (max-width: 576px) {
  /* Even smaller text for tiny screens */
  h1 {
    font-size: 24px !important;
  }

  h2.section-title {
    font-size: 20px !important;
  }

  /* Compact profile section */
  section.home img.circle {
    width: 150px !important;
    height: 150px !important;
  }

  /* Stack buttons vertically */
  .row .col-md-6 {
    margin-bottom: 10px;
  }

  /* Smaller padding overall */
  .container {
    padding-left: 15px;
    padding-right: 15px;
  }

  section {
    padding: 60px 0 !important;
  }

  /* Mobile terminal adjustments */
  .Terminal__Toolbar {
    padding: 8px !important;
  }

  .Toolbar__title {
    font-size: 12px !important;
  }

  /* Compact stats */
  .col-6 {
    padding: 0 5px;
  }

  /* Single column for service cards */
  .services-grid {
    grid-template-columns: 1fr !important;
  }

  /* Floating Cal button adjustments */
  div[style*="position: fixed"] {
    bottom: 10px !important;
    right: 10px !important;
  }

  div[style*="position: fixed"] button {
    padding: 12px 15px !important;
    font-size: 12px !important;
  }
}

/* Touch-Friendly Interactions */
@media (pointer: coarse) {
  /* Larger tap targets */
  a, button, .ios-button, .menu-icon button {
    min-height: 44px;
    min-width: 44px;
  }

  /* Remove small hover areas */
  .social-icons a {
    padding: 10px;
    margin: 0 5px;
  }

  /* Improve form usability */
  input, textarea, select {
    min-height: 48px;
  }

  /* Disable parallax on touch devices */
  .parallax-icon {
    position: absolute !important;
    transform: none !important;
  }
}

/* Performance Optimizations */
@media screen and (max-width: 991px) {
  /* Reduce animations on mobile */
  * {
    animation-duration: 0.3s !important;
  }

  /* Disable complex animations */
  .wow {
    animation: none !important;
  }

  /* Optimize images */
  img {
    image-rendering: -webkit-optimize-contrast;
  }

  /* Reduce box shadows for performance */
  .shadow-dark {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1) !important;
  }
}

/* Landscape Mobile Adjustments */
@media screen and (max-width: 991px) and (orientation: landscape) {
  section.home {
    padding: 80px 0 60px 0 !important;
    min-height: auto;
  }

  section.home img.circle {
    width: 120px !important;
    height: 120px !important;
  }

  h1 {
    font-size: 24px !important;
  }

  .text-rotating {
    display: none !important;
  }
}

/* iOS Specific Fixes */
@supports (-webkit-touch-callout: none) {
  /* Fix iOS form zoom */
  input, textarea, select {
    font-size: 16px !important;
  }

  /* Fix iOS momentum scrolling */
  .ios-scroll-fix {
    -webkit-overflow-scrolling: touch;
    overflow-y: scroll;
  }

  /* Fix iOS button appearance */
  button, .ios-button {
    -webkit-appearance: none;
    appearance: none;
  }
}

/* Accessibility Improvements for Mobile */
@media screen and (max-width: 991px) {
  /* Better contrast for outdoor viewing */
  body {
    color: #454360;
  }

  /* Larger tap targets for accessibility */
  .vertical-menu a {
    padding: 15px 20px;
    font-size: 16px;
  }

  /* Focus indicators */
  a:focus, button:focus, input:focus, textarea:focus {
    outline: 3px solid #ff4c60;
    outline-offset: 2px;
  }
}

/* Print Styles for Mobile */
@media print {
  /* Hide unnecessary elements */
  header, .parallax, .footer, .ios-button, div[style*="position: fixed"] {
    display: none !important;
  }

  /* Optimize for printing */
  body {
    font-size: 12pt;
    line-height: 1.5;
    color: #000;
    background: #fff;
  }
}

/* Touch Active States */
.touch-active {
  transform: scale(0.98) !important;
  opacity: 0.9 !important;
  transition: all 0.1s ease !important;
}

/* Mobile Tooltip Styles */
.mobile-tooltip {
  position: fixed;
  background: #454360;
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  z-index: 10000;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Mobile Menu Overlay */
main.menu-open::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
  opacity: 0;
  animation: fadeIn 0.3s forwards;
}

/* Mobile Header Shadow on Scroll */
.mobile-header-1.scrolled {
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.15);
}

/* Viewport Height Fix for Mobile Browsers */
.home {
  min-height: 100vh;
  min-height: calc(var(--vh, 1vh) * 100);
}

/* Improved Focus States for Accessibility */
@media screen and (max-width: 991px) {
  input:focus,
  textarea:focus,
  select:focus,
  button:focus {
    outline: 3px solid #ff4c60;
    outline-offset: 2px;
  }

  /* Form Group Focus Animation */
  .ios-form-group.focused {
    transform: scale(1.02);
    transition: transform 0.3s ease;
  }
}

/* Optimized Mobile Transitions */
@media screen and (max-width: 991px) {
  * {
    transition-duration: 0.2s !important;
  }

  /* Smooth menu transitions */
  header.desktop-header-1,
  header.mobile-header-1,
  main.content {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }
}