/* ============================================================
   KAR.MESSAGERIE.ET.COLIS — Login CSS
   ============================================================ */

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

:root {
  --gold:       #C8922A;
  --gold-dark:  #A07018;
  --bg:         #07070F;
  --card:       #0F0F1E;
  --card2:      #141430;
  --border:     rgba(255,255,255,0.08);
  --text:       #E8E8F0;
  --text2:      #9CA3AF;
  --text3:      #5A6070;
  --green:      #10B981;
  --red:        #EF4444;
}

html, body {
  height: 100%;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* ===== LAYOUT ===== */
.login-layout {
  display: flex;
  min-height: 100vh;
}

/* ===== LEFT PANEL ===== */
.login-panel-left {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: none; /* hidden on mobile */
}

@media (min-width: 900px) {
  .login-panel-left { display: block; }
}

.panel-bg {
  position: absolute;
  inset: 0;
}

.panel-bg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.6s ease;
}

.panel-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(7,7,15,0.88) 0%,
    rgba(7,7,15,0.55) 50%,
    rgba(200,146,42,0.18) 100%
  );
}

.panel-content {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px;
}

.panel-logo img {
  height: 90px;
  width: auto;
  filter: drop-shadow(0 2px 12px rgba(200,146,42,0.4));
}

.panel-tagline h2 {
  font-size: 2.4rem;
  font-weight: 900;
  line-height: 1.15;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

.panel-tagline h2 span {
  color: var(--gold);
}

.panel-tagline p {
  margin-top: 14px;
  font-size: 1rem;
  color: rgba(255,255,255,0.7);
  max-width: 340px;
  line-height: 1.6;
}

.panel-stats {
  display: flex;
  align-items: center;
  gap: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 20px 28px;
}

.pstat { flex: 1; text-align: center; }

.pstat-val {
  display: block;
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--gold);
  line-height: 1;
}

.pstat-label {
  display: block;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.6);
  margin-top: 4px;
  font-weight: 500;
}

.pstat-divider {
  width: 1px;
  height: 40px;
  background: rgba(255,255,255,0.12);
  margin: 0 4px;
}

/* ===== RIGHT PANEL ===== */
.login-panel-right {
  width: 100%;
  max-width: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  padding: 32px 24px;
  min-height: 100vh;
}

@media (min-width: 900px) {
  .login-panel-right {
    border-left: 1px solid var(--border);
  }
}

/* ===== LOGIN BOX ===== */
.login-box {
  width: 100%;
  max-width: 400px;
}

.mobile-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 28px;
}

.mobile-logo img {
  height: 72px;
  object-fit: contain;
  filter: drop-shadow(0 2px 10px rgba(200,146,42,0.4));
}

@media (min-width: 900px) {
  .mobile-logo { display: none; }
}

/* ===== LOGIN HEADER ===== */
.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.lock-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: rgba(200,146,42,0.12);
  border: 1px solid rgba(200,146,42,0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: var(--gold);
  margin-bottom: 16px;
}

.login-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}

.login-header p {
  font-size: 0.88rem;
  color: var(--text2);
}

/* ===== ALERT ===== */
.login-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 10px;
  padding: 12px 16px;
  color: #FCA5A5;
  font-size: 0.87rem;
  margin-bottom: 20px;
  animation: slideDown 0.2s ease;
}

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

/* ===== FORM ===== */
.field-group {
  margin-bottom: 18px;
}

.field-group label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 8px;
}

.forgot-link {
  font-size: 0.78rem;
  color: var(--gold);
  text-decoration: none;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  transition: opacity 0.2s;
}

.forgot-link:hover { opacity: 0.75; }

.field-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.field-icon {
  position: absolute;
  left: 14px;
  color: var(--text3);
  font-size: 0.88rem;
  pointer-events: none;
}

.field-wrap input {
  width: 100%;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 14px 13px 40px;
  color: var(--text);
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field-wrap input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(200,146,42,0.1);
}

.field-wrap input::placeholder { color: var(--text3); }

.toggle-pw {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 6px;
  border-radius: 6px;
  transition: color 0.2s;
}

.toggle-pw:hover { color: var(--gold); }

/* ===== CHECKBOX ===== */
.field-row { margin-bottom: 22px; }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.87rem;
  color: var(--text2);
  user-select: none;
}

.checkbox-label input[type="checkbox"] { display: none; }

.checkbox-custom {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--border);
  background: var(--card2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}

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

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

/* ===== LOGIN BUTTON ===== */
.btn-login {
  width: 100%;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px 24px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-bottom: 24px;
  letter-spacing: 0.2px;
}

.btn-login:hover:not(:disabled) { opacity: 0.9; transform: translateY(-1px); }
.btn-login:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }

.btn-login.success {
  background: linear-gradient(135deg, var(--green), #0D9E6E);
}

#loginBtnLoader { display: inline-flex; align-items: center; gap: 8px; }

/* ===== SHAKE ANIMATION ===== */
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-8px); }
  40%      { transform: translateX(8px); }
  60%      { transform: translateX(-5px); }
  80%      { transform: translateX(5px); }
}

.shake { animation: shake 0.45s ease; }

/* ===== DEMO HINT ===== */
.demo-hint {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 24px;
  overflow: hidden;
}

.demo-hint-header {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text2);
  user-select: none;
  transition: background 0.15s;
}

.demo-hint-header:hover { background: rgba(255,255,255,0.03); }
.demo-hint-header i:first-child { color: var(--gold); }

.hint-chevron {
  margin-left: auto;
  font-size: 0.75rem;
  transition: transform 0.25s;
}

.demo-hint-body {
  display: none;
  padding: 0 16px 14px;
}

.demo-hint-body.open { display: block; }

.cred-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.79rem;
  flex-wrap: wrap;
}

.cred-row:last-of-type { border-bottom: none; }

.cred-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 50px;
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
}

.cred-badge.admin   { background: rgba(200,146,42,0.15); color: #C8922A; }
.cred-badge.manager { background: rgba(59,130,246,0.15);  color: #3B82F6; }
.cred-badge.agent   { background: rgba(16,185,129,0.15);  color: #10B981; }

.cred-val { color: var(--text2); font-family: 'Courier New', monospace; font-size: 0.77rem; }

.cred-pw {
  margin-left: auto;
  color: var(--gold);
  font-family: 'Courier New', monospace;
  font-weight: 700;
  font-size: 0.8rem;
}

.hint-note {
  font-size: 0.74rem;
  color: #F59E0B;
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ===== FOOTER ===== */
.login-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text3);
}

.login-footer a {
  color: var(--text3);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s;
}

.login-footer a:hover { color: var(--gold); }
