/* =========================================
   CAR AGENT AI - PREMIUM CHAT DESIGN
   ========================================= */

#ca-ai-root {
  width: 100%;
  max-width: 1050px;
  margin: 20px auto;
  direction: rtl;
  font-family: Vazirmatn, Tahoma, Arial, sans-serif;
  color: #242424;
  box-sizing: border-box;
}

#ca-ai-root * {
  box-sizing: border-box;
}

/* BANNER */

#ca-ai-root .ca-banner {
  width: 100%;
  overflow: hidden;
  border: 3px solid #D4AF37;
  border-radius: 17px;
  background: #101725;
  box-shadow: 0 5px 18px rgba(157,117,24,.22);
  margin-bottom: 15px;
  line-height: 0;
}

#ca-ai-root .ca-banner img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* MAIN GOLD FRAME */

#ca-ai-root .ca-chat-frame {
  width: 100%;
  overflow: hidden;
  background: #FFFFFF;
  border: 4px solid #D4AF37;
  border-radius: 19px;
  outline: 1px solid #EAD9A8;
  outline-offset: 3px;
  box-shadow:
    0 8px 26px rgba(139,103,20,.15),
    0 2px 8px rgba(0,0,0,.05);
}

/* CHAT HEADER */

#ca-ai-root .ca-chat-top {
  min-height: 66px;
  padding: 12px 18px;
  background: linear-gradient(115deg,#101827,#202B3B);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #FFFFFF;
  border-bottom: 2px solid #D4AF37;
}

#ca-ai-root .ca-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.4;
}

#ca-ai-root .ca-brand-short {
  color: #E7C65F;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 1px;
}

#ca-ai-root .ca-brand-full {
  color: #E6E6E6;
  font-size: 10px;
}

#ca-ai-root .ca-online {
  font-size: 10px;
  color: #E8D9AF;
  display: flex;
  align-items: center;
  gap: 6px;
}

#ca-ai-root .ca-online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #27C77A;
  box-shadow: 0 0 7px rgba(39,199,122,.7);
}

/* SUBSCRIPTION */

#ca-ai-root .ca-subscription {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 12px;
  background: rgba(225, 230, 237, 0.58);
  border-bottom: 1px solid rgba(190, 198, 210, 0.65);
  color: #626C79;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

#ca-ai-root .ca-subscription.ca-active {
  color: #177A50;
  background: #F0FAF4;
  border-color: #C7EAD5;
}

/* ACCESS CODE */

#ca-ai-root .ca-access {
  margin: 12px 14px;
  border: 1px solid #E4D4AA;
  border-radius: 10px;
  background: #FFFCF5;
}

#ca-ai-root .ca-access summary {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 14px;
  min-height: 42px;
  color: #F1D98A;
  background: linear-gradient(135deg, #20583C, #123B29);
  border: 1px solid #68B985;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
  transition: all .25s ease;
  list-style: none;
}

#ca-ai-root .ca-access summary::-webkit-details-marker {
  display: none;
}

#ca-ai-root .ca-access summary:hover {
  background: linear-gradient(135deg, #286D49, #174A32);
  border-color: #91D5A8;
}

#ca-ai-root .ca-access-content {
  padding: 10px;
  border-top: 1px solid #EFE5CD;
}

#ca-ai-root .ca-access input {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 11px;
  border: 1px solid #DCCB9D;
  border-radius: 8px;
  background: #FFFFFF;
  color: #222222;
  font-family: inherit;
  font-size: 12px;
  direction: ltr;
  text-align: left;
}

#ca-ai-root .ca-access button {
  margin-top: 8px;
  padding: 9px 16px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg,#D4AF37,#A87914);
  color: #17130A;
  font-family: inherit;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

#ca-ai-root .access-status {
  margin-top: 8px;
  font-size: 11px;
}

#ca-ai-root .access-status.success {
  color: #16864F;
}

#ca-ai-root .access-status.error {
  color: #D43E3E;
}

/* CHAT BODY */

#ca-ai-root .ca-chat-body {
  padding: 17px 15px;
  background: #FFFFFF;
  min-height: 230px;
}

