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

:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-light: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

header h1 {
    font-size: 3rem;
    margin-bottom: 15px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.3rem;
    opacity: 0.95;
    margin-bottom: 5px;
}

.language-selector {
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.language-selector label {
    font-weight: 600;
    font-size: 1rem;
}

.language-selector select {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    background: white;
    color: var(--text-color);
    font-size: 1rem;
    cursor: pointer;
    font-weight: 500;
    box-shadow: var(--shadow);
}

.language-selector select:focus {
    outline: 2px solid #fbbf24;
}

.phase {
    display: none;
    padding: 40px;
}

.phase.active {
    display: block;
}

.phase-header {
    margin-bottom: 30px;
    text-align: center;
}

.phase-header h2 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 2.2rem;
    font-weight: 600;
}

.phase-header p {
    color: var(--text-light);
    font-size: 1.2rem;
}

.chat-container {
    background: var(--bg-color);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    min-height: 400px;
    max-height: 500px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.message {
    display: flex;
    gap: 12px;
    animation: fadeIn 0.3s ease-in;
}

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

.message.bot {
    justify-content: flex-start;
}

.message.user {
    justify-content: flex-end;
}

.message-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.message.bot .message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.message.user .message-avatar {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.message-content {
    max-width: 70%;
    padding: 16px 20px;
    border-radius: 12px;
    line-height: 1.7;
    font-size: 1.1rem;
}

.message.bot .message-content {
    background: white;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.message.user .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.input-section {
    margin-top: 20px;
}

.progress-indicator {
    text-align: center;
    margin-bottom: 20px;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-light);
}

.input-group {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

textarea {
    flex: 1;
    padding: 16px 20px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-family: inherit;
    font-size: 1.1rem;
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.3s;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-primary,
.btn-secondary {
    padding: 16px 32px;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    min-height: 56px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    margin-top: 15px;
    width: 100%;
}

.btn-secondary:hover {
    background: var(--bg-color);
}

.analysis-container {
    background: var(--bg-color);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 20px;
}

.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.result-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
}

.result-section {
    margin-bottom: 25px;
}

.result-section:last-child {
    margin-bottom: 0;
}

.result-section h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
}

.department-badge {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 32px;
    border-radius: 10px;
    font-size: 1.4rem;
    font-weight: 600;
}

.tests-list {
    list-style: none;
}

.tests-list li {
    background: var(--bg-color);
    padding: 16px 20px;
    margin-bottom: 12px;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    font-size: 1.1rem;
}

.action-buttons {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.action-buttons button {
    flex: 1;
    min-width: 200px;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 16px;
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.close {
    color: var(--text-light);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: var(--text-color);
}

.summary-section {
    margin-bottom: 25px;
    padding: 20px;
    background: var(--bg-color);
    border-radius: 12px;
}

.summary-section h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.qa-pair {
    margin-bottom: 15px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.qa-pair strong {
    display: block;
    margin-bottom: 5px;
    color: var(--primary-color);
}

/* Scroll to Bottom Button */
.scroll-to-bottom-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    z-index: 1000;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scroll-to-bottom-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.scroll-to-bottom-btn .arrow-down {
    font-size: 2rem;
    color: white;
    font-weight: bold;
    animation: bounce 1.5s infinite;
}

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

footer {
    background: var(--bg-color);
    padding: 25px 40px;
    border-top: 1px solid var(--border-color);
}

.disclaimer {
    color: var(--text-light);
    font-size: 1rem;
    line-height: 1.8;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .phase {
        padding: 20px;
    }

    .message-content {
        max-width: 85%;
    }

    .input-group {
        flex-direction: column;
    }

    .action-buttons {
        flex-direction: column;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 20px;
    }
}

/* Scrollbar Styling */
.chat-container::-webkit-scrollbar,
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.chat-container::-webkit-scrollbar-track,
.modal-content::-webkit-scrollbar-track {
    background: var(--border-color);
    border-radius: 10px;
}

.chat-container::-webkit-scrollbar-thumb,
.modal-content::-webkit-scrollbar-thumb {
    background: var(--text-light);
    border-radius: 10px;
}

.chat-container::-webkit-scrollbar-thumb:hover,
.modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-color);
}

/* Typing Indicator Animation */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 15px !important;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Small Spinner for Buttons */
.spinner-small {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    margin-bottom: 15px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
}

/* Pulse Animation for New Messages */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(102, 126, 234, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0);
    }
}

.message-content.new {
    animation: pulse 1s;
}

/* Smooth Transitions */
.btn-primary, .btn-secondary, textarea, .message {
    transition: all 0.3s ease;
}

/* Hover Effects */
.message:hover {
    transform: translateX(2px);
}

.result-card {
    animation: fadeIn 0.5s ease-in;
}

/* Urgency/Triage Styling */
.urgency-section {
    margin-bottom: 30px;
    padding: 25px;
    border-radius: 12px;
    border-left: 6px solid;
}

.urgency-section.emergency {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-color: #dc2626;
}

.urgency-section.high {
    background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
    border-color: #ea580c;
}

.urgency-section.medium {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-color: #f59e0b;
}

.urgency-section.low {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-color: #10b981;
}

.urgency-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 15px;
}

.urgency-badge.emergency {
    background: #dc2626;
    color: white;
    animation: pulse 2s infinite;
}

.urgency-badge.high {
    background: #ea580c;
    color: white;
}

.urgency-badge.medium {
    background: #f59e0b;
    color: white;
}

.urgency-badge.low {
    background: #10b981;
    color: white;
}

.care-recommendation {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    margin-top: 15px;
    font-size: 1rem;
}

.care-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.care-text {
    flex: 1;
}

.care-text strong {
    display: block;
    margin-bottom: 5px;
    font-size: 1.1rem;
}

.warning-box {
    background: #fef3c7;
    border: 2px solid #f59e0b;
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
}

.warning-box strong {
    color: #92400e;
    display: block;
    margin-bottom: 8px;
}

.warning-box ul {
    margin: 10px 0 0 20px;
    color: #92400e;
}

.warning-box ul li {
    margin-bottom: 5px;
}

/* Symptom Summary Card */
.symptom-summary-card {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px solid #0ea5e9;
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-lg);
    animation: slideDown 0.5s ease-out;
}

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

.summary-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.summary-header h3 {
    color: #0369a1;
    margin: 0;
    font-size: 1.3rem;
}

.summary-text {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    line-height: 1.6;
    color: var(--text-color);
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.symptom-tag {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.risk-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
}

.risk-indicator.low {
    background: #d1fae5;
    color: #065f46;
}

.risk-indicator.medium {
    background: #fef3c7;
    color: #92400e;
}

.risk-indicator.high {
    background: #fee2e2;
    color: #991b1b;
}

.risk-explanation {
    margin-top: 10px;
    padding: 12px;
    background: white;
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-light);
}

/* Reasoning Box */
.reasoning-box {
    margin-top: 20px;
    padding: 18px;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-left: 4px solid #f59e0b;
    border-radius: 8px;
    animation: fadeIn 0.5s ease-in;
}

.reasoning-box strong {
    display: block;
    color: #92400e;
    margin-bottom: 10px;
    font-size: 1rem;
}

.reasoning-box p {
    margin: 0;
    color: #78350f;
    line-height: 1.6;
    font-size: 0.95rem;
}
