/* Komax Tunisia — Contrôle CF / OC : Style de l'interface de connexion sécurisée
 * Charte Komax : Bleu #396999, Rouge #f04c54, Gris foncé #4d4e4d, Gris clair #c6cacd
 */
@import url("/tokens.css");

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

body {
  font-family: var(--font, "Helvetica Neue", Helvetica, Arial, sans-serif);
  color: var(--text, #4d4e4d);
  background: linear-gradient(135deg, #1e2e42 0%, #253e5b 50%, #1a2a3e 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow-x: hidden;
  padding: 20px;
}

/* Éléments de fond décoratifs d'ambiance */
body::before {
  content: "";
  position: absolute;
  top: -15%;
  right: -10%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(57, 105, 153, 0.25) 0%, rgba(57, 105, 153, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: "";
  position: absolute;
  bottom: -20%;
  left: -10%;
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgba(240, 76, 84, 0.12) 0%, rgba(240, 76, 84, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

.login-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
}

.login-card {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.1);
  overflow: hidden;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Liseré supérieur avec dégradé officiel Komax Rouge -> Bleu */
.brand-accent-bar {
  height: 4px;
  background: linear-gradient(90deg, var(--komax-red, #f04c54) 0%, var(--komax-blue, #396999) 100%);
  width: 100%;
}

.login-header {
  padding: 32px 32px 20px 32px;
  text-align: center;
  border-bottom: 1px solid #edf0f2;
}

.logo-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 16px;
}

.logo-container img {
  height: 38px;
  width: auto;
  display: block;
}

.secure-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eef5fc;
  color: #295077;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid #c5d5eb;
  margin-bottom: 12px;
}

.secure-dot {
  width: 7px;
  height: 7px;
  background-color: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 5px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.login-title {
  font-size: 20px;
  font-weight: 700;
  color: #253e5b;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 13px;
  color: #6b7280;
}

.login-body {
  padding: 24px 32px 32px 32px;
}

/* Alerte d'erreur */
.error-banner {
  display: none;
  align-items: flex-start;
  gap: 10px;
  background-color: #fde8e9;
  border: 1px solid #f8b4b7;
  color: #a4262c;
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 20px;
  animation: slideDown 0.2s ease;
}

.error-banner.visible {
  display: flex;
}

.error-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Champs de formulaire */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}

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

.input-icon {
  position: absolute;
  left: 12px;
  color: #90969a;
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.form-input {
  width: 100%;
  padding: 11px 12px 11px 38px;
  font-size: 14px;
  font-family: inherit;
  color: #1f2937;
  background-color: #ffffff;
  border: 1px solid #c6cacd;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input::placeholder {
  color: #9ca3af;
}

.form-input:focus {
  border-color: var(--komax-blue, #396999);
  box-shadow: 0 0 0 3px rgba(57, 105, 153, 0.2);
}

.password-toggle {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: #90969a;
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}

.password-toggle:hover {
  color: var(--komax-blue, #396999);
}

.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
  font-size: 13px;
}

.remember-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #4b5563;
  cursor: pointer;
  user-select: none;
}

.remember-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--komax-blue, #396999);
  cursor: pointer;
}

/* Bouton principal de connexion */
.submit-btn {
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: #ffffff;
  background: linear-gradient(180deg, #3f74a8 0%, #305881 100%);
  border: 1px solid #295077;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 2px 4px rgba(37, 62, 91, 0.2);
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}

.submit-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #4781b9 0%, #356291 100%);
  box-shadow: 0 4px 8px rgba(37, 62, 91, 0.25);
}

.submit-btn:active:not(:disabled) {
  transform: translateY(1px);
}

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

.submit-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: spin 0.8s linear infinite;
}

.submit-btn.loading .submit-spinner {
  display: block;
}

.submit-btn.loading .submit-icon,
.submit-btn.loading .submit-text {
  opacity: 0.8;
}

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

/* Footer d'assurance sécurité */
.security-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}

.copyright {
  font-size: 11px;
  opacity: 0.6;
}

@media (max-width: 480px) {
  body {
    padding: 12px 10px;
    justify-content: flex-start;
    padding-top: 24px;
  }
  .login-wrapper {
    max-width: 100%;
  }
  .login-card {
    border-radius: 10px;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.3);
  }
  .login-header {
    padding: 20px 16px 14px 16px;
  }
  .logo-container {
    margin-bottom: 12px;
  }
  .logo-container img {
    height: 32px;
  }
  .login-title {
    font-size: 18px;
  }
  .login-subtitle {
    font-size: 12px;
  }
  .login-body {
    padding: 16px 16px 20px 16px;
  }
  .form-group {
    margin-bottom: 14px;
  }
  .input-wrapper input {
    font-size: 16px;
    padding: 10px 12px 10px 38px;
    height: 44px;
  }
  .submit-btn {
    padding: 12px;
    font-size: 14px;
    min-height: 46px;
  }
  .security-footer {
    margin-top: 16px;
    font-size: 11px;
  }
}