#ca-ai-root .ca-welcome-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 18px;
}

#ca-ai-root .ca-bot-avatar {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid #D4AF37;
  background: rgba(225, 230, 237, 0.58);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

#ca-ai-root .ca-bot-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

#ca-ai-root .ca-welcome-card {
  flex: 1;
  min-width: 0;
  padding: 13px 15px;
  border: 1px solid #E5D7B6;
  border-right: 3px solid #B8860B;
  border-radius: 12px;
  background: #FFFFFF;
  box-shadow: 0 3px 10px rgba(0,0,0,.045);
  font-size: 12px;
  line-height: 2;
  color: #333333;
  overflow-wrap: anywhere;
}

#ca-ai-root .ca-message-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding-bottom: 7px;
  margin-bottom: 8px;
  border-bottom: 1px solid #F0E8D7;
}

#ca-ai-root .ca-message-heading strong {
  font-size: 13px;
  color: #9A711A;
}

#ca-ai-root .ca-message-heading span {
  font-size: 9px;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(225, 230, 237, 0.58);
  color: #626C79;
  direction: ltr;
}

#ca-ai-root .ca-welcome-card p {
  margin: 7px 0;
}

#ca-ai-root .ca-welcome-end {
  margin-top: 10px;
  padding: 8px 10px;
  background: rgba(225, 230, 237, 0.58);
  border: 1px solid rgba(190, 198, 210, 0.55);
  border-radius: 8px;
  color: #626C79;
  font-weight: 800;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* USER MESSAGE */

#ca-ai-root .ca-user-row {
  display: flex;
  justify-content: flex-start;
  margin: 12px 0;
}

#ca-ai-root .ca-user-message {
  max-width: 83%;
  padding: 10px 14px;
  border-radius: 12px 12px 3px 12px;
  background: #172235;
  border: 1px solid #C5A34A;
  color: #FFFFFF;
  font-size: 12px;
  line-height: 1.9;
  overflow-wrap: anywhere;
}

/* AI RESPONSE */

#ca-ai-root .ca-ai-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 13px 0;
}

#ca-ai-root .ca-ai-message {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid #E4D6B5;
  border-right: 3px solid #B8860B;
  border-radius: 11px;
  background: #FFFFFF;
  box-shadow: 0 3px 9px rgba(0,0,0,.04);
  color: #303030;
  font-size: 12px;
  line-height: 2;
  overflow-wrap: anywhere;
}

#ca-ai-root .ca-ai-message p {
  margin: 6px 0;
}

#ca-ai-root .ca-ai-message table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 11px;
}

#ca-ai-root .ca-ai-message th,
#ca-ai-root .ca-ai-message td {
  border: 1px solid #E7DAB9;
  padding: 7px;
  text-align: right;
}

#ca-ai-root .ca-ai-message th {
  background: rgba(218, 225, 234, 0.72);
  color: #626C79;
  border-color: rgba(190, 198, 210, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

#ca-ai-root .ca-ai-message ul,
#ca-ai-root .ca-ai-message ol {
  padding-right: 20px;
}

#ca-ai-root .ca-ai-message a {
  color: #9B7218;
  overflow-wrap: anywhere;
}

/* SUGGESTIONS */

#ca-ai-root .ca-suggestions {
  padding: 0 15px 15px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

#ca-ai-root .ca-suggestions-title {
  width: 100%;
  color: #8C7442;
  font-size: 10px;
  font-weight: 700;
  margin-bottom: 2px;
}

#ca-ai-root .ca-suggestions button {
  border: 1px solid rgba(190, 198, 210, 0.7);
  background: rgba(225, 230, 237, 0.58);
  color: #626C79;
  border-radius: 20px;
  padding: 7px 11px;
  font-family: inherit;
  font-size: 10px;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

#ca-ai-root .ca-suggestions button:hover {
  background: rgba(205, 214, 226, 0.78);
}

/* COMPOSER */

#ca-ai-root .ca-composer {
  margin: 0 13px 13px;
  padding: 10px;
  background: #FFFFFF;
  border: 1px solid #D9C38A;
  border-radius: 13px;
  box-shadow: 0 2px 9px rgba(155,119,31,.08);
}

