/**
 * Role Modal Styles
 * Modal moderne glassmorphism pour rôles de progression
 * Couleur thème: Yellow/Orange (#fbbf24 / #f97316)
 */

/* ============================================
   OVERLAY & MODAL CONTAINER
   ============================================ */

.role-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 1.5rem;
}

.role-modal {
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  border-radius: 24px;
  border: 1px solid rgba(251, 191, 36, 0.3);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.1) 0%, rgba(30, 30, 40, 0.95) 30%);
  backdrop-filter: blur(16px);
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.5),
    0 0 80px rgba(251, 191, 36, 0.1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ============================================
   MODAL HEADER
   ============================================ */

.role-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(var(--role-color), 0.3);
}

.header-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.modal-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary, #fff);
}

.modal-subtitle {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted, #888);
}

.btn-close-modal {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-close-modal svg {
  width: 18px;
  height: 18px;
  color: var(--text-muted, #888);
}

.btn-close-modal:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
}

.btn-close-modal:hover svg {
  color: #ef4444;
}

/* ============================================
   MODAL CONTENT
   ============================================ */

.role-modal-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Role Preview Live */
.role-preview-live {
  border-radius: 16px;
  border: 2px solid;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}

.preview-color-bar {
  height: 5px;
  transition: background-color 0.3s ease;
}

.preview-body {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
}

.preview-icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: background-color 0.3s ease;
}

.preview-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.preview-name {
  font-size: 1.1rem;
  font-weight: 600;
  transition: color 0.3s ease;
}

.preview-percent {
  padding: 0.25rem 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary, #ccc);
}

/* ============================================
   FORM FIELDS
   ============================================ */

.role-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

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

.form-field.full-width {
  grid-column: 1 / -1;
}

.field-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary, #ccc);
}

.label-icon {
  font-size: 0.9rem;
}

.field-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-primary, #fff);
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.field-input:focus {
  outline: none;
  border-color: #fbbf24;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.2);
}

.field-input.has-value {
  border-color: rgba(251, 191, 36, 0.4);
}

.field-input.small {
  width: 70px;
  padding: 0.5rem 0.75rem;
  text-align: center;
}

.field-input::placeholder {
  color: var(--text-muted, #666);
}

/* Color Picker */
.color-picker-group {
  display: flex;
  gap: 0.75rem;
  align-items: stretch;
}

.color-preview-box {
  width: 52px;
  height: 46px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
}

.color-preview-box:hover {
  border-color: rgba(255, 255, 255, 0.4);
  transform: scale(1.05);
}

.color-input-native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.hex-input {
  flex: 1;
  font-family: monospace;
  text-transform: uppercase;
}

/* Percentage Slider */
.percentage-input-group {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.percentage-slider {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.percentage-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--slider-color, #fbbf24);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  cursor: grab;
  transition: transform 0.2s ease;
}

.percentage-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.percentage-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
}

.percentage-value {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.percent-symbol {
  font-size: 0.9rem;
  color: var(--text-muted, #888);
}

/* Items Count Badge */
.items-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 10px;
  margin-top: 0.5rem;
}

.badge-icon {
  font-size: 0.85rem;
}

.badge-text {
  font-size: 0.8rem;
  color: #fbbf24;
  font-weight: 500;
}

.items-warning {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: rgba(249, 115, 22, 0.15);
  border: 1px solid rgba(249, 115, 22, 0.3);
  border-radius: 10px;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: #f97316;
}

.warning-icon {
  font-size: 0.85rem;
}

/* ============================================
   DISCORD OPTIONS
   ============================================ */

.discord-options {
  background: rgba(88, 101, 242, 0.08);
  border: 1px solid rgba(88, 101, 242, 0.2);
  border-radius: 16px;
  padding: 1.25rem;
}

.options-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #5865f2;
}

.discord-logo {
  display: flex;
  align-items: center;
  justify-content: center;
}

.discord-logo svg {
  width: 20px;
  height: 20px;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.option-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.option-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.option-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(88, 101, 242, 0.2);
  border-radius: 8px;
  font-size: 0.9rem;
}

.option-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.option-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary, #fff);
}

.option-desc {
  font-size: 0.7rem;
  color: var(--text-muted, #888);
}

/* Toggle Switch V2 */
.toggle-switch-v2 {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

.toggle-switch-v2 input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-track {
  display: block;
  width: 44px;
  height: 24px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  position: relative;
  transition: all 0.3s ease;
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.toggle-switch-v2 input:checked + .toggle-track {
  background: linear-gradient(135deg, #fbbf24, #f97316);
}

.toggle-switch-v2 input:checked + .toggle-track .toggle-thumb {
  left: 23px;
}

/* ============================================
   VALIDATION ERROR
   ============================================ */

.validation-error-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 12px;
}

.error-icon {
  font-size: 1rem;
}

.error-text {
  font-size: 0.85rem;
  color: #ef4444;
  font-weight: 500;
}

/* ============================================
   MODAL FOOTER
   ============================================ */

.role-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
}

.btn-modal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.btn-cancel {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary, #ccc);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-cancel:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-primary, #fff);
}

.btn-save {
  background: linear-gradient(135deg, #fbbf24, #f97316);
  color: #000;
  box-shadow: 0 4px 15px rgba(251, 191, 36, 0.3);
}

.btn-save:hover:not(.disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(251, 191, 36, 0.4);
}

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

.btn-icon {
  font-size: 0.85rem;
}

/* ============================================
   TRANSITION ANIMATIONS
   ============================================ */

.modal-fade-enter-active,
.modal-fade-leave-active {
  transition: all 0.3s ease;
}

.modal-fade-enter-from,
.modal-fade-leave-to {
  opacity: 0;
}

.modal-fade-enter-from .role-modal,
.modal-fade-leave-to .role-modal {
  transform: scale(0.9) translateY(20px);
  opacity: 0;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 600px) {
  .role-modal-overlay {
    padding: 1rem;
  }

  .role-modal {
    max-height: 95vh;
  }

  .role-form-grid {
    grid-template-columns: 1fr;
  }

  .options-grid {
    grid-template-columns: 1fr;
  }

  .role-modal-header {
    padding: 1rem;
  }

  .role-modal-content {
    padding: 1rem;
  }

  .role-modal-footer {
    padding: 1rem;
  }
}
