/* Variables de personnalisation */
:root {
  --color-primary:     #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-success:     #16a34a;
  --color-error:       #dc2626;
  --color-text:        #111827;
  --color-text-light:  #6b7280;
  --color-border:      #d1d5db;
  --color-border-focus:#2563eb;
  --color-bg-card:     #ffffff;
  --color-bg-page:     #c02a2a;
  --radius-card:       1rem;
  --radius-input:      0.5rem;
  --shadow-card:       0 20px 60px rgba(0,0,0,0.25);
  --font-family:       'Inter', system-ui, sans-serif;
}

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

html, body {
  height: 100%;
}

body {
  font-family: var(--font-family);
  font-size: 15px;
  color: var(--color-text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-bg-page);
  background-image:
    linear-gradient(160deg, #d93535 0%, #c02a2a 40%, #8b1a1a 100%),
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 40px,
      rgba(0,0,0,0.03) 40px,
      rgba(0,0,0,0.03) 80px
    );
  padding: 1rem;
}

.background-overlay {
  position: fixed;
  inset: 0;
  background: inherit;
  z-index: -1;
}

/* Carte principale */
.portal-container {
  width: 100%;
  max-width: 480px;
}

.portal-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 2.5rem 2rem;
  animation: fadeUp 0.4s ease both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Logo */
.portal-logo {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 1.5rem;
  background: var(--color-bg-page);
  border-radius: 0.5rem;
  padding: 1rem;
}

.portal-logo img {
  max-height: 64px;
  max-width: 180px;
  object-fit: contain;
}

.company-name-text {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: -0.5px;
}

/* En-tête */
.portal-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.portal-header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.35rem;
}

.portal-header p {
  font-size: 0.9rem;
  color: var(--color-text-light);
}

/* Messages de statut */
.status-message {
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
  line-height: 1.4;
}

.status-message.hidden { display: none; }

.status-success {
  background: #f0fdf4;
  color: var(--color-success);
  border: 1px solid #bbf7d0;
}

.status-error {
  background: #fef2f2;
  color: var(--color-error);
  border: 1px solid #fecaca;
}

/* Formulaire */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.35rem;
}

.required {
  color: var(--color-error);
}

.form-group input[type="text"],
.form-group input[type="email"] {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-input);
  font-family: var(--font-family);
  font-size: 0.95rem;
  color: var(--color-text);
  background: #f9fafb;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  outline: none;
}

.form-group input:focus {
  border-color: var(--color-border-focus);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-group input.input-error {
  border-color: var(--color-error);
  background: #fff8f8;
}

.form-group input.input-error:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.field-hint {
  font-size: 0.78rem;
  color: var(--color-text-light);
  margin-top: 0.25rem;
}

.field-error {
  font-size: 0.78rem;
  color: var(--color-error);
  margin-top: 0.25rem;
  min-height: 1rem;
}

/* Checkbox RGPD */
.form-group--checkbox {
  margin-bottom: 1.25rem;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checkbox-custom {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  border: 1.5px solid var(--color-border);
  border-radius: 4px;
  background: #f9fafb;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s;
}

.checkbox-label input:checked + .checkbox-custom {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.checkbox-label input:checked + .checkbox-custom::after {
  content: '';
  display: block;
  width: 5px;
  height: 9px;
  border: 2px solid white;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translate(-1px, -1px);
}

.checkbox-text {
  font-size: 0.82rem;
  color: var(--color-text-light);
  line-height: 1.5;
}

/* Bouton de soumission */
.btn-submit {
  width: 100%;
  padding: 0.8rem 1.5rem;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--radius-input);
  font-family: var(--font-family);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-submit:hover:not(:disabled) {
  background: var(--color-primary-hover);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

.btn-submit:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Spinner */
.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn-spinner.hidden { display: none; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive mobile */
@media (max-width: 480px) {
  .portal-card {
    padding: 2rem 1.25rem;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .portal-header h1 {
    font-size: 1.25rem;
  }
}
