/* ============================================================
   MediCare Pro — AI Assistant Styles (ChatGPT-Style)
   Full Kurdish + English AI Interface
   ============================================================ */

/* ===== AI FLOATING BUTTON ===== */
.ai-float-btn {
  position: fixed;
  bottom: 110px;
  right: 28px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 50%, #0ea5e9 100%);
  border: none;
  cursor: pointer;
  z-index: 8998;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(124, 58, 237, 0.45), 0 2px 8px rgba(0,0,0,0.2);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ai-float-btn:hover {
  transform: scale(1.12) translateY(-3px);
  box-shadow: 0 14px 40px rgba(124, 58, 237, 0.55), 0 4px 12px rgba(0,0,0,0.25);
}

.ai-float-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  position: relative;
  z-index: 2;
}

.ai-float-inner i {
  font-size: 1.4rem;
  color: white;
}

.ai-float-label {
  font-size: 0.55rem;
  font-weight: 800;
  color: rgba(255,255,255,0.9);
  letter-spacing: 1px;
  font-family: 'Inter', sans-serif;
}

.ai-float-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(124, 58, 237, 0.4);
  animation: ai-ring-pulse 2s ease-out infinite;
}

.ai-float-ring-2 {
  inset: -12px;
  animation-delay: 0.7s;
  opacity: 0.5;
}

@keyframes ai-ring-pulse {
  0% { transform: scale(0.9); opacity: 0.8; }
  100% { transform: scale(1.3); opacity: 0; }
}

/* ===== AI OVERLAY ===== */
.ai-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 8999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  backdrop-filter: blur(4px);
}

.ai-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* ===== AI PANEL ===== */
.ai-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(520px, 100vw);
  height: 100vh;
  height: 100dvh;
  background: #0f0f13;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  border-left: 1px solid rgba(255,255,255,0.06);
  overflow: hidden;
}

.ai-panel.active {
  transform: translateX(0);
}

/* ===== AI HEADER ===== */
.ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
  gap: 12px;
}

.ai-header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.ai-logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #7c3aed, #4f46e5, #0ea5e9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: white;
  position: relative;
  flex-shrink: 0;
  box-shadow: 0 0 20px rgba(124,58,237,0.4);
}

.ai-logo-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 18px;
  border: 2px solid rgba(124, 58, 237, 0.3);
  animation: ai-ring-pulse 2.5s ease-out infinite;
}

.ai-header-info h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
  font-family: 'Inter', sans-serif;
}

.ai-header-info h3 span {
  background: linear-gradient(90deg, #a78bfa, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.ai-header-info p {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.45);
  margin: 2px 0 0;
  font-family: 'Inter', sans-serif;
}

.ai-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.ai-lang-btn {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.55);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.ai-lang-btn.active {
  background: linear-gradient(135deg, rgba(124,58,237,0.3), rgba(79,70,229,0.3));
  border-color: rgba(124,58,237,0.5);
  color: #a78bfa;
}

.ai-lang-btn:hover {
  border-color: rgba(124,58,237,0.4);
  color: rgba(255,255,255,0.8);
}

.ai-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.4);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.ai-icon-btn:hover {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.8);
  border-color: rgba(255,255,255,0.15);
}

/* ===== AI MESSAGES ===== */
.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scroll-behavior: smooth;
}

.ai-messages::-webkit-scrollbar {
  width: 4px;
}

.ai-messages::-webkit-scrollbar-track {
  background: transparent;
}

.ai-messages::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
}

/* ===== WELCOME SCREEN ===== */
.ai-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px 0 10px;
  animation: ai-fade-up 0.5s ease;
}

.ai-welcome-icon {
  width: 72px;
  height: 72px;
  border-radius: 24px;
  background: linear-gradient(135deg, #7c3aed, #4f46e5, #0ea5e9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: white;
  margin-bottom: 20px;
  box-shadow: 0 0 40px rgba(124,58,237,0.4);
  animation: ai-icon-float 3s ease-in-out infinite;
}

@keyframes ai-icon-float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}

.ai-welcome h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 10px;
  font-family: 'Inter', sans-serif;
}

.ai-welcome p {
  font-size: 0.88rem;
  color: rgba(255,255,255,0.5);
  line-height: 1.7;
  margin: 0 0 28px;
  font-family: 'Inter', sans-serif;
  max-width: 340px;
}

/* ===== AI SUGGESTION GRID ===== */
.ai-suggestion-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  max-width: 400px;
}

.ai-suggestion {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.7);
  font-size: 0.82rem;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  text-align: left;
  transition: all 0.25s ease;
}

