/* Mobile-specific styles for TripTune */

/* Define color variables for use with rgba */
:root {
  --primary-rgb: 45, 212, 191;  /* #2dd4bf */
  --secondary-rgb: 167, 139, 250; /* #a78bfa */
  --accent-rgb: 245, 158, 11; /* #f59e0b */
}

/* Global fixes to prevent horizontal scrolling */
html, body {
  overflow-x: hidden;
  position: relative;
  width: 100%;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* Professional navbar fixes */
nav, .navbar {
  width: 100%;
  max-width: 100%;
  overflow: visible;
}

.navbar {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.navbar-start, .navbar-center, .navbar-end {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
}

/* Fix for navbar container */
.container {
  width: 100%;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

/* Fix mobile menu */
.mobile-nav {
  width: 100%;
  max-width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Navbar-specific fix to prevent unwanted scrolling */
.navbar-end {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  overflow: visible;
  flex-shrink: 0;
  max-width: 100%;
}

/* Remove any scrollbars in the navbar */
.navbar::-webkit-scrollbar,
.navbar-end::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

/* Hide scrollbars for Firefox */
.navbar, .navbar-end {
  scrollbar-width: none;
}

/* Ensure dropdown content is fully visible */
.dropdown .dropdown-content {
  z-index: 100;
  overflow: visible;
  max-height: 80vh;
  overflow-y: auto;
  width: auto !important;
  min-width: 16rem !important;
  left: auto !important;
  right: 0 !important;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
}

/* Custom breakpoint for extra small screens */
@media (min-width: 475px) {
  .xs\:inline-block {
    display: inline-block !important;
  }
  
  .xs\:flex-row {
    flex-direction: row !important;
  }
  
  .xs\:ml-1 {
    margin-left: 0.25rem !important;
  }
  
  .xs\:hidden {
    display: none !important;
  }
}

/* Extra small screens and below */
@media (max-width: 474px) {
  .max-xs\:text-center {
    text-align: center !important;
  }
  
  .max-xs\:w-full {
    width: 100% !important;
  }
  
  .max-xs\:text-sm {
    font-size: 0.875rem !important;
    line-height: 1.25rem !important;
  }
  
  .max-xs\:px-2 {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }
  
  /* Navbar specific for tiny screens */
  .navbar {
    padding: 0.5rem 0 !important;
    width: 100% !important;
    flex-wrap: wrap !important;
  }
  
  .navbar-start {
    flex: 1 !important;
  }
  
  .navbar-end {
    flex: 0 1 auto !important;
    margin-left: auto !important;
  }
  
  .navbar .btn {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
    min-height: 2rem !important;
    height: auto !important;
  }
  
  .navbar .btn-circle {
    width: 2.25rem !important;
    height: 2.25rem !important;
  }
  
  .navbar .dropdown .dropdown-content {
    width: calc(100vw - 2rem) !important;
    right: -0.5rem !important;
    left: auto !important;
    max-width: 20rem !important;
  }
  
  /* Make sure mobile menu text is readable */
  .mobile-nav .text-sm {
    font-size: 0.875rem !important;
  }
  
  /* Remove any fixed elements that might overlap content */
  .fixed {
    display: none !important;
  }
}

/* Medium mobile screens (tablets, large phones) */
@media (max-width: 480px) and (min-width: 361px) {
  .mobile-nav-item svg {
    width: 1.125rem !important; /* 18px for medium mobile */
    height: 1.125rem !important;
  }
  
  .navbar .btn svg {
    width: 1.125rem !important;
    height: 1.125rem !important;
  }
}

/* Improve touch targets on mobile */
@media (max-width: 767px) {
  body, html {
    overflow-x: hidden !important;
  }
  
  /* Professional navbar layout for mobile */
  .navbar {
    flex-wrap: wrap !important;
  }
  
  .navbar-start, .navbar-end {
    width: auto !important;
  }
  
  .navbar-end {
    margin-left: auto !important;
  }
  
  /* Ensure buttons are properly sized for touch */
  button, 
  .btn, 
  a {
    min-height: 44px !important;
    min-width: 44px !important;
  }
  
  input, 
  select, 
  textarea {
    font-size: 16px !important; /* Prevents iOS zoom on focus */
  }
  
  /* Improve general readability */
  body {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
  
  /* Ensure proper viewport sizing */
  img, svg, video, canvas, iframe {
    max-width: 100% !important;
    height: auto !important;
  }
  
  /* Improve form elements on mobile */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  input[type="number"],
  input[type="tel"],
  select,
  textarea {
    width: 100% !important;
    border-radius: 0.375rem !important;
    padding: 0.75rem !important;
  }
  
  /* Fix horizontal overflow issues */
  .overflow-x-auto {
    -webkit-overflow-scrolling: touch;
  }
  
  /* Improved spacing for mobile */
  .container {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    width: 100% !important;
  }
  
  /* Packing page mobile-specific improvements */
  .packing-page .grid-cols-1 {
    grid-template-columns: 1fr !important;
  }
  
  .packing-page .lg\\:grid-cols-3 {
    grid-template-columns: 1fr !important;
  }
  
  .packing-page .md\\:grid-cols-2 {
    grid-template-columns: 1fr !important;
  }
  
  .packing-page .flex-col {
    flex-direction: column !important;
  }
  
  .packing-page .md\\:flex-row {
    flex-direction: column !important;
  }
  
  .packing-page .icon-circle {
    width: 2.5rem !important;
    height: 2.5rem !important;
    font-size: 1rem !important;
  }
  
  .packing-page .assignment-card {
    padding: 1rem !important;
    margin-bottom: 1rem !important;
  }
  
  .packing-page .modal-box {
    margin: 0.5rem !important;
    max-width: calc(100vw - 1rem) !important;
    width: 100% !important;
  }
  
  .packing-page .progress-ring {
    width: 60px !important;
    height: 60px !important;
  }
  
  .packing-page .text-4xl {
    font-size: 1.75rem !important;
  }
  
  .packing-page .text-5xl {
    font-size: 2rem !important;
  }
  
  .packing-page .text-3xl {
    font-size: 1.5rem !important;
  }
  
  .packing-page .text-2xl {
    font-size: 1.25rem !important;
  }
  
  .packing-page .text-xl {
    font-size: 1.125rem !important;
  }
  
  /* Better typography on mobile */
  h1 {
    font-size: 1.875rem !important;
    line-height: 2.25rem !important;
  }
  
  h2 {
    font-size: 1.5rem !important;
    line-height: 2rem !important;
  }
  
  h3 {
    font-size: 1.25rem !important;
    line-height: 1.75rem !important;
  }
  
  p {
    font-size: 1rem !important;
    line-height: 1.5rem !important;
  }
  
  /* Mobile menu improvements */
  .mobile-menu-item {
    padding: 0.75rem 1rem !important;
    border-radius: 0.375rem !important;
  }
  
  .mobile-menu-item:active {
    background-color: rgba(var(--primary-rgb), 0.1) !important;
  }
  
  /* Mobile navbar icon sizing */
  .mobile-nav-item svg {
    width: 1.25rem !important; /* 20px instead of 28px */
    height: 1.25rem !important;
  }
  
  /* Standard mobile navbar icons (hamburger, theme toggle, etc.) */
  .navbar .btn svg {
    width: 1.25rem !important;
    height: 1.25rem !important;
  }
  
  /* Mobile-friendly packing page layout */
  .packing-page .center-container {
    padding: 0.5rem !important;
    max-width: 100% !important;
  }
  
  .packing-page .triptune-card {
    padding: 1rem !important;
    margin-bottom: 1rem !important;
    border-radius: 1rem !important;
  }
  
  .packing-page .grid {
    gap: 1rem !important;
  }
  
  .packing-page .section-title {
    font-size: 1.5rem !important;
    line-height: 1.3 !important;
    margin-bottom: 0.75rem !important;
  }
  
  .packing-page .section-subtitle {
    font-size: 0.875rem !important;
    line-height: 1.4 !important;
    margin-bottom: 1rem !important;
  }
  
  .packing-page .triptune-btn {
    width: 100% !important;
    padding: 0.75rem 1rem !important;
    font-size: 0.875rem !important;
    border-radius: 0.75rem !important;
  }
  
  .packing-page .page-header {
    padding: 1rem 0 !important;
  }
  
  .packing-page .content-section {
    padding: 1.5rem 0 !important;
  }
  
  /* Fix any fixed positioning that causes issues on small screens */
  .fixed.z-90 {
    display: none !important;
  }
  
  /* Make mobile navigation more compact */
  .mobile-nav {
    max-height: 80vh !important; /* Prevent menu from taking over the entire screen */
    overflow-y: auto !important; /* Allow scrolling if menu is too long */
  }
  
  /* Ensure full width and no horizontal scroll */
  .navbar, .container, nav {
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* Small phone improvements */
@media (max-width: 360px) {
  .navbar-end {
    flex: 0 !important;
  }
  
  .navbar-end .btn-sm {
    font-size: 0.7rem !important;
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }
  
  .navbar .btn-ghost {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }
  
  /* Small screen navbar icons */
  .navbar svg, .hamburger {
    width: 1rem !important; /* 16px for very small screens */
    height: 1rem !important;
  }
  
  .mobile-nav-item svg {
    width: 1rem !important; /* 16px for very small screens */
    height: 1rem !important;
  }
  
  /* Small screen packing page adjustments */
  .packing-page .center-container {
    padding: 0.25rem !important;
  }
  
  .packing-page .triptune-card {
    padding: 0.75rem !important;
  }
  
  .packing-page .section-title {
    font-size: 1.25rem !important;
  }
  
  .packing-page .section-subtitle {
    font-size: 0.75rem !important;
  }
  
  .packing-page .icon-circle {
    width: 2rem !important;
    height: 2rem !important;
    font-size: 0.875rem !important;
  }
  
  .packing-page .triptune-btn {
    padding: 0.5rem 0.75rem !important;
    font-size: 0.75rem !important;
  }
  
  /* Small screen dashboard adjustments */
  .packing-dashboard .container {
    padding: 0.25rem !important;
  }
  
  .packing-dashboard .text-3xl {
    font-size: 1.25rem !important;
  }
  
  .packing-dashboard .text-xl {
    font-size: 1rem !important;
  }
  
  .packing-dashboard .text-2xl {
    font-size: 1.125rem !important;
  }
  
  .packing-dashboard .assignment-card {
    padding: 0.5rem !important;
  }
  
  .packing-dashboard .assignment-card .text-sm {
    font-size: 0.75rem !important;
  }
  
  .packing-dashboard .p-6 {
    padding: 0.75rem !important;
  }
  
  /* Ensure dropdown doesn't go off-screen */
  .dropdown .dropdown-content {
    width: calc(100vw - 2rem) !important;
    max-width: 18rem !important;
  }
  
  /* Remove annoying fixed elements */
  .fixed {
    display: none !important;
  }
  
  /* Make sure text doesn't overflow on small screens */
  .text-xs {
    font-size: 0.65rem !important;
  }
  
  /* Ensure no horizontal scrolling */
  .navbar, .container, body, html, nav {
    overflow-x: hidden !important;
    max-width: 100% !important;
  }
}

/* Extra tiny screens (iPhone SE, etc.) */
@media (max-width: 320px) {
  /* Extreme space saving */
  .navbar {
    min-height: 3rem !important;
    padding: 0.25rem 0 !important;
  }
  
  .navbar-start {
    padding-left: 0 !important;
    flex: 1 !important;
  }
  
  .navbar-end {
    padding-right: 0 !important;
    gap: 0 !important;
    flex: 0 !important;
  }
  
  .navbar .container {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }
  
  /* Smaller logo */
  .navbar .bg-gradient-to-br {
    width: 2rem !important;
    height: 2rem !important;
  }
  
  .navbar .bg-gradient-to-br svg {
    width: 1.25rem !important;
    height: 1.25rem !important;
  }
  
  /* Even smaller buttons */
  .navbar-end .btn-sm {
    font-size: 0.625rem !important;
    padding: 0 0.25rem !important;
    min-height: 1.75rem !important;
    height: 1.75rem !important;
  }
  
  /* Tiny account circle */
  .navbar .btn-circle.avatar {
    width: 2rem !important;
    height: 2rem !important;
    padding: 0 !important;
  }
  
  .navbar .avatar .rounded-full {
    width: 1.75rem !important;
    height: 1.75rem !important;
  }
  
  /* Extra compact mobile menu */
  .mobile-nav .mobile-menu-item {
    padding: 0.5rem !important;
    font-size: 0.75rem !important;
  }
  
  .mobile-nav svg {
    width: 0.875rem !important; /* 14px for smallest screens */
    height: 0.875rem !important;
  }
  
  /* Hamburger menu icon for tiny screens */
  .navbar .btn-ghost svg {
    width: 0.875rem !important;
    height: 0.875rem !important;
  }
  
  /* Remove any floating buttons or fixed elements */
  .fixed {
    display: none !important;
  }
  
  /* Hide theme toggle on smallest screens */
  .navbar-end .swap {
    display: none !important;
  }
}

/* iOS-specific fixes */
@supports (-webkit-touch-callout: none) {
  /* Fix for iOS 100vh issue */
  .min-h-screen {
    min-height: -webkit-fill-available !important;
  }
  
  /* Fix for iOS button styling */
  button {
    -webkit-appearance: none;
    appearance: none;
  }
  
  /* Fix iOS fixed position issues */
  .fixed.bottom-8.right-8 {
    display: none !important;
  }
  
  /* Prevent horizontal scroll on iOS */
  body, html, nav, .navbar, .container {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
  }
}

/* Android-specific fixes */
@supports not (-webkit-touch-callout: none) {
  input:focus {
    outline: auto !important;
  }
  
  /* Hide fixed elements on Android too */
  .fixed.z-90 {
    display: none !important;
  }
  
  /* Prevent horizontal scroll on Android */
  body, html, nav, .navbar, .container {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }
  
  /* Improve touch responsiveness */
  body {
    touch-action: manipulation;
  }
  
  /* Better button styling for Android */
  .btn {
    -webkit-tap-highlight-color: transparent;
    outline: none !important;
  }
  
  /* Fix Android navbar */
  .navbar {
    position: sticky !important;
    top: 0 !important;
    z-index: 50 !important;
  }
  
  /* Improve mobile menu on Android */
  .mobile-nav {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
  }
  
  /* Better touch targets for Android */
  .mobile-menu-item, 
  .mobile-btn,
  .btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
}

/* Fix for login/signup buttons on mobile */
.mobile-auth-buttons {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.mobile-btn {
  padding: 0.5rem 0.75rem !important;
  height: auto !important;
  font-size: 0.75rem !important;
  white-space: nowrap;
  min-height: 2.25rem !important;
  touch-action: manipulation;
}

/* Extra optimizations for very small Android devices */
@media (max-width: 380px) {
  /* Make auth buttons more compact */
  .mobile-auth-buttons {
    gap: 0.125rem !important;
  }
  
  .mobile-btn {
    padding: 0.375rem 0.5rem !important;
    font-size: 0.7rem !important;
    min-height: 2rem !important;
  }
  
  /* Smaller hamburger menu */
  .navbar .btn-ghost.btn-sm {
    padding: 0.25rem !important;
    min-height: 2rem !important;
    min-width: 2rem !important;
  }
  
  /* Adjust logo size */
  .navbar .w-8.h-8 {
    width: 1.75rem !important;
    height: 1.75rem !important;
  }
  
  /* Adjust spacing */
  .navbar-start {
    gap: 0.25rem !important;
  }
  
  /* Adjust theme toggle */
  .swap {
    transform: scale(0.85);
  }
  
  /* Make sure dropdown menu is fully visible */
  .dropdown .dropdown-content {
    max-width: 90vw !important;
    right: 0 !important;
  }
}

/* Fix for mobile sign in/sign up on Android */
@media (max-width: 380px) {
  .mobile-menu-item {
    padding: 0.5rem 0.75rem !important;
  }
  
  /* Full-width buttons in mobile menu */
  .mobile-nav .btn {
    justify-content: flex-start;
    text-align: left;
    width: 100%;
    display: flex;
    align-items: center;
  }
}

/* Fix for body having horizontal scroll issues */
body, html {
    overflow-x: hidden !important;
    max-width: 100vw;
}

/* Mobile menu styling */
.mobile-nav {
    overflow: hidden;
}

/* Improved visibility for theme toggle */
.theme-toggle-container {
    position: relative;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 640px) {
    .theme-toggle-container {
        background-color: rgba(var(--b2, 217 217 217) / 0.2);
        padding: 6px;
        border-radius: 8px;
        margin-left: 8px !important;
    }
    
    .theme-toggle-container .swap {
        transform: scale(1.1);
    }
    
    /* Ensure the dropdown is visible */
    .dropdown-content {
        max-height: 80vh;
        overflow-y: auto;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
        border: 1px solid rgba(var(--b3, 200 200 200) / 0.5);
    }
}

/* Mobile menu items */
.mobile-menu-item {
    display: flex;
    align-items: center;
}

/* Fix for buttons on smaller screens */
@media (max-width: 380px) {
    .mobile-btn {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        font-size: 0.7rem;
    }
    
    .mobile-auth-buttons {
        gap: 0.25rem !important;
    }
    
    .theme-toggle-container {
        margin-left: 4px !important;
    }
}

/* Add hardware acceleration for smoother scrolling on mobile */
.mobile-nav, .dropdown-content, .theme-toggle-container {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
    will-change: transform;
} 

@media (max-width: 380px) {
    .mobile-btn {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    .mobile-auth-buttons {
        gap: 0.5rem;
    }
    .theme-toggle-container {
        margin-right: -0.5rem;
    }
}

.mobile-nav, .dropdown-content, .theme-toggle-container {
    -webkit-tap-highlight-color: transparent;
}


/* Hide mobile-only elements on larger screens */
@media (min-width: 1024px) {
  .mobile-only-actions {
    display: none !important;
  }
}

/* Additional mobile improvements for packing page */
@media (max-width: 767px) {
  /* Better touch targets for packing page */
  .packing-page .checkbox {
    width: 1.25rem !important;
    height: 1.25rem !important;
  }
  
  .packing-page .btn {
    min-height: 2.5rem !important;
    min-width: 2.5rem !important;
  }
  
  .packing-page .dropdown .btn {
    padding: 0.5rem !important;
  }
  
  .packing-page .badge {
    font-size: 0.75rem !important;
    padding: 0.25rem 0.5rem !important;
  }
  
  /* Better gap spacing for mobile */
  .packing-page .gap-6 {
    gap: 1rem !important;
  }
  
  .packing-page .gap-8 {
    gap: 1.5rem !important;
  }
  
  .packing-page .gap-4 {
    gap: 0.75rem !important;
  }
  
  .packing-page .gap-3 {
    gap: 0.5rem !important;
  }
  
  .packing-page .gap-2 {
    gap: 0.25rem !important;
  }
  
  /* Better padding for cards and sections */
  .packing-page .p-8 {
    padding: 1rem !important;
  }
  
  .packing-page .p-6 {
    padding: 0.75rem !important;
  }
  
  .packing-page .p-4 {
    padding: 0.5rem !important;
  }
  
  .packing-page .p-3 {
    padding: 0.375rem !important;
  }
  
  /* Better margin spacing */
  .packing-page .mb-12 {
    margin-bottom: 2rem !important;
  }
  
  .packing-page .mb-8 {
    margin-bottom: 1.5rem !important;
  }
  
  .packing-page .mb-6 {
    margin-bottom: 1rem !important;
  }
  
  .packing-page .mb-4 {
    margin-bottom: 0.75rem !important;
  }
  
  /* Better line height and readability */
  .packing-page .leading-tight {
    line-height: 1.3 !important;
  }
  
  .packing-page .leading-normal {
    line-height: 1.4 !important;
  }
  
  /* Better form controls */
  .packing-page .form-control {
    width: 100% !important;
  }
  
  .packing-page .input,
  .packing-page .select,
  .packing-page .textarea {
    width: 100% !important;
    font-size: 1rem !important;
  }
  
  /* Better modal sizing */
  .packing-page .modal {
    padding: 0.5rem !important;
  }
  
  .packing-page .modal-box {
    max-height: calc(100vh - 2rem) !important;
    overflow-y: auto !important;
  }
  
  /* Packing Dashboard Mobile Optimizations */
  .packing-dashboard .container {
    padding: 0.5rem !important;
  }
  
  .packing-dashboard .flex.justify-between {
    flex-direction: column !important;
    gap: 1rem !important;
    align-items: flex-start !important;
  }
  
  .packing-dashboard .flex.gap-2 {
    width: 100% !important;
    flex-direction: column !important;
    gap: 0.5rem !important;
  }
  
  .packing-dashboard .btn {
    width: 100% !important;
    text-align: center !important;
  }
  
  .packing-dashboard .text-3xl {
    font-size: 1.5rem !important;
    line-height: 1.3 !important;
  }
  
  .packing-dashboard .text-xl {
    font-size: 1.125rem !important;
  }
  
  .packing-dashboard .text-2xl {
    font-size: 1.25rem !important;
  }
  
  .packing-dashboard .grid.md\\:grid-cols-4 {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }
  
  .packing-dashboard .assignment-card {
    padding: 0.75rem !important;
  }
  
  .packing-dashboard .assignment-card .flex.justify-between {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.75rem !important;
  }
  
  .packing-dashboard .status-badge {
    align-self: flex-end !important;
    font-size: 0.75rem !important;
    padding: 0.25rem 0.5rem !important;
  }
  
  .packing-dashboard .p-6 {
    padding: 1rem !important;
  }
  
  .packing-dashboard .space-y-4 > * + * {
    margin-top: 1rem !important;
  }
  
  .packing-dashboard .space-y-3 > * + * {
    margin-top: 0.75rem !important;
  }
}