:root {
    --bg-gradient-1: #0f172a;
    --bg-gradient-2: #1e1b4b;
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --text-main: #f8fafc;
    --text-muted: #cbd5e1;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --bot-msg-bg: rgba(99, 102, 241, 0.15);
    --user-msg-bg: rgba(255, 255, 255, 0.08);
    --error-color: #ef4444;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-1) 0%, var(--bg-gradient-2) 100%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.screen {
    display: none;
    width: 100%;
    height: 100vh;
    justify-content: center;
    align-items: center;
    padding: 20px;
    animation: fadeIn 0.5s ease-out;
}

.screen.active {
    display: flex;
}

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

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--glass-shadow);
}

/* Login Screen */
.login-card {
    width: 100%;
    max-width: 420px;
    padding: 40px;
    text-align: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.login-card h2 {
    font-size: 1.8rem;
    margin-bottom: 12px;
}

.login-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 30px;
    line-height: 1.5;
}

.input-group {
    text-align: left;
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

input {
    width: 100%;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
    outline: none;
}

input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.error-msg {
    color: var(--error-color);
    font-size: 0.9rem;
    margin-bottom: 16px;
    min-height: 20px;
}

/* Chat Screen */
.chat-container {
    width: 100%;
    max-width: 900px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    padding: 20px 30px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.1);
}

.chat-header .logo {
    margin-bottom: 0;
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
}

.chat-history::-webkit-scrollbar {
    width: 6px;
}
.chat-history::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.message {
    display: flex;
    gap: 16px;
    max-width: 85%;
    animation: fadeIn 0.3s ease-out;
}

.bot-message {
    align-self: flex-start;
}

.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.msg-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 600;
    flex-shrink: 0;
}

.bot-message .msg-avatar {
    background: var(--primary-color);
    color: white;
}

.user-message .msg-avatar {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-main);
}

.msg-content {
    background: var(--bot-msg-bg);
    padding: 16px 20px;
    border-radius: 16px;
    line-height: 1.6;
    font-size: 0.95rem;
    white-space: pre-wrap;
}

.user-message .msg-content {
    background: var(--user-msg-bg);
    border-bottom-right-radius: 4px;
}

.bot-message .msg-content {
    border-bottom-left-radius: 4px;
}

.chat-input-area {
    padding: 20px 30px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    gap: 12px;
    background: rgba(0, 0, 0, 0.1);
}

.chat-input-area input {
    flex: 1;
}

.chat-input-area button {
    width: auto;
    padding: 0 24px;
}

/* Loader */
.loader {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

.hidden {
    display: none !important;
}

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

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

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

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

/* ==========================================
   PATIENT SHARE MODAL & BUTTON STYLES
   ========================================== */
.btn-share {
    padding: 8px 16px;
    background: linear-gradient(135deg, #059669 0%, #10B981 100%);
    color: white;
    border: 1px solid rgba(52, 211, 153, 0.4);
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-share:hover {
    background: linear-gradient(135deg, #047857 0%, #059669 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.3s ease-out;
}

.modal-card {
    width: 100%;
    max-width: 500px;
    padding: 28px;
    background: rgba(30, 27, 75, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.modal-header h3 {
    font-size: 1.3rem;
    color: #f8fafc;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.btn-icon:hover {
    color: #ef4444;
}

.modal-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 20px;
}

.form-select {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
}

.form-select option {
    background: #1e1b4b;
    color: #f8fafc;
}

.share-result {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--glass-border);
}

.share-result label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.share-url-container {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.share-url-container input {
    font-size: 0.85rem;
    color: #34d399;
}

.copy-success {
    color: #34d399;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.share-info-text {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ==========================================
   VOICE INPUT (WEB SPEECH API) STYLES
   ========================================== */
.btn-voice {
    width: 48px;
    min-width: 48px;
    height: 48px;
    padding: 0 !important;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1.25rem;
    outline: none;
}

.btn-voice:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.35);
    color: #ffffff;
    transform: translateY(-1px);
}

.btn-voice.recording {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    border-color: #f87171 !important;
    color: #ffffff !important;
    animation: pulseMic 1.5s infinite;
}

@keyframes pulseMic {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
        box-shadow: 0 0 0 12px rgba(239, 68, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.btn-voice.error {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    border-color: #fbbf24 !important;
    color: #ffffff !important;
}

.recording-focus {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25), 0 0 16px rgba(239, 68, 68, 0.2) !important;
}

.voice-status-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 30px 14px 30px;
    background: rgba(0, 0, 0, 0.1);
    font-size: 0.85rem;
    color: #fca5a5;
    animation: fadeIn 0.2s ease-in;
}

.voice-pulse-dot {
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    display: inline-block;
    animation: pulseDot 1s infinite alternate;
}

@keyframes pulseDot {
    0% { opacity: 0.4; transform: scale(0.8); }
    100% { opacity: 1; transform: scale(1.2); }
}

.voice-fallback-hint {
    padding: 6px 30px 14px 30px;
    font-size: 0.82rem;
    color: #94a3b8;
    line-height: 1.4;
    background: rgba(0, 0, 0, 0.1);
}


