:root {
  --modal-bg: #ffffff;
  --modal-backdrop: rgba(15, 23, 42, 0.6);
  --modal-border: #e2e8f0;
  --modal-title: #0f172a;
  --modal-text: #334155;
  --modal-muted: #64748b;
  --modal-primary: #3b82f6;
  --modal-primary-hover: #2563eb;
  --modal-radius: 16px;
  --modal-font: 'Inter', system-ui, -apple-system, sans-serif;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  overflow-y: auto;
  font-family: var(--modal-font);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--modal-backdrop);
  backdrop-filter: blur(4px);
  animation: modalFadeIn 0.2s ease-out;
}

.modal-container {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  background: var(--modal-bg);
  border-radius: var(--modal-radius);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  z-index: 10;
  animation: modalSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

/* Header */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--modal-border);
  background: #ffffff;
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.modal-badge-tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: #eff6ff;
  color: var(--modal-primary);
  text-transform: uppercase;
}

.modal-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--modal-title);
}

.modal-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--modal-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.modal-close-btn:hover {
  background: #f1f5f9;
  color: var(--modal-title);
}

.modal-close-btn svg {
  width: 18px;
  height: 18px;
}

/* Formulario */
.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

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

.form-row {
  display: flex;
  gap: 1rem;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

.form-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--modal-text);
}

.required {
  color: #ef4444;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  color: var(--modal-title);
  background: #f8fafc;
  border: 1px solid var(--modal-border);
  border-radius: 8px;
  outline: none;
  font-family: inherit;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  background: #ffffff;
  border-color: var(--modal-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.price-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.price-currency-symbol {
  position: absolute;
  left: 0.875rem;
  font-weight: 600;
  color: var(--modal-muted);
}

.price-input {
  padding-left: 2rem;
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

/* Placeholder dropzone */
.dropzone-placeholder-box {
  padding: 1.5rem;
  border: 2px dashed var(--modal-border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--modal-muted);
  font-size: 0.8125rem;
  cursor: pointer;
  background: #f8fafc;
  transition: all 0.2s ease;
}

.dropzone-placeholder-box svg {
  width: 24px;
  height: 24px;
}

.dropzone-placeholder-box:hover {
  border-color: var(--modal-primary);
  color: var(--modal-primary);
}

/* Toggles */
.toggles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.toggle-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem;
  border: 1px solid var(--modal-border);
  border-radius: 8px;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.15s ease;
}

.toggle-card:hover {
  background: #ffffff;
  border-color: #cbd5e1;
}

.toggle-checkbox {
  width: 18px;
  height: 18px;
  margin-top: 0.125rem;
  accent-color: var(--modal-primary);
  cursor: pointer;
}

.toggle-card-content {
  display: flex;
  flex-direction: column;
}

.toggle-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--modal-title);
}

.toggle-desc {
  font-size: 0.75rem;
  color: var(--modal-muted);
  margin-top: 0.125rem;
}

/* Footer */
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--modal-border);
  margin-top: 0.5rem;
}

.btn-modal {
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.btn-cancel {
  background: #f1f5f9;
  color: #475569;
}

.btn-cancel:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.btn-save {
  background: var(--modal-primary);
  color: #ffffff;
}

.btn-save:hover {
  background: var(--modal-primary-hover);
}

.btn-danger {
  background: var(--neon-magenta, #e11d48);
  color: #ffffff;
}

.btn-danger:hover {
  filter: brightness(1.12);
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 600px) {
  .form-row {
    flex-direction: column;
  }
}

/* Modal selección masiva de canciones para playlist (Fase 2.1) */
.pl-modal-search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.pl-modal-search-box .search-icon {
  position: absolute;
  left: 0.875rem;
  width: 1.125rem;
  height: 1.125rem;
  color: var(--modal-muted);
  pointer-events: none;
}

.pl-modal-search-box .form-input {
  padding-left: 2.5rem;
}

.pl-modal-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.pl-modal-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--modal-border);
  border-radius: 8px;
  background: var(--admin-bg-soft, #172442);
  cursor: pointer;
  transition: all 0.15s ease;
}

.pl-modal-item:hover {
  background: var(--admin-sidebar-active, #1a2b4c);
  border-color: var(--modal-primary);
}

.pl-modal-item.is-selected {
  background: rgba(0, 245, 212, 0.12);
  border-color: var(--modal-primary);
  box-shadow: 0 0 12px rgba(0, 245, 212, 0.15);
}

.pl-modal-item.is-in-playlist {
  opacity: 0.65;
  cursor: not-allowed;
}

.pl-modal-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--modal-primary);
  cursor: pointer;
  flex-shrink: 0;
}

.pl-modal-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.pl-modal-item-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--modal-title);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pl-modal-item-artist {
  font-size: 0.75rem;
  color: var(--modal-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pl-modal-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(0, 245, 212, 0.15);
  color: var(--modal-primary);
  border: 1px solid rgba(0, 245, 212, 0.35);
  flex-shrink: 0;
}

.pl-modal-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--modal-muted);
  font-size: 0.85rem;
}

/* Modal subida masiva con drag & drop (Fase 3.2) */
.upload-dropzone {
  border: 2px dashed var(--modal-border);
  border-radius: 12px;
  padding: 1.75rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  text-align: center;
  cursor: pointer;
  background: var(--admin-bg-base, #121214);
  color: var(--modal-muted);
  transition: all 0.2s ease;
}

.upload-dropzone svg {
  width: 30px;
  height: 30px;
  color: var(--modal-primary);
}

.upload-dropzone-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--modal-title);
}

.upload-dropzone-hint {
  font-size: 0.75rem;
  color: var(--modal-muted);
}

.upload-dropzone.is-dragover {
  border-color: var(--modal-primary);
  background: rgba(0, 245, 212, 0.08);
  box-shadow: 0 0 18px rgba(0, 245, 212, 0.25);
  transform: scale(1.01);
}

.upload-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.upload-progress-label {
  font-size: 0.78rem;
  color: var(--modal-muted);
}

.upload-progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.upload-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--modal-primary), #38bdf8);
  transition: width 0.2s ease;
}

.upload-file-status {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  flex-shrink: 0;
}

.upload-file-status.pending {
  background: rgba(148, 163, 184, 0.15);
  color: var(--modal-muted);
  border: 1px solid var(--modal-border);
}

.upload-file-status.uploading {
  background: rgba(0, 245, 212, 0.15);
  color: var(--modal-primary);
  border: 1px solid rgba(0, 245, 212, 0.35);
}

.upload-file-status.done {
  background: rgba(0, 245, 212, 0.15);
  color: var(--modal-primary);
  border: 1px solid rgba(0, 245, 212, 0.35);
}

.upload-file-status.error {
  background: rgba(255, 0, 127, 0.15);
  color: #ff5c9d;
  border: 1px solid rgba(255, 0, 127, 0.35);
}
