/**
 * Configuration Zones - Styles
 */

:root {
  --bg: #0f1419;
  --panel: #1a1f2e;
  --border: #2d3548;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --teal: #14b8a6;
  --header-height: 56px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  min-height: 100vh;
}

/* ============================================
   Main Content
   ============================================ */
.main-content {
  max-width: 900px;
  margin: 0 auto;
  padding: calc(var(--header-height) + 2rem) 1.5rem 6rem;
}

/* ============================================
   Page Header
   ============================================ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.page-header-left h1 {
  font-size: 1.375rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.page-header-left h1 i {
  color: var(--teal);
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

/* ============================================
   Dual Grid (2 colonnes)
   ============================================ */
.zones-dual-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.zones-section-header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.75rem;
}

.zones-section-header i {
  color: var(--teal);
  font-size: 1rem;
}

.zones-section-header h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

/* ============================================
   Buttons
   ============================================ */
.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.btn-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--panel);
  border-color: var(--border);
  color: var(--text-muted);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border);
  color: var(--text);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

/* ============================================
   Zones Config Wrapper
   ============================================ */
.zones-config-wrapper {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.zones-config-list {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.zones-loading, .zones-error, .zones-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.zones-error {
  color: var(--danger);
}

.zones-error i, .zones-loading i {
  font-size: 1.25rem;
}

/* ============================================
   Zone Item
   ============================================ */
.zone-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.625rem;
  transition: border-color 0.2s;
}

.zone-item:hover {
  border-color: rgba(20, 184, 166, 0.3);
}

.zone-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  cursor: grab;
  opacity: 0.4;
  transition: all 0.2s;
  flex-shrink: 0;
}

.zone-drag-handle:hover {
  opacity: 1;
  color: var(--teal);
}

.zone-drag-handle:active {
  cursor: grabbing;
}

.zone-input {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  padding: 0.25rem 0.375rem;
  font-size: 0.875rem;
  color: var(--text);
  transition: border-color 0.2s;
}

.zone-input:hover {
  border-bottom-color: var(--border);
}

.zone-input:focus {
  outline: none;
  border-bottom-color: var(--teal);
}

.zone-input::placeholder {
  color: var(--text-muted);
}

.zone-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  opacity: 0;
  transition: all 0.15s;
  flex-shrink: 0;
}

.zone-item:hover .zone-delete {
  opacity: 0.7;
}

.zone-delete:hover {
  opacity: 1 !important;
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

/* Drag & Drop States */
.zone-item.dragging {
  opacity: 0.5;
  border-color: var(--teal) !important;
}

.zone-item.drag-space-above {
  margin-top: 32px;
  transition: margin 0.15s ease-out;
}

.zone-item.drag-space-below {
  margin-bottom: 32px;
  transition: margin 0.15s ease-out;
}

/* ============================================
   Add Zone Button
   ============================================ */
.zones-add-wrapper {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

.btn-add-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.625rem 1rem;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-add-zone:hover {
  background: rgba(20, 184, 166, 0.1);
  border-color: var(--teal);
  color: var(--teal);
}

/* ============================================
   Actions Bar (bas de page)
   ============================================ */
.zones-actions-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.875rem 1.5rem;
  background: var(--panel);
  border-top: 1px solid var(--border);
  z-index: 100;
}

.zones-actions-left {
  flex: 1;
}

.status-message {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.status-message.warning {
  color: var(--warning);
}

.status-message.success {
  color: var(--success);
}

.status-message.error {
  color: var(--danger);
}

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

/* ============================================
   Toast
   ============================================ */
.toast {
  position: fixed;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.875rem;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.success {
  border-color: var(--success);
  color: var(--success);
}

.toast.error {
  border-color: var(--danger);
  color: var(--danger);
}

/* ============================================
   Modale de Confirmation
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
}

.modal-overlay.hidden {
  display: none;
}

.modal-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  border-radius: 12px 12px 0 0;
}

.modal-header.modal-warning {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(239, 68, 68, 0.1));
}

.modal-header.modal-warning i {
  color: var(--warning);
  font-size: 1.25rem;
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.modal-body {
  padding: 1.25rem;
}

.modal-body p {
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.5;
  margin: 0;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.625rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
  border-radius: 0 0 12px 12px;
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
  border-color: #dc2626;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
  .zones-dual-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .main-content {
    padding: calc(var(--header-height) + 1rem) 1rem 5rem;
  }

  .page-header {
    flex-direction: column;
    gap: 1rem;
  }

  .zones-actions-bar {
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
  }

  .zones-actions-left {
    width: 100%;
    text-align: center;
  }

  .zones-actions-right {
    width: 100%;
    justify-content: center;
  }
}
