/* Mobile First Responsive Styles */

/* Small phones */
@media (max-width: 360px) {
  .container { padding: 0 12px; }
  .auth-card { padding: 24px 16px; }
  .auth-logo h1 { font-size: 1.3rem; }
  .btn { padding: 12px 20px; font-size: 0.95rem; }
  .form-group input, .form-group select, .form-group textarea {
    padding: 12px 14px;
    font-size: 16px; /* Prevent zoom on iOS */
  }
}

/* Phones */
@media (max-width: 480px) {
  .dashboard-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .stat-card {
    padding: 15px 10px;
  }
  .stat-icon { font-size: 1.5rem; }
  .stat-value { font-size: 1.5rem; }
  .stat-label { font-size: 0.75rem; }
  
  .quick-launch-section {
    padding: 24px 16px;
    margin: 20px 0;
  }
  .quick-launch-section .page-title {
    font-size: 1.4rem;
  }
  
  .modal {
    margin: 10px;
    padding: 20px;
    max-height: 95vh;
  }
  
  .wizard-content {
    padding: 20px 16px;
  }
  .wizard-step-title {
    font-size: 1.4rem;
  }
  
  .preview-iframe {
    height: 400px;
  }
  
  .result-actions .btn {
    min-width: auto;
    flex: 1 1 100%;
  }
  
  .launch-card {
    padding: 18px;
  }
  .launch-card h3 {
    font-size: 1rem;
  }
  .launch-card-actions {
    flex-wrap: wrap;
  }
  .launch-card-actions .btn {
    flex: 1 1 calc(50% - 5px);
    padding: 10px;
    font-size: 0.85rem;
  }
  
  .contact-card {
    padding: 12px;
  }
  .contact-avatar {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }
  
  .dashboard-header {
    padding: 15px 0;
  }
  .dashboard-header .container {
    flex-direction: column;
    gap: 12px;
  }
  .logo {
    font-size: 1.1rem;
  }
  .user-info {
    text-align: center;
  }
}

/* Tablets */
@media (min-width: 481px) and (max-width: 768px) {
  .dashboard-stats {
    grid-template-columns: repeat(4, 1fr);
  }
  .launches-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .contacts-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Large tablets and small laptops */
@media (min-width: 769px) and (max-width: 1024px) {
  .launches-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Landscape phones */
@media (max-height: 500px) and (orientation: landscape) {
  .auth-page {
    padding: 20px;
    min-height: auto;
  }
  .auth-card {
    max-width: 100%;
  }
  .wizard-header {
    position: relative;
  }
}

/* Safe area for notched phones */
@supports (padding-top: env(safe-area-inset-top)) {
  .dashboard-header {
    padding-top: calc(20px + env(safe-area-inset-top));
  }
  .wizard-header {
    padding-top: calc(15px + env(safe-area-inset-top));
  }
  body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* Touch improvements */
@media (pointer: coarse) {
  .btn {
    min-height: 44px;
    min-width: 44px;
  }
  .form-group input, .form-group select, .form-group textarea {
    min-height: 44px;
  }
  .contact-card, .launch-card, .template-card {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .modal-close {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* Dark mode support (already dark, but ensure consistency) */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
  }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Print styles */
@media print {
  .dashboard-header, .wizard-header, .btn, .modal-overlay {
    display: none !important;
  }
  body {
    background: white;
    color: black;
  }
}

/* Spinner for buttons */
.spinner-small {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

/* Improved scroll behavior */
html {
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* Better form input styling on mobile */
input, textarea, select {
  -webkit-appearance: none;
  appearance: none;
  border-radius: 10px;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

/* Focus visible for accessibility */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Toast positioning on mobile */
@media (max-width: 480px) {
  .toast {
    left: 16px;
    right: 16px;
    bottom: 20px;
    max-width: none;
    text-align: center;
  }
}