/* ===== BASE ===== */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    overscroll-behavior: none;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes slideOutLeft {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(-60px); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(60px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes msgIn {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes blobMove1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -50px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.9); }
}

@keyframes blobMove2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-40px, 30px) scale(1.15); }
    66% { transform: translate(25px, -25px) scale(0.85); }
}

@keyframes blobMove3 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(20px, 40px) scale(0.95); }
    66% { transform: translate(-30px, -20px) scale(1.05); }
}

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes chipIn {
    from { opacity: 0; transform: translateY(8px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.animate-fade-in { animation: fadeIn 0.8s ease-out; }
.animate-float { animation: float 3s ease-in-out infinite; }
.slide-out-left { animation: slideOutLeft 0.4s ease-in forwards; }
.slide-in-right { animation: slideInRight 0.4s ease-out; }
.animate-msg-in { animation: msgIn 0.35s ease-out; }

/* ===== BACKGROUND BLOBS ===== */
.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    pointer-events: none;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, #fecdd3, #fda4af);
    top: -10%;
    right: -10%;
    animation: blobMove1 20s ease-in-out infinite;
}

.blob-2 {
    width: 350px;
    height: 350px;
    background: linear-gradient(135deg, #e0c3fc, #8ec5fc);
    bottom: -5%;
    left: -10%;
    animation: blobMove2 25s ease-in-out infinite;
}

.blob-3 {
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    top: 40%;
    left: 50%;
    animation: blobMove3 22s ease-in-out infinite;
}

/* ===== CONCERN CARDS ===== */
.concern-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(244, 63, 94, 0.1);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.concern-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(244, 63, 94, 0.15);
    border-color: rgba(244, 63, 94, 0.3);
    background: rgba(255, 255, 255, 0.9);
}

.concern-card:active {
    transform: translateY(-2px) scale(0.98);
}

.concern-icon {
    font-size: 28px;
    line-height: 1;
}

.concern-label {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
}

/* ===== GLASS HEADER ===== */
.glass-header {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(244, 63, 94, 0.08);
}

/* ===== CHAT BUBBLES ===== */
.user-bubble {
    background: linear-gradient(135deg, #f43f5e, #e11d48);
    color: white;
    padding: 12px 18px;
    border-radius: 20px 20px 4px 20px;
    box-shadow: 0 4px 15px rgba(244, 63, 94, 0.25);
    word-break: break-word;
}

.bot-bubble {
    background: white;
    color: #1f2937;
    padding: 14px 18px;
    border-radius: 20px 20px 20px 4px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(244, 63, 94, 0.08);
    word-break: break-word;
    min-width: 60px;
}

/* ===== PROSE / MARKDOWN CONTENT ===== */
.prose-content {
    font-size: 14px;
    line-height: 1.65;
}

.prose-content h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 20px 0 10px;
    color: #1f2937;
    padding-bottom: 6px;
    border-bottom: 2px solid #fecdd3;
}

.prose-content h3 {
    font-size: 15px;
    font-weight: 600;
    margin: 16px 0 8px;
    color: #374151;
}

.prose-content p {
    margin: 8px 0;
}

.prose-content strong {
    font-weight: 600;
    color: #111827;
}

.prose-content em {
    color: #6b7280;
    font-style: italic;
}

.prose-content ul, .prose-content ol {
    margin: 8px 0;
    padding-left: 20px;
}

.prose-content li {
    margin: 4px 0;
}

.prose-content table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 12px 0;
    font-size: 13px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.06);
}

.prose-content thead {
    background: linear-gradient(135deg, #fff1f2, #fce7f3);
}

.prose-content th {
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: #9f1239;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #fecdd3;
}

.prose-content td {
    padding: 10px 14px;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
}

.prose-content tr:last-child td {
    border-bottom: none;
}

.prose-content tr:hover td {
    background: #fef7f7;
}

.prose-content tbody tr:nth-child(even) td {
    background: #fafafa;
}

.prose-content a {
    color: #e11d48;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.2s;
}

.prose-content a:hover {
    color: #be123c;
}

.prose-content hr {
    border: none;
    height: 1px;
    background: linear-gradient(to right, transparent, #fecdd3, transparent);
    margin: 20px 0;
}

.prose-content code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: #e11d48;
}

.prose-content blockquote {
    border-left: 3px solid #f43f5e;
    padding: 8px 14px;
    margin: 10px 0;
    background: #fff1f2;
    border-radius: 0 8px 8px 0;
    color: #4b5563;
}

/* ===== TYPING INDICATOR ===== */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f43f5e, #e11d48);
    animation: bounce 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.16s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.32s;
}

/* ===== QUICK REPLY CHIPS ===== */
.quick-chip {
    flex-shrink: 0;
    padding: 8px 16px;
    border-radius: 20px;
    background: white;
    border: 1px solid #fecdd3;
    color: #e11d48;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    animation: chipIn 0.3s ease-out backwards;
}

