@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-light: #f8fafc;
    --bg-gradient: radial-gradient(circle at top left, rgba(219, 234, 254, 0.8), transparent 40%),
                   radial-gradient(circle at bottom right, rgba(253, 230, 138, 0.6), transparent 40%);
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-border: rgba(255, 255, 255, 0.5);
    --card-hover-border: rgba(99, 102, 241, 0.3);
    
    --text-main: #0f172a;
    --text-muted: #64748b;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-gradient: linear-gradient(135deg, #4f46e5, #ea580c);
    
    --chat-user: linear-gradient(135deg, #6366f1, #8b5cf6);
    --chat-user-text: #ffffff;
    --chat-bot: rgba(255, 255, 255, 0.9);
    --success: #10b981;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-light);
    background-image: var(--bg-gradient);
    color: var(--text-main);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.1); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.2); }

#app-container {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

/* Header & Nav */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: transparent;
    z-index: 10;
}

.logo {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#nav-menu {
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.6);
    padding: 0.4rem;
    border-radius: 100px;
    border: 1px solid var(--card-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.5rem 1.2rem;
    border-radius: 100px;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

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

.nav-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    font-weight: 600;
}

/* Views */
main {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    padding: 0 2rem;
}

.view {
    display: none;
    animation: fadeScale 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    padding-bottom: 2rem;
}

.view.active { display: block; }

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

/* Typography */
h1 { font-size: 3.5rem; font-weight: 700; letter-spacing: -1px; line-height: 1.1; margin-bottom: 1rem; color: #1e293b; }
h2 { font-size: 1.8rem; font-weight: 600; margin-bottom: 2rem; letter-spacing: -0.5px; color: #334155; }

/* Buttons */
.primary-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    box-shadow: 0 8px 16px rgba(79, 70, 229, 0.25);
}

.primary-btn:hover {
    transform: translateY(-2px);
    background: var(--primary-hover);
    box-shadow: 0 12px 24px rgba(79, 70, 229, 0.35);
}

/* Home */
.hero {
    text-align: center;
    max-width: 600px;
    margin: 6rem auto 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero p {
    color: var(--text-muted);
    font-size: 1.2rem;
    margin-bottom: 2.5rem;
    line-height: 1.5;
}

/* Scenarios */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.scenario-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 2rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0,0,0,0.03);
    opacity: 0;
    animation: slideUp 0.5s forwards;
    position: relative;
    overflow: hidden;
}

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

.scenario-card:hover {
    transform: translateY(-5px);
    border-color: rgba(79, 70, 229, 0.2);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
}

.icon-wrapper {
    width: 60px; height: 60px;
    border-radius: 16px;
    background: rgba(79, 70, 229, 0.05);
    display: flex; justify-content: center; align-items: center;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(79, 70, 229, 0.1);
}

.scenario-card .icon { font-size: 1.8rem; }
.scenario-card h3 { font-size: 1.4rem; margin-bottom: 0.2rem; color: #1e293b; }
.scenario-card .subtitle { color: var(--primary); font-size: 0.75rem; font-weight: 700; letter-spacing: 1px; margin-bottom: 0.8rem; }
.scenario-card .desc { color: var(--text-muted); font-size: 0.95rem; line-height: 1.5; }

/* Chat View */
#view-chat {
    display: none;
    flex-direction: column;
    height: calc(100vh - 100px);
    max-width: 800px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 24px;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    overflow: hidden;
    box-shadow: 0 24px 48px rgba(0,0,0,0.05);
    padding: 0;
}

#view-chat.active { display: flex; }

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 2rem;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    background: rgba(255,255,255,0.5);
}

