/* Mobile Responsive Styles */

/* Mobile Navigation */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow-light);
  z-index: 999;
  padding: 0 1rem;
  align-items: center;
  justify-content: space-between;
}

.hamburger-btn {
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.3s ease;
}

.hamburger-line {
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  transition: all 0.3s ease;
  transform-origin: center;
}

.hamburger-btn.active .hamburger-line:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.hamburger-btn.active .hamburger-line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.hamburger-btn.active .hamburger-line:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.mobile-logo {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
}

.mobile-actions {
  display: flex;
  gap: 0.5rem;
}

.mobile-action-btn {
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 1.2rem;
  transition: all 0.2s ease;
}

.mobile-action-btn:active {
  transform: scale(0.95);
  opacity: 0.8;
}

/* Mobile Sidebar Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* Mobile Breakpoints */
@media (max-width: 768px) {
  /* Show mobile header */
  .mobile-header {
    display: flex;
  }

  /* Adjust sidebar for mobile */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    top: 60px;
    height: calc(100vh - 60px);
    width: 260px;
  }

  .sidebar.active {
    transform: translateX(0);
  }

  /* Adjust main content */
  .main-content {
    margin-left: 0;
    padding-top: 60px;
    width: 100%;
  }

  /* Make module content responsive */
  .module-container {
    padding: 1rem;
    overflow-x: hidden;
  }

  /* Responsive layouts */
  .fastnotes-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .sidebar-panels {
    order: -1;
  }

  .calendar-panel, .todo-panel {
    margin-bottom: 1rem;
  }

  /* Responsive cards */
  .card {
    padding: 1rem;
    margin-bottom: 1rem;
  }

  /* Touch-friendly buttons */
  .btn {
    min-height: 44px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
  }

  /* Touch-friendly form inputs */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="date"],
  input[type="url"],
  textarea,
  select {
    min-height: 44px;
    padding: 0.75rem;
    font-size: 16px; /* Prevents zoom on iOS */
  }

  /* Responsive modals */
  .upgrade-modal-content,
  .login-modal-content,
  .preview-modal-content {
    width: 95vw;
    max-height: 90vh;
    margin: 1rem;
  }

  .modal-close-btn {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10010;
    background: var(--bg-secondary);
    box-shadow: var(--shadow-medium);
  }

  /* Responsive grids */
  .subscription-tiers {
    grid-template-columns: 1fr;
  }

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

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

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

  /* Responsive tables - convert to cards */
  table {
    display: block;
    width: 100%;
  }

  thead {
    display: none;
  }

  tr {
    display: block;
    margin-bottom: 1rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 0.75rem;
  }

  td {
    display: block;
    padding: 0.25rem 0;
    border: none;
  }

  td::before {
    content: attr(data-label);
    font-weight: 600;
    margin-right: 0.5rem;
    color: var(--text-secondary);
  }

  /* Mobile profile layout */
  .profile-content {
    grid-template-columns: 1fr;
  }

  .profile-card {
    flex-direction: column;
    text-align: center;
  }

  /* Floating action button for mobile */
  .floating-snap-button {
    width: 56px;
    height: 56px;
    bottom: 20px;
    right: 20px;
  }

  /* Mobile-friendly tooltips */
  .tooltip {
    display: none;
  }

  /* Responsive text */
  h1 {
    font-size: 1.5rem;
  }

  h2 {
    font-size: 1.3rem;
  }

  h3 {
    font-size: 1.1rem;
  }

  /* Scroll improvements */
  .module-container {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }

  /* Hide less important elements on mobile */
  .sidebar-footer .privacy-note {
    font-size: 0.7rem;
  }

  .feature-description {
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  /* Extra small devices */
  .mobile-header {
    height: 56px;
  }

  .sidebar {
    top: 56px;
    height: calc(100vh - 56px);
    width: 100%;
  }

  .main-content {
    padding-top: 56px;
    padding: 56px 0.5rem 0.5rem;
  }

  .module-container {
    padding: 0.5rem;
  }

  .card {
    padding: 0.75rem;
  }

  /* Full-width modals on very small screens */
  .upgrade-modal-content,
  .login-modal-content,
  .preview-modal-content {
    width: 100vw;
    height: 100vh;
    margin: 0;
    border-radius: 0;
    max-height: 100vh;
  }

  /* Stack all form elements */
  .form-row {
    flex-direction: column;
  }

  .form-group {
    width: 100%;
  }

  /* Compact buttons on small screens */
  .btn {
    font-size: 0.9rem;
    padding: 0.625rem 0.875rem;
  }

  .module-actions {
    flex-direction: column;
    width: 100%;
  }

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

/* Touch and gesture improvements */
@media (hover: none) and (pointer: coarse) {
  /* Remove hover effects on touch devices */
  .btn:hover {
    transform: none;
  }

  .nav-item:hover {
    background: transparent;
  }

  /* Add active states for touch feedback */
  .btn:active,
  .nav-item:active {
    opacity: 0.8;
    transform: scale(0.98);
  }

  /* Increase touch targets */
  .checkbox-control input[type="checkbox"],
  .billing-option input[type="radio"] {
    width: 24px;
    height: 24px;
  }

  /* Disable text selection on buttons */
  .btn,
  .nav-item {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }
}

/* Landscape orientation adjustments */
@media (max-width: 768px) and (orientation: landscape) {
  .mobile-header {
    height: 48px;
  }

  .sidebar {
    top: 48px;
    height: calc(100vh - 48px);
  }

  .main-content {
    padding-top: 48px;
  }

  .module-container {
    padding: 0.5rem;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .hamburger-line {
    background: currentColor;
  }

  .btn {
    border: 2px solid currentColor;
  }
}

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