.quick-chip:nth-child(2) { animation-delay: 0.05s; }
.quick-chip:nth-child(3) { animation-delay: 0.1s; }
.quick-chip:nth-child(4) { animation-delay: 0.15s; }

.quick-chip:hover {
    background: linear-gradient(135deg, #fff1f2, #fce7f3);
    border-color: #f43f5e;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.15);
}

.quick-chip:active {
    transform: translateY(0) scale(0.97);
}

/* ===== SCROLLBAR ===== */
#messages-container::-webkit-scrollbar {
    width: 5px;
}

#messages-container::-webkit-scrollbar-track {
    background: transparent;
}

#messages-container::-webkit-scrollbar-thumb {
    background: #e5e7eb;
    border-radius: 10px;
}

#messages-container::-webkit-scrollbar-thumb:hover {
    background: #d1d5db;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ===== DARK MODE ===== */
body.dark-mode {
    background: linear-gradient(135deg, #1a1a2e, #16213e, #0f0f23);
}

body.dark-mode .glass-header {
    background: rgba(26, 26, 46, 0.85);
    border-bottom-color: rgba(244, 63, 94, 0.15);
}

body.dark-mode .glass-header h2 { color: #f9fafb; }
body.dark-mode .glass-header p { color: #9ca3af; }
body.dark-mode .glass-header button { background: rgba(255,255,255,0.1); }
body.dark-mode .glass-header button svg { color: #e5e7eb; }

body.dark-mode .bot-bubble {
    background: #1e1e3a;
    color: #e5e7eb;
    border-color: rgba(244, 63, 94, 0.15);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

body.dark-mode .bot-bubble h2,
body.dark-mode .bot-bubble h3,
body.dark-mode .bot-bubble strong { color: #f9fafb; }
body.dark-mode .bot-bubble td { color: #d1d5db; border-bottom-color: #2d2d50; }
body.dark-mode .bot-bubble tr:hover td { background: rgba(244, 63, 94, 0.05); }
body.dark-mode .bot-bubble tbody tr:nth-child(even) td { background: rgba(255,255,255,0.03); }
body.dark-mode .bot-bubble thead { background: linear-gradient(135deg, #2d1f3d, #1e1e3a); }
body.dark-mode .bot-bubble th { color: #f9a8d4; border-bottom-color: #4a2040; }
body.dark-mode .bot-bubble em { color: #9ca3af; }
body.dark-mode .bot-bubble code { background: #2d2d50; color: #f9a8d4; }
body.dark-mode .bot-bubble blockquote { background: rgba(244, 63, 94, 0.08); color: #d1d5db; }

body.dark-mode .user-bubble {
    box-shadow: 0 4px 15px rgba(244, 63, 94, 0.35);
}

body.dark-mode .quick-chip {
    background: #1e1e3a;
    border-color: rgba(244, 63, 94, 0.3);
    color: #f9a8d4;
}

body.dark-mode .quick-chip:hover {
    background: rgba(244, 63, 94, 0.1);
    border-color: #f43f5e;
}

body.dark-mode #chat-input,
body.dark-mode textarea {
    background: #1e1e3a;
    border-color: #2d2d50;
    color: #f9fafb;
}

body.dark-mode #chat-input::placeholder { color: #6b7280; }

body.dark-mode .sticky.bottom-0 {
    background: linear-gradient(to top, #1a1a2e, #1a1a2eee, transparent);
}

body.dark-mode #image-preview > div {
    background: rgba(30, 30, 58, 0.9);
    border-color: rgba(244, 63, 94, 0.2);
}

body.dark-mode #image-preview p { color: #d1d5db; }

body.dark-mode #scroll-btn {
    background: #1e1e3a;
    border-color: #2d2d50;
}
body.dark-mode #scroll-btn svg { color: #9ca3af; }

body.dark-mode label.flex-shrink-0 {
    background: #1e1e3a;
    border-color: #2d2d50;
}
body.dark-mode label.flex-shrink-0:hover {
    border-color: rgba(244, 63, 94, 0.4);
    background: rgba(244, 63, 94, 0.08);
}
body.dark-mode label.flex-shrink-0 svg { color: #9ca3af; }

body.dark-mode .text-center.text-xs { color: #6b7280; }

/* ===== MOBILE ===== */
@media (max-width: 640px) {
    .concern-card {
        padding: 12px 8px;
    }

    .concern-icon {
        font-size: 24px;
    }

    .concern-label {
        font-size: 12px;
    }

    .prose-content {
        font-size: 13px;
    }

    .prose-content table {
        font-size: 11px;
    }

    .prose-content th,
    .prose-content td {
        padding: 7px 8px;
    }

    h1 {
        font-size: 2rem !important;
    }
}

/* ===== INPUT FOCUS ===== */
textarea:focus {
    outline: none;
}

/* ===== SMOOTH TRANSITIONS ===== */
.transition-all {
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}
