/**
 * Price Alerts UI CSS (2026 Enterprise Design).
 * Modern, accessible, conversion-optimized interface.
 */

/* Main Container */
.alerts-container {
  display: grid;
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

@media (min-width: 1024px) {
  .alerts-container {
    grid-template-columns: 1.2fr 1fr;
    align-items: start;
  }
}

/* Card Base */
.alert-builder,
.alerts-list {
  background: var(--card, #ffffff);
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

@media (prefers-color-scheme: dark) {
  .alert-builder,
  .alerts-list {
    background: #1a1a1a;
    border-color: rgba(255, 255, 255, 0.1);
  }
}

/* Card Header */
.card-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--line, #e5e7eb);
  background: var(--flatbg, #f9fafb);
}

@media (prefers-color-scheme: dark) {
  .card-header {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.05);
  }
}

.card-header h3 {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink, #111827);
}

.card-header .subtitle {
  margin: 0;
  font-size: 0.875rem;
  color: var(--ink2, #6b7280);
}

.alert-count {
  font-size: 0.875rem;
  color: var(--ink2, #6b7280);
  font-weight: 600;
}

/* Alert Form */
.alert-form {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink, #111827);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.required {
  color: #ef4444;
  font-weight: 700;
}

.optional {
  color: var(--ink3, #9ca3af);
  font-weight: 400;
}

.current-price {
  font-size: 0.75rem;
  font-weight: 500;
  color: #d4af37;
  font-variant-numeric: tabular-nums;
}

/* Inputs */
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="number"],
.form-group select {
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 1px solid var(--line2, #d1d5db);
  border-radius: 8px;
  background: var(--card, #ffffff);
  color: var(--ink, #111827);
  transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #d4af37;
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

@media (prefers-color-scheme: dark) {
  .form-group input,
  .form-group select {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
  }
}

/* Threshold Input Group */
.threshold-input-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.currency-symbol {
  position: absolute;
  left: 1rem;
  font-weight: 600;
  color: var(--ink2, #6b7280);
  pointer-events: none;
}

.threshold-input-group input[type="number"] {
  flex: 1;
  padding-left: 2.5rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.quick-btn {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  background: var(--flatbg, #f3f4f6);
  border: 1px solid var(--line2, #d1d5db);
  border-radius: 6px;
  color: var(--ink2, #6b7280);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.quick-btn:hover {
  background: var(--card, #ffffff);
  border-color: #d4af37;
  color: #d4af37;
}

/* Threshold Slider */
.threshold-slider {
  margin-top: 0.5rem;
}

.threshold-slider input[type="range"] {
  width: 100%;
  height: 6px;
  background: var(--line, #e5e7eb);
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
}

.threshold-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: #d4af37;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.threshold-slider input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: #d4af37;
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Direction Toggle */
.direction-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.direction-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  background: var(--flatbg, #f9fafb);
  border: 2px solid var(--line2, #d1d5db);
  border-radius: 8px;
  color: var(--ink2, #6b7280);
  cursor: pointer;
  transition: all 0.2s ease;
}

.direction-btn:hover {
  background: var(--card, #ffffff);
  border-color: var(--ink2, #9ca3af);
}

.direction-btn.active {
  background: #d4af37;
  border-color: #d4af37;
  color: #1a1a1a;
}

.direction-btn svg {
  flex-shrink: 0;
}

/* Checkbox */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-weight: 400;
  color: var(--ink2, #6b7280);
}

.checkbox-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: #d4af37;
}

/* Hint Text */
.hint {
  font-size: 0.75rem;
  color: var(--ink3, #9ca3af);
  margin-top: 0.25rem;
}

/* Primary Button */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  background: #d4af37;
  color: #1a1a1a;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
}

.btn-primary:hover {
  background: #b8941f;
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-lg {
  min-height: 52px;
}

/* Form Messages */
.form-message {
  padding: 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
}

.form-message.success {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #22c55e;
}

.form-message.error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #ef4444;
}

@media (prefers-color-scheme: dark) {
  .form-message.success {
    background: rgba(34, 197, 94, 0.1);
    color: #4ade80;
  }
  
  .form-message.error {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
  }
}

/* Alerts List */
.alerts-list-body {
  padding: 2rem;
  min-height: 300px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--ink3, #9ca3af);
}

.empty-state svg {
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state p {
  margin: 0.5rem 0 0.25rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink2, #6b7280);
}

.empty-state small {
  font-size: 0.875rem;
}

/* Alert Item */
.alert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 8px;
  margin-bottom: 0.75rem;
  background: var(--card, #ffffff);
  transition: all 0.2s ease;
}

.alert-item:hover {
  border-color: #d4af37;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.alert-info {
  flex: 1;
}

.alert-threshold {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--ink, #111827);
  margin-bottom: 0.25rem;
}

.alert-meta {
  font-size: 0.75rem;
  color: var(--ink3, #9ca3af);
}

.alert-status {
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.alert-status.active {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
}

.alert-status.triggered {
  background: rgba(251, 191, 36, 0.1);
  color: #fbbf24;
}

/* Mobile Responsive */
@media (max-width: 640px) {
  .alerts-container {
    padding: 1rem;
  }
  
  .alert-form {
    padding: 1.5rem 1rem;
  }
  
  .card-header {
    padding: 1rem 1.5rem;
  }
  
  .threshold-input-group {
    flex-wrap: wrap;
  }
  
  .quick-btn {
    flex: 1;
  }
}

/* Touch Enhancements */
@media (hover: none) {
  .direction-btn:active {
    transform: scale(0.98);
  }
  
  .btn-primary:active {
    transform: scale(0.98);
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .alert-builder,
  .alerts-list {
    border-width: 2px;
  }
  
  .direction-btn.active {
    outline: 2px solid currentColor;
    outline-offset: -4px;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