#ca-ai-root .ca-composer textarea {
  width: 100%;
  min-height: 52px;
  max-height: 150px;
  resize: vertical;
  border: 0;
  outline: none;
  background: transparent;
  color: #242424;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.9;
}

#ca-ai-root .ca-composer textarea::placeholder {
  color: #999999;
}

#ca-ai-root .ca-composer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 7px;
  border-top: 1px solid #F0E8D7;
}

#ca-ai-root .ca-composer-bottom > span {
  color: #9A8455;
  font-size: 9px;
}

#ca-ai-root #ca-send-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg,#DCC16B,#A87914);
  color: #201909;
  font-family: inherit;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

#ca-ai-root #ca-send-button:disabled {
  opacity: .55;
  cursor: wait;
}

#ca-ai-root #ca-send-button b {
  font-size: 15px;
}

/* TYPING */

#ca-ai-root .ca-typing {
  align-items: center;
  gap: 5px;
  padding: 9px 12px;
  color: #9A711A;
  font-size: 10px;
}

#ca-ai-root .ca-typing:not([hidden]) {
  display: flex;
}

#ca-ai-root .ca-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #B8860B;
  animation: caTyping 1s infinite ease-in-out;
}

#ca-ai-root .ca-typing span:nth-child(2) {
  animation-delay: .15s;
}

#ca-ai-root .ca-typing span:nth-child(3) {
  animation-delay: .3s;
}

#ca-ai-root .ca-typing small {
  margin-right: 5px;
}

@keyframes caTyping {
  0%, 60%, 100% { opacity: .35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

/* FOOTER */

#ca-ai-root .ca-chat-footer {
  padding: 9px;
  text-align: center;
  background: rgba(225, 230, 237, 0.58);
  border-top: 1px solid rgba(190, 198, 210, 0.65);
  color: #626C79;
  font-size: 9px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* HIDDEN COMPATIBILITY ELEMENTS */

#ca-ai-root #aiLoading,
#ca-ai-root #aiResponse {
  display: none !important;
}

/* MOBILE */

@media (max-width: 600px) {
  #ca-ai-root {
    margin: 12px auto;
  }

  #ca-ai-root .ca-banner {
    border-width: 2px;
    border-radius: 12px;
    margin-bottom: 12px;
  }

  #ca-ai-root .ca-chat-frame {
    border-width: 3px;
    border-radius: 14px;
  }

  #ca-ai-root .ca-chat-top {
    min-height: 56px;
    padding: 9px 12px;
  }

  #ca-ai-root .ca-chat-body {
    padding: 12px 9px;
  }

  #ca-ai-root .ca-welcome-row {
    gap: 7px;
  }

  #ca-ai-root .ca-bot-avatar {
    flex-basis: 30px;
    width: 30px;
    height: 30px;
    font-size: 17px;
  }

  #ca-ai-root .ca-welcome-card,
  #ca-ai-root .ca-ai-message {
    font-size: 11px;
    padding: 10px;
  }

  #ca-ai-root .ca-user-message {
    max-width: 90%;
    font-size: 11px;
  }

  #ca-ai-root .ca-suggestions {
    padding-left: 9px;
    padding-right: 9px;
  }

  #ca-ai-root .ca-composer {
    margin-left: 8px;
    margin-right: 8px;
  }
}


#ca-ai-root .ca-purchase {
  margin: 12px 14px;
  padding: 13px;
  text-align: center;
  border: 1px solid #E2D0A1;
  border-radius: 11px;
  background: #FFFCF5;
}

#ca-ai-root .ca-purchase strong {
  color: #95701D;
  font-size: 12px;
}

#ca-ai-root .ca-purchase p {
  color: #666;
  font-size: 11px;
  line-height: 1.9;
}

#ca-ai-root .ca-purchase a {
  display: block;
  padding: 10px;
  background: linear-gradient(135deg,#D4AF37,#A87914);
  color: #17130A !important;
  border-radius: 8px;
  text-decoration: none !important;
  font-size: 11px;
  font-weight: 800;
}


