/* ==========================================================================
   Karibo - Recherche par Plaque / VIN
   All classes prefixed with .kp- to avoid conflicts with existing themes.
   v1.1.0 — Added VIN support
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Search Bar
   -------------------------------------------------------------------------- */

.kp-bar {
  background-color: #1a1a2e;
  width: 100%;
  padding: 12px 0;
  box-sizing: border-box;
  border-bottom: 3px solid #E30613;
  z-index: 999;
  position: relative;
}

.kp-bar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   2. Label + French flag icon
   -------------------------------------------------------------------------- */

.kp-label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.kp-flag {
  display: flex;
  width: 22px;
  height: 16px;
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.2);
  flex-shrink: 0;
}

.kp-flag-blue  { flex: 1; background: #002395; }
.kp-flag-white { flex: 1; background: #FFFFFF; }
.kp-flag-red   { flex: 1; background: #ED2939; }

.kp-label-text {
  color: #e0e0e0;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  letter-spacing: 0.3px;
}

/* --------------------------------------------------------------------------
   3. Search Form
   -------------------------------------------------------------------------- */

.kp-form {
  display: flex;
  align-items: stretch;
  gap: 0;
  flex: 1;
  min-width: 0;
  max-width: 520px;
}

/* --------------------------------------------------------------------------
   4. License Plate Input
   -------------------------------------------------------------------------- */

.kp-plate-wrapper {
  display: flex;
  align-items: stretch;
  border: 2px solid #003189;
  border-right: none;
  border-radius: 4px 0 0 4px;
  overflow: hidden;
  background: #fff;
  flex-shrink: 0;
}

/* EU blue band (left side of plate) */
.kp-plate-eu {
  background: #003189;
  width: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kp-eu-stars {
  color: #FFCC00;
  font-size: 5px;
  line-height: 1.1;
  text-align: center;
  display: block;
}

/* Input group (plate wrapper + mode indicator) */
.kp-input-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
}

/* The actual text input */
.kp-plate-input {
  border: none;
  outline: none;
  background: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 0 10px;
  width: 220px;
  height: 44px;
  box-sizing: border-box;
  color: #1a1a2e;
  font-family: 'Arial', sans-serif;
  -webkit-appearance: none;
}

.kp-plate-input::placeholder {
  color: #aaa;
  letter-spacing: 1px;
  font-weight: 400;
  font-size: 14px;
}

/* Mode indicator (shows "VIN détecté" or "Plaque détectée") */
.kp-mode-indicator {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.4px;
  min-height: 14px;
  padding-left: 38px;
  transition: color 0.2s ease;
}

.kp-mode-indicator.kp-mode-vin {
  color: #64b5f6;
}

.kp-mode-indicator.kp-mode-plate {
  color: #81c784;
}

.kp-mode-indicator.kp-mode-typing {
  color: #aaa;
}

.kp-plate-input:focus {
  background: #f0f4ff;
}

/* --------------------------------------------------------------------------
   5. Search Button
   -------------------------------------------------------------------------- */

.kp-btn-search {
  background: #E30613;
  color: #fff;
  border: none;
  border-radius: 0 4px 4px 0;
  padding: 0 20px;
  height: 44px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: background 0.2s ease;
  letter-spacing: 0.4px;
  -webkit-appearance: none;
  box-sizing: border-box;
}

.kp-btn-search:hover,
.kp-btn-search:focus {
  background: #b8000f;
  outline: none;
}

.kp-btn-search:active {
  background: #8f000c;
}

.kp-btn-search:disabled {
  background: #888;
  cursor: not-allowed;
}

/* --------------------------------------------------------------------------
   6. Loading Spinner
   -------------------------------------------------------------------------- */

.kp-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: kp-spin 0.7s linear infinite;
  flex-shrink: 0;
}

.kp-spinner.kp-active {
  display: inline-block;
}

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

/* --------------------------------------------------------------------------
   7. Result Container & Vehicle Card
   -------------------------------------------------------------------------- */

.kp-result-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  overflow: hidden;
}

/* Slide-down animation */
.kp-card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.13);
  margin-top: 12px;
  padding: 20px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
  position: relative;
  animation: kp-slide-down 0.3s ease forwards;
  box-sizing: border-box;
}

