/**
 * Create Project Mobile Optimizations - App-First Design 2026
 */

@media (max-width: 767px) {
  /* Dölj FAB button på create-project sidan */
  .fab-button {
    display: none !important;
  }
  /* ========== ULTRAMINIMALISTISK PROGRESS HEADER ========== */
  .wizard-progress-mobile {
    position: sticky;
    top: calc(60px + env(safe-area-inset-top));
    left: 0;
    right: 0;
    z-index: 99;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 0.75rem 1rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    margin-bottom: 0.5rem;
  }
  
  .progress-pill-bar {
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.5rem;
  }
  
  .progress-pill-fill {
    height: 100%;
    background: #1e293b;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  /* Steg-label: max två rader, ellips vid overflow */
  .wizard-progress-modern .step-label {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9375rem;
    line-height: 1.3;
  }
  
  /* Progress steps use minimal dots instead of emojis */
  .progress-steps-emoji {
    display: none;
  }
  
  .step-emoji {
    display: none;
  }

  /* Legacy support - hide old progress */
  .wizard-progress {
    display: none !important;
  }

  /* Komprimerad Header - intro hanterar top-marginal via .wizard-page-intro */
  #create-mode-banner {
    padding: 0.75rem 1rem !important;
    margin: 0 0 0.85rem !important;
  }

  .wizard-container {
    padding: 1rem !important;
    margin-top: 0 !important;
    /* Bottennav (~60) + wizard-footer (~72) + marginal — undvik att sista fält döljs */
    padding-bottom: calc(180px + env(safe-area-inset-bottom)) !important;
  }

  /* ========== CARD-BASED STEP LAYOUT ========== */
  .wizard-step {
    border-radius: 20px !important;
    padding: 1.5rem !important;
    margin: 1rem !important;
    margin-top: 1rem !important;
    background: white !important;
    box-shadow: 0 10px 40px rgba(0,0,0,0.12) !important;
    animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }
  
  @keyframes slideInRight {
    from {
      opacity: 0;
      transform: translateX(30px);
    }
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }
  
  @media (prefers-reduced-motion: reduce) {
    .wizard-step {
      animation: none !important;
    }
  }
  
  .step-title {
    font-size: 1.5rem !important;
    font-weight: 800 !important;
    text-align: left !important;
    margin-bottom: 0.5rem !important;
  }
  
  .step-subtitle {
    font-size: 0.938rem !important;
    text-align: left !important;
    opacity: 0.7 !important;
    margin-bottom: 1.5rem !important;
  }

  /* Larger Form Fields */
  .wizard-input,
  .wizard-textarea,
  .wizard-select {
    min-height: 48px !important;
    font-size: 16px !important; /* Prevent zoom on iOS */
    padding: 0.875rem 1rem !important;
  }

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

  /* Step Navigation Buttons */
  .wizard-nav-btn {
    min-height: 48px !important;
    font-size: 1rem !important;
    padding: 1rem 2rem !important;
  }

  /* Progress Steps - Horizontal Scroll */
  .wizard-steps {
    display: flex !important;
    overflow-x: auto !important;
    gap: 0.5rem !important;
    padding: 0.5rem 0 !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }

  .wizard-steps::-webkit-scrollbar {
    display: none !important;
  }

  .wizard-step {
    flex-shrink: 0 !important;
    min-width: 60px !important;
  }

  /* File Upload Optimization */
  .file-upload-area {
    min-height: 120px !important;
    touch-action: manipulation !important;
  }

  .file-upload-btn {
    min-height: 48px !important;
    font-size: 1rem !important;
  }

  /* ========== SMART CAMERA-FIRST IMAGE UPLOAD ========== */
  .image-upload-area {
    padding: 1.5rem !important;
  }
  
  .camera-btn-hero {
    width: 100% !important;
    min-height: 140px !important;
    background: #1e293b !important;
    color: white !important;
    border: none !important;
    border-radius: 16px !important;
    font-size: 1.125rem !important;
    font-weight: 700 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.75rem !important;
    box-shadow: 0 8px 24px rgba(30, 41, 59, 0.25) !important;
    margin-bottom: 1rem !important;
  }
  
  .camera-btn-hero i {
    font-size: 3rem !important;
  }
  
  .camera-btn-hero:active {
    transform: scale(0.98) !important;
  }
  
  .gallery-btn-secondary {
    width: 100% !important;
    min-height: 56px !important;
    background: white !important;
    border: 2px solid #e2e8f0 !important;
    border-radius: 12px !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    color: #64748b !important;
  }
  
  .images-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
    margin-top: 1.5rem !important;
  }
  
  .image-item {
    border-radius: 12px !important;
    position: relative !important;
  }
  
  .image-item img {
    border-radius: 12px !important;
  }

  /* Image Preview Grid */
  .image-preview-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
  }

  /* ========== BOTTOM FIXED ACTION BAR ========== */
  /* Sitt ovanför mobil bottennav (~60px + safe-area) så båda syns */
  .wizard-footer {
    position: fixed !important;
    bottom: calc(60px + env(safe-area-inset-bottom)) !important;
    left: 0 !important;
    right: 0 !important;
    padding: 0.875rem 1rem !important;
    /* safe-area ligger redan i bottom — undvik dubbel inset */
    background: white !important;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08) !important;
    border-top: 1px solid #f1f5f9 !important;
    display: flex !important;
    gap: 0.75rem !important;
    z-index: 9999 !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  
  .btn-back-mobile {
    width: 56px !important;
    height: 56px !important;
    border-radius: 12px !important;
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    color: #64748b !important;
    font-size: 1.25rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  .btn-next-mobile {
    flex: 1 !important;
    height: 56px !important;
    border-radius: 12px !important;
    background: #1e293b !important;
    color: white !important;
    font-size: 1.125rem !important;
    font-weight: 700 !important;
    border: none !important;
    box-shadow: 0 4px 16px rgba(30, 41, 59, 0.25) !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent !important;
    touch-action: manipulation !important;
  }
  
  .btn-next-mobile:active {
    transform: scale(0.98) !important;
  }
  
  .btn-next-mobile:disabled {
    opacity: 0.5 !important;
    transform: none !important;
    cursor: not-allowed !important;
  }

  .btn-back-mobile {
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent !important;
    touch-action: manipulation !important;
  }

  /* Hide button text on very small screens, show icons only */
  .wizard-footer button span {
    display: inline !important;
  }

  /* ========== AUTO-SAVE TOAST FEEDBACK ========== */
  .autosave-toast {
    position: fixed !important;
    /* Ovanför bottennav + wizard-footer */
    bottom: calc(150px + env(safe-area-inset-bottom)) !important;
    z-index: 10000 !important;
    left: 50% !important;
    transform: translateX(-50%) translateY(100px) !important;
    background: rgba(30, 41, 59, 0.95) !important;
    backdrop-filter: blur(10px) !important;
    color: white !important;
    padding: 0.75rem 1.25rem !important;
    border-radius: 24px !important;
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    box-shadow: 0 4px 16px rgba(30, 41, 59, 0.25) !important;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    z-index: 999 !important;
  }
  
  .autosave-toast.show {
    transform: translateX(-50%) translateY(0) !important;
  }

  /* Legacy auto-save indicator */
  .autosave-indicator {
    display: none !important;
  }

  /* ========== CATEGORY SELECTION - VISUAL PILLS ========== */
  .category-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.75rem !important;
  }
  
  .category-card {
    display: flex !important;
    align-items: center !important;
    gap: 1rem !important;
    padding: 1.25rem !important;
    border: 2px solid transparent !important;
    border-radius: 16px !important;
    min-height: 88px !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent !important;
    touch-action: manipulation !important;
  }
  
  .category-card:active {
    transform: scale(0.98) !important;
  }
  
  .category-card.selected {
    border-color: currentColor !important;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15) !important;
    transform: scale(1.02) !important;
  }
  
  .category-icon {
    font-size: 2.5rem !important;
    margin-bottom: 0 !important;
  }
  
  .category-content {
    flex: 1 !important;
    text-align: left !important;
  }
  
  .category-card h3 {
    font-size: 1.125rem !important;
    margin-bottom: 0.25rem !important;
    text-align: left !important;
  }
  
  .category-card p {
    text-align: left !important;
  }
  
  .popular-projects {
    display: none !important;
  }

  /* Location Input */
  .location-input-group {
    flex-direction: column !important;
    gap: 0.75rem !important;
  }

  /* Date Picker */
  input[type="date"] {
    min-height: 48px !important;
    font-size: 16px !important;
  }

  /* Budget Slider */
  .budget-slider {
    margin: 1.5rem 0 !important;
  }

  .budget-value {
    font-size: 1.5rem !important;
    font-weight: 700 !important;
  }

  /* ========== SUCCESS SCREEN - CELEBRATION ========== */
  .success-state {
    position: relative !important;
    overflow: hidden !important;
    padding: 2rem 1rem !important;
  }
  
  .success-icon {
    font-size: 5rem !important;
    animation: bounceIn 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) !important;
  }
  
  @keyframes bounceIn {
    0% {
      transform: scale(0) rotate(-45deg);
      opacity: 0;
    }
    50% {
      transform: scale(1.2) rotate(10deg);
    }
    100% {
      transform: scale(1) rotate(0);
      opacity: 1;
    }
  }
  
  .success-stats {
    background: #1e293b !important;
    color: white !important;
    padding: 1.5rem !important;
    border-radius: 16px !important;
    margin: 1.5rem 0 !important;
    box-shadow: 0 8px 24px rgba(30, 41, 59, 0.25) !important;
  }
  
  .success-stats h3 {
    font-size: 2rem !important;
    font-weight: 900 !important;
    margin-bottom: 0.5rem !important;
    color: white !important;
  }
  
  .success-stats p {
    opacity: 0.95 !important;
    color: white !important;
  }

  /* ========== INLINE FORM VALIDATION ========== */
  .field-success {
    border-color: #10b981 !important;
    background: rgba(16, 185, 129, 0.05) !important;
  }
  
  .field-error {
    border-color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.05) !important;
  }
  
  .shake {
    animation: shake 0.5s !important;
  }
  
  @keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
  }
  
  .field-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.25rem;
  }
  
  .field-icon.success {
    color: #10b981;
  }
  
  .field-icon.error {
    color: #ef4444;
  }

  /* ========== LOADING STATES & MICRO-INTERACTIONS ========== */
  .btn-loading {
    position: relative !important;
    color: transparent !important;
  }
  
  .btn-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin: -10px 0 0 -10px;
    border: 3px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
  }
  
  @keyframes spin {
    to { transform: rotate(360deg); }
  }

  .category-card:hover {
    transform: translateY(-2px) !important;
  }
}

@media (max-width: 768px) {
  .image-item-remove {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
  }

  .wizard-edit-modal-close {
    min-width: 44px !important;
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0.65rem !important;
  }
}

@media (max-width: 480px) {
  /* Extra small screens */
  .wizard-container {
    padding: 0.75rem !important;
    padding-bottom: calc(180px + env(safe-area-inset-bottom)) !important;
  }

  .category-grid {
    grid-template-columns: 1fr !important;
  }

  .image-preview-grid {
    grid-template-columns: 1fr !important;
  }

  .wizard-step-title {
    font-size: 1.125rem !important;
  }
}

