:root {
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --accent: #10b981;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --bot-msg-bg: #1e293b;
    --user-msg-bg: #3b82f6;
    --glass-bg: rgba(30, 41, 59, 0.7);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background: linear-gradient(135deg, var(--bg-dark), #000000);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

.app-wrapper {
    width: 100%;
    max-width: 480px;
    height: 100vh;
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .app-wrapper {
        height: 90vh;
        max-height: 800px;
    }
}

.app-container {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Header */
.app-header {
    display: flex;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.8);
}

.header-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    margin-right: 1rem;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}

.header-text h1 {
    font-size: 1.1rem;
    font-weight: 600;
}

.header-text p {
    font-size: 0.8rem;
    color: var(--accent);
    margin-top: 0.2rem;
}

.header-actions {
    margin-left: auto;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    transition: color 0.2s;
    padding: 0.5rem;
}

.icon-btn:hover {
    color: var(--text-main);
}

/* Chat Container */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.chat-container::-webkit-scrollbar {
    width: 6px;
}
.chat-container::-webkit-scrollbar-thumb {
    background-color: var(--border);
    border-radius: 10px;
}

/* Messages */
.message-wrapper {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: fadeIn 0.4s ease-out forwards;
    opacity: 0;
    transform: translateY(10px);
}

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

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

.message-wrapper.user {
    align-self: flex-end;
    align-items: flex-end;
}

.message-content {
    padding: 1rem 1.25rem;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
}

.bot .message-content {
    background: var(--bot-msg-bg);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

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

.message-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.message-body ul {
    padding-left: 1.2rem;
    margin: 0.5rem 0;
}

.message-body li {
    margin-bottom: 0.3rem;
}

/* Options / Buttons */
.options-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
    width: 100%;
}

.options-row {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.option-btn {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid var(--primary);
    color: var(--text-main);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.option-btn:hover {
    background: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.option-btn.secondary {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border);
}

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

.option-btn.full-width {
    width: 100%;
    justify-content: center;
}

.option-btn.flex-1 {
    flex: 1;
    justify-content: center;
}

/* Special Cards (Quiz/Alert) */
.card {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 1rem;
    margin-top: 0.75rem;
    border-left: 4px solid var(--primary);
}

.card.alert {
    border-left-color: #f59e0b;
}

.card.success {
    border-left-color: var(--accent);
}

.card-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Progress Indicator */
.progress-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.progress-bar {
    height: 4px;
    flex: 1;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    transition: width 0.3s ease;
}

/* Footer & Input */
.app-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.8);
    position: relative;
}

.input-area {
    display: flex;
    gap: 0.5rem;
}

.input-area input {
    flex: 1;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.input-area input:focus {
    border-color: var(--primary);
}

.input-area button {
    background: var(--primary);
    color: white;
    border: none;
    width: 45px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
}

.input-area button:hover {
    background: var(--primary-hover);
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 0.5rem 1rem;
    background: var(--bot-msg-bg);
    border: 1px solid var(--border);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    margin-bottom: 1rem;
}

.typing-indicator.active {
    display: flex;
}

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

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

@keyframes blink {
    0% { opacity: 0.2; transform: scale(0.8); }
    20% { opacity: 1; transform: scale(1.2); }
    100% { opacity: 0.2; transform: scale(0.8); }
}
