/**
 * Mobile Dropdown Modal
 * Stora, touch-vänliga dropdowns för mobilvy
 */

@media (max-width: 768px) {
  /* Select wrapper */
  .mobile-select-wrapper {
    position: relative;
    width: 100%;
  }

  /* Custom button (ersätter native select) */
  .mobile-select-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.875rem 1rem;
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    color: #1e293b;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 48px; /* Touch target */
  }

  .mobile-select-button:active {
    background: #f8fafc;
    border-color: #1e293b;
  }

  .mobile-select-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-select-icon {
    margin-left: 0.5rem;
    color: #64748b;
    font-size: 0.875rem;
  }

  /* Modal overlay */
  .mobile-dropdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: flex-end;
    opacity: 0;
    transition: opacity 0.2s ease;
  }

  .mobile-dropdown-overlay.active {
    opacity: 1;
  }

  /* Modal container */
  .mobile-dropdown-modal {
    background: white;
    width: 100%;
    max-height: 70vh;
    border-radius: 16px 16px 0 0;
    overflow: hidden;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
  }

  .mobile-dropdown-overlay.active .mobile-dropdown-modal {
    transform: translateY(0);
  }

  /* Header */
  .mobile-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
  }

  .mobile-dropdown-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
  }

  .mobile-dropdown-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #64748b;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
  }

  .mobile-dropdown-close:active {
    color: #1e293b;
  }

  /* Options list */
  .mobile-dropdown-options {
    overflow-y: auto;
    max-height: calc(70vh - 80px);
    -webkit-overflow-scrolling: touch;
  }

  /* Individual option */
  .mobile-dropdown-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 1.25rem 1.5rem;
    background: white;
    border: none;
    border-bottom: 1px solid #f1f5f9;
    text-align: left;
    font-size: 1.125rem;
    font-weight: 500;
    color: #1e293b;
    cursor: pointer;
    transition: background 0.15s ease;
    min-height: 64px; /* Stort touch target */
  }

  .mobile-dropdown-option:active {
    background: #f8fafc;
  }

  .mobile-dropdown-option.selected {
    background: #f0f9ff;
    color: #0369a1;
    font-weight: 600;
  }

  .mobile-dropdown-option.disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  .option-text {
    flex: 1;
  }

  .option-check {
    color: #0369a1;
    font-size: 1.125rem;
    margin-left: 1rem;
  }
}

/* Desktop: visa native dropdowns som vanligt */
@media (min-width: 769px) {
  .mobile-select-wrapper {
    display: contents;
  }
  
  .mobile-select-button {
    display: none !important;
  }
  
  .mobile-select-wrapper select {
    display: block !important;
  }
}