.ai-suggestion i {
  font-size: 1.1rem;
  background: linear-gradient(135deg, #a78bfa, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  flex-shrink: 0;
}

.ai-suggestion:hover {
  background: rgba(124,58,237,0.12);
  border-color: rgba(124,58,237,0.3);
  color: #fff;
  transform: translateY(-2px);
}

/* ===== AI MESSAGE BUBBLES ===== */
.ai-msg {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  animation: ai-fade-up 0.35s ease;
}

.ai-msg.user {
  flex-direction: row-reverse;
}

.ai-msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.ai-msg.bot .ai-msg-avatar {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: white;
}

.ai-msg.user .ai-msg-avatar {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: white;
}

.ai-msg-content {
  flex: 1;
  max-width: 88%;
}

.ai-msg.user .ai-msg-content {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.ai-bubble {
  padding: 14px 18px;
  border-radius: 18px;
  font-size: 0.9rem;
  line-height: 1.75;
  font-family: 'Inter', sans-serif;
  white-space: pre-wrap;
}

.ai-msg.bot .ai-bubble {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.9);
  border-bottom-left-radius: 6px;
}

.ai-msg.user .ai-bubble {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff;
  border-bottom-right-radius: 6px;
}

.ai-bubble strong {
  color: #a78bfa;
  display: block;
  margin-bottom: 4px;
}

.ai-bubble .ai-highlight {
  background: rgba(124,58,237,0.2);
  border: 1px solid rgba(124,58,237,0.3);
  border-radius: 8px;
  padding: 10px 14px;
  margin-top: 10px;
  font-size: 0.85rem;
}

.ai-bubble .ai-tag {
  display: inline-block;
  background: linear-gradient(135deg, rgba(124,58,237,0.3), rgba(14,165,233,0.3));
  border: 1px solid rgba(124,58,237,0.4);
  color: #a78bfa;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.ai-bubble .ai-phone {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.3);
  color: #fca5a5;
  font-weight: 700;
  font-size: 1rem;
  padding: 8px 14px;
  border-radius: 10px;
  margin-top: 8px;
  text-decoration: none;
  transition: all 0.2s;
}

.ai-bubble .ai-phone:hover {
  background: rgba(239,68,68,0.25);
  color: #fff;
}

.ai-bubble .ai-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 18px;
  border-radius: 10px;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: white;
  font-size: 0.82rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s;
}

.ai-bubble .ai-action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(124,58,237,0.4);
}

.ai-bubble ul {
  padding-left: 20px;
  margin: 8px 0 0;
}

.ai-bubble ul li {
  margin-bottom: 6px;
  color: rgba(255,255,255,0.8);
}

.ai-meta {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.25);
  margin-top: 6px;
  font-family: 'Inter', sans-serif;
}

.ai-msg.user .ai-meta {
  text-align: right;
}

/* ===== TYPING INDICATOR ===== */
.ai-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 18px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  border-bottom-left-radius: 6px;
  width: fit-content;
}

.ai-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a78bfa;
  animation: ai-typing-bounce 1.2s ease-in-out infinite;
}

.ai-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.ai-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes ai-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ===== STREAMING CURSOR ===== */
.ai-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: #a78bfa;
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: ai-cursor-blink 0.7s step-end infinite;
}

@keyframes ai-cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ===== AI INPUT AREA ===== */
.ai-input-area {
  padding: 16px 20px 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
  flex-shrink: 0;
}

.ai-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 12px 14px;
  transition: border-color 0.2s;
}

.ai-input-wrap:focus-within {
  border-color: rgba(124,58,237,0.5);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.1);
}

.ai-input-wrap textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: rgba(255,255,255,0.9);
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  resize: none;
  max-height: 160px;
  line-height: 1.6;
  overflow-y: auto;
}

.ai-input-wrap textarea::placeholder {
  color: rgba(255,255,255,0.28);
}

.ai-input-wrap textarea::-webkit-scrollbar {
  width: 0;
}

.ai-input-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ai-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  border: none;
  color: white;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(124,58,237,0.3);
}

.ai-send-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(124,58,237,0.45);
}

.ai-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.ai-disclaimer {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.2);
  text-align: center;
  margin: 10px 0 0;
  font-family: 'Inter', sans-serif;
}

.ai-disclaimer a {
  color: rgba(167,139,250,0.6);
  text-decoration: none;
}

.ai-disclaimer a:hover {
  color: #a78bfa;
}

/* ===== DIVIDER (Date/Time) ===== */
.ai-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.2);
  font-family: 'Inter', sans-serif;
}

.ai-divider::before,
.ai-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.07);
}

/* ===== ANIMATIONS ===== */
@keyframes ai-fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== KURDISH RTL SUPPORT ===== */
.ai-panel[dir="rtl"] .ai-bubble {
  font-family: 'Segoe UI', 'Cairo', sans-serif;
}

.ai-panel[dir="rtl"] .ai-msg.bot {
  flex-direction: row-reverse;
}

.ai-panel[dir="rtl"] .ai-msg.user {
  flex-direction: row;
}

.ai-panel[dir="rtl"] .ai-msg.bot .ai-bubble {
  border-bottom-right-radius: 6px;
  border-bottom-left-radius: 18px;
}

.ai-panel[dir="rtl"] .ai-msg.user .ai-bubble {
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 18px;
}

.ai-panel[dir="rtl"] .ai-msg.user .ai-msg-content {
  align-items: flex-start;
}

.ai-panel[dir="rtl"] .ai-msg.user .ai-meta {
  text-align: left;
}

.ai-panel[dir="rtl"] .ai-input-wrap textarea {
  text-align: right;
  direction: rtl;
}

.ai-panel[dir="rtl"] .ai-suggestion {
  flex-direction: row-reverse;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .ai-panel {
    width: 100vw;
  }

  .ai-float-btn {
    bottom: 100px;
    right: 18px;
    width: 56px;
    height: 56px;
  }

  .ai-suggestion-grid {
    grid-template-columns: 1fr;
  }

  .ai-lang-btn {
    font-size: 0.65rem;
    padding: 5px 8px;
  }
}
