/**
 * FORMS - NOUVEAU DESIGN
 */

/* ==========================================
   BACKGROUND
   ========================================== */

body {
  background-color: #f4f6fb;
}

/* ==========================================
   FORM CONTAINER
   ========================================== */

.ct-form-container {
  background: white;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  padding: 30px;
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
}

/* Header du formulaire */
.ct-form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

.ct-form-header h1,
.ct-form-header h2 {
  font-size: 24px;
  color: #09121d;
  font-weight: 600;
  margin: 0;
}

.ct-form-close-btn {
  border: none;
  background: none;
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ct-form-close-btn img {
  width: 25px;
  height: 25px;
}

/* ==========================================
   FORM SECTIONS
   ========================================== */

.ct-form-section {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 20px;
  border-top: 1px solid #e5e7eb;
  padding-top: 20px;
  margin-top: 10px;
}

.ct-form-section-title {
  display: grid;
  grid-template-columns: 25px 1fr;
  font-size: 13px;
  color: #1e2a38;
  margin-bottom: 15px;
  font-weight: 600;
  gap: 8px;
  align-items: start;
}

.ct-form-section-title img,
.ct-form-section-title i {
  width: 25px;
  height: 25px;
  font-size: 18px;
}

/* ==========================================
   FORM GRID (2 colonnes)
   ========================================== */

.ct-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

/* Responsive : 1 colonne en mobile */
@media (max-width: 768px) {
  .ct-form-grid {
    grid-template-columns: 1fr;
  }

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

/* ==========================================
   FORM GROUPS
   ========================================== */

.ct-form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ct-form-group label {
  display: block;
  font-size: 12px;
  color: #2e2e2e;
  margin-bottom: 5px;
  font-weight: 700;
}

/* Champ requis (astérisque rouge) */
.ct-form-group label span,
.ct-form-required {
  color: #ef4444;
  margin-left: 2px;
}

/* ==========================================
   FORM INPUTS
   ========================================== */

.ct-form-input,
.ct-form-select,
.ct-form-textarea {
  border: none;
  background-color: #f4f6fb;
  width: 100%;
  height: 40px;
  padding: 10px;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  font-family: "Inter", sans-serif;
  transition: all 0.2s ease;
}

.ct-form-textarea {
  height: 100px;
  resize: vertical;
  padding: 12px;
}

/* Placeholder */
.ct-form-input::placeholder,
.ct-form-textarea::placeholder {
  color: #8b919a;
}

/* Focus state */
.ct-form-input:focus,
.ct-form-select:focus,
.ct-form-textarea:focus {
  background-color: #fff;
  border: 2px solid #2563eb;
  box-shadow: 0 8px 10px rgba(0, 0, 0, 0.05);
  padding: 8px; /* Compenser la bordure de 2px */
}

/* Input readonly/disabled */
.ct-form-input:read-only,
.ct-form-input[readonly] {
  background-color: #eaf2fd;
  font-weight: 600;
  color: #2563eb;
  cursor: not-allowed;
}

.ct-form-input:read-only:focus,
.ct-form-input[readonly]:focus {
  border: none;
  box-shadow: none;
  background-color: #eaf2fd;
  padding: 10px;
}

.ct-form-input:disabled,
.ct-form-select:disabled,
.ct-form-textarea:disabled {
  background-color: #e5e7eb;
  color: #747d9e;
  cursor: not-allowed;
}

/* Select arrow customization */
.ct-form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%232e2e2e' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 35px;
}

/* ==========================================
   FORM ACTIONS (Boutons du formulaire)
   ========================================== */

.ct-form-actions {
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid #e5e7eb;
  margin-top: 25px;
  padding-top: 20px;
  gap: 15px;
}

/* Responsive : boutons en pleine largeur sur mobile */
@media (max-width: 576px) {
  .ct-form-actions {
    flex-direction: column-reverse;
  }

  .ct-form-actions button {
    width: 100%;
  }
}

/* ==========================================
   BOUTONS
   ========================================== */

.ct-btn-primary {
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
}

.ct-btn-primary:hover {
  background: #1d4ed8;
}

.ct-btn-primary:active {
  background: #1e40af;
}

.ct-btn-secondary {
  background: #fff;
  color: #2563eb;
  border: none;
  padding: 8px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
}

.ct-btn-secondary:hover {
  background: #eaf2fd;
}

.ct-btn-secondary:active {
  background: #dbeafe;
}

/* Bouton Success */
.ct-btn-success {
  background: #10b981;
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
}

.ct-btn-success:hover {
  background: #059669;
}

/* Bouton Danger */
.ct-btn-danger {
  background: #ef4444;
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
}

.ct-btn-danger:hover {
  background: #dc2626;
}

/* Bouton Warning */
.ct-btn-warning {
  background: #f59e0b;
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
}

.ct-btn-warning:hover {
  background: #d97706;
}

/* Bouton Info */
.ct-btn-info {
  background: #3b82f6;
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
}

.ct-btn-info:hover {
  background: #2563eb;
}

/* Boutons avec icônes */
.ct-btn-primary i,
.ct-btn-secondary i {
  font-size: 16px;
}

/* ==========================================
   VALIDATION ERRORS
   ========================================== */

.ct-form-error {
  color: #ef4444;
  font-size: 12px;
  margin-top: 4px;
  display: block;
}

.ct-form-input.error,
.ct-form-select.error,
.ct-form-textarea.error {
  border: 2px solid #ef4444;
  background-color: #fef2f2;
}

.ct-form-input.error:focus,
.ct-form-select.error:focus,
.ct-form-textarea.error:focus {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* ==========================================
   SUCCESS STATE
   ========================================== */

.ct-form-success {
  color: #10b981;
  font-size: 12px;
  margin-top: 4px;
  display: block;
}

.ct-form-input.success,
.ct-form-select.success,
.ct-form-textarea.success {
  border: 2px solid #10b981;
  background-color: #f0fdf4;
}

/* ==========================================
   FORM HELPERS
   ========================================== */

.ct-form-help-text {
  font-size: 12px;
  color: #747d9e;
  margin-top: 4px;
}

/* ==========================================
   CHECKBOX & RADIO
   ========================================== */

.ct-form-checkbox,
.ct-form-radio {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.ct-form-checkbox input[type="checkbox"],
.ct-form-radio input[type="radio"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #2563eb;
}

.ct-form-checkbox label,
.ct-form-radio label {
  font-weight: 400;
  cursor: pointer;
  margin: 0;
}

/* ==========================================
   INTEGRATION AVEC LIVEWIRE
   ========================================== */

/* Wire:loading state */
.ct-form-input[wire\:loading],
.ct-form-select[wire\:loading],
.ct-form-textarea[wire\:loading] {
  opacity: 0.6;
  cursor: wait;
}

/* Wire:dirty state (champ modifié non sauvegardé) */
.ct-form-input[wire\:dirty],
.ct-form-select[wire\:dirty],
.ct-form-textarea[wire\:dirty] {
  border-left: 3px solid #f59e0b;
}