@keyframes kp-slide-down {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Vehicle image (left column) */
.kp-card-img-wrap {
  flex-shrink: 0;
  width: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kp-car-image {
  max-width: 180px;
  max-height: 120px;
  object-fit: contain;
  border-radius: 4px;
}

.kp-car-image-placeholder {
  width: 180px;
  height: 110px;
  background: #f0f0f0;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #aaa;
  font-size: 13px;
}

/* Right column: vehicle info */
.kp-card-info {
  flex: 1;
  min-width: 0;
}

.kp-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.kp-card-title {
  font-size: 22px;
  font-weight: 800;
  color: #1a1a2e;
  line-height: 1.2;
  margin: 0;
  text-transform: uppercase;
}

.kp-card-version {
  font-size: 14px;
  color: #555;
  margin: 0 0 12px 0;
}

/* Badges (specs) */
.kp-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.kp-badge {
  background: #f5f5f5;
  border: 1px solid #ddd;
  color: #333;
  border-radius: 12px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.kp-badge-energy {
  background: #e8f5e9;
  border-color: #a5d6a7;
  color: #2e7d32;
}

.kp-badge-power {
  background: #fff3e0;
  border-color: #ffcc80;
  color: #e65100;
}

/* K-Type */
.kp-ktype {
  font-size: 12px;
  color: #888;
  margin-bottom: 14px;
  font-family: monospace;
}

/* Brand logo (top-right of card) */
.kp-brand-logo-wrap {
  flex-shrink: 0;
  text-align: right;
}

.kp-brand-logo {
  max-width: 70px;
  max-height: 45px;
  object-fit: contain;
}

/* CTA button */
.kp-btn-parts {
  display: inline-block;
  background: #E30613;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease;
  letter-spacing: 0.3px;
}

.kp-btn-parts:hover,
.kp-btn-parts:focus {
  background: #b8000f;
  color: #fff;
  text-decoration: none;
  outline: none;
}

/* Close button */
.kp-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  font-size: 20px;
  color: #999;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  transition: background 0.15s ease, color 0.15s ease;
}

.kp-close:hover {
  background: #f0f0f0;
  color: #333;
}

/* Plate displayed in card */
.kp-plate-display {
  display: inline-flex;
  align-items: center;
  border: 2px solid #003189;
  border-radius: 4px;
  overflow: hidden;
  height: 28px;
  margin-bottom: 10px;
  font-size: 13px;
}

.kp-plate-display-eu {
  background: #003189;
  color: #FFCC00;
  font-size: 8px;
  padding: 0 4px;
  height: 100%;
  display: flex;
  align-items: center;
  font-weight: 700;
}

.kp-plate-display-num {
  font-weight: 800;
  letter-spacing: 1.5px;
  padding: 0 8px;
  background: #fff;
  color: #1a1a2e;
  height: 100%;
  display: flex;
  align-items: center;
  text-transform: uppercase;
}

/* VIN displayed in card */
.kp-vin-display {
  display: inline-flex;
  align-items: center;
  border: 2px solid #1565c0;
  border-radius: 4px;
  overflow: hidden;
  height: 28px;
  margin-bottom: 10px;
  font-size: 12px;
}

.kp-vin-label {
  background: #1565c0;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  padding: 0 6px;
  height: 100%;
  display: flex;
  align-items: center;
  letter-spacing: 1px;
}

.kp-vin-num {
  font-weight: 700;
  letter-spacing: 0.8px;
  padding: 0 8px;
  background: #fff;
  color: #1a1a2e;
  height: 100%;
  display: flex;
  align-items: center;
  font-family: monospace;
  font-size: 11px;
}

/* --------------------------------------------------------------------------
   8. Error / Info messages
   -------------------------------------------------------------------------- */

.kp-message {
  margin-top: 10px;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  animation: kp-slide-down 0.25s ease forwards;
}

.kp-message-error {
  background: #fff0f0;
  border-left: 4px solid #E30613;
  color: #c00;
}

.kp-message-info {
  background: #e8f0fe;
  border-left: 4px solid #1a73e8;
  color: #1a73e8;
}

/* --------------------------------------------------------------------------
   9. Responsive – mobile first
   -------------------------------------------------------------------------- */

@media (max-width: 767px) {
  .kp-bar-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
  }

  .kp-label {
    width: 100%;
  }

  .kp-label-text {
    font-size: 12px;
  }

  .kp-form {
    width: 100%;
    max-width: 100%;
  }

  .kp-plate-input {
    width: 100%;
    min-width: 0;
  }

  .kp-mode-indicator {
    padding-left: 38px;
  }

  .kp-card {
    flex-direction: column;
    gap: 14px;
  }

  .kp-card-img-wrap {
    width: 100%;
    justify-content: flex-start;
  }

  .kp-car-image {
    max-width: 140px;
  }

  .kp-card-title {
    font-size: 18px;
  }

  .kp-brand-logo-wrap {
    position: absolute;
    top: 14px;
    right: 44px;
  }

  .kp-btn-search {
    padding: 0 14px;
    font-size: 14px;
  }
}

@media (max-width: 400px) {
  .kp-plate-input {
    font-size: 15px;
    letter-spacing: 1px;
  }

  .kp-card-title {
    font-size: 16px;
  }
}