.chat-header h2 { margin: 0; font-size: 1.2rem; color: #1e293b; }

.back-btn, .task-btn, .tool-btn {
    background: white;
    border: 1px solid rgba(0,0,0,0.05);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 100px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    font-family: inherit;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.back-btn:hover, .task-btn:hover, .tool-btn:hover {
    color: var(--text-main);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transform: translateY(-1px);
}

.task-btn { color: var(--primary); font-weight: 600; }

.messages-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.message {
    max-width: 75%;
    padding: 1rem 1.25rem;
    border-radius: 20px;
    line-height: 1.5;
    font-size: 1.05rem;
    animation: messagePop 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transform-origin: bottom;
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
}

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

.message.user {
    align-self: flex-end;
    background: var(--chat-user);
    border-bottom-right-radius: 4px;
    color: var(--chat-user-text);
}

.message.bot {
    align-self: flex-start;
    background: var(--chat-bot);
    border: 1px solid rgba(0,0,0,0.05);
    border-bottom-left-radius: 4px;
    color: var(--text-main);
}

.message .translation {
    display: none;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.8);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255,255,255,0.2);
}

.message.bot .translation {
    color: var(--text-muted);
    border-top: 1px solid rgba(0,0,0,0.05);
}

.message.show-translation .translation { display: block; }
.message.bot.typing { animation: pulseOpacity 1.5s infinite alternate; color: var(--text-muted); }

.chat-controls {
    padding: 0.5rem 2rem;
    display: flex;
    gap: 0.8rem;
    background: rgba(255,255,255,0.3);
}

.chat-input-area {
    padding: 1.25rem 2rem;
    background: white;
    border-top: 1px solid rgba(0,0,0,0.05);
    display: flex;
    gap: 1rem;
    align-items: center;
}

#chat-input {
    flex-grow: 1;
    background: rgba(0,0,0,0.02);
    border: 1px solid transparent;
    color: var(--text-main);
    padding: 1rem 1.5rem;
    border-radius: 100px;
    font-size: 1.05rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

#chat-input:focus {
    outline: none;
    background: white;
    border-color: rgba(79, 70, 229, 0.3);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.05);
}

.send-btn {
    background: var(--primary);
    color: white;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.send-btn:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4);
}

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal:not(.hidden) { opacity: 1; pointer-events: auto; }

.modal-content {
    background: white;
    padding: 2.5rem;
    border-radius: 24px;
    width: 90%;
    max-width: 450px;
    position: relative;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 24px 48px rgba(0,0,0,0.1);
}

.modal:not(.hidden) .modal-content { transform: scale(1); }

.close-btn {
    position: absolute;
    top: 1.2rem; right: 1.2rem;
    width: 32px; height: 32px;
    border-radius: 50%;
    background: rgba(0,0,0,0.03);
    color: var(--text-muted);
    display: flex; justify-content: center; align-items: center;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 1.2rem;
}

.close-btn:hover { background: rgba(0,0,0,0.08); color: var(--text-main); }

.task-list { list-style: none; margin-top: 1.5rem; display: flex; flex-direction: column; gap: 0.8rem; }
.task-list li {
    padding: 1.2rem;
    background: var(--bg-light);
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.05rem;
    transition: all 0.3s;
    color: #334155;
}
.task-list li.completed {
    background: rgba(16, 185, 129, 0.05);
    border-color: rgba(16, 185, 129, 0.2);
    color: #065f46;
}
.task-list li.completed::before { content: '✓'; font-weight: bold; color: var(--success); }
.task-list li::before { content: '○'; color: var(--text-muted); }

/* Stats */
.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-box {
    background: white;
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 10px 30px rgba(0,0,0,0.03);
    padding: 2rem;
    border-radius: 24px;
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.badges-title { font-size: 1.4rem; margin-bottom: 1.5rem; font-weight: 600; color: #1e293b; }
.badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
}

.badge-card {
    background: white;
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
    padding: 1.5rem;
    border-radius: 20px;
    text-align: center;
    transition: all 0.3s;
}
.badge-card.earned {
    border-color: rgba(79, 70, 229, 0.2);
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.1);
}
.badge-card.locked { opacity: 0.6; filter: grayscale(100%); background: transparent; }
.badge-card .icon { font-size: 2.5rem; margin-bottom: 1rem; }
.badge-card h4 { font-size: 1.1rem; margin-bottom: 0.4rem; font-weight: 600; color: #1e293b; }
.badge-card p { font-size: 0.85rem; color: var(--text-muted); }
