:root {
    --bg-dark: #1a1a2e;
    --bg-light: #f5f5f5;
    --primary: #00d9ff;
    --secondary: #00b894;
    --text-light: #ffffff;
    --text-dark: #2d3436;
    --bubble-ai: #4a9eff;
    --bubble-user: #00b894;
    --accent-red: #ff7675;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* HEADER */
.main-header {
    background: var(--bg-dark);
    color: var(--text-light);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    height: 80px;
    flex-shrink: 0;
}

.header-left {
    flex: 1;
}

.logo {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo i {
    font-size: 1.5rem;
}

.header-center {
    flex: 2;
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: center;
}

.progress-panel {
    flex: 1;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.step-label {
    font-size: 0.75rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.progress-bar-container {
    width: 100%;
    margin-top: 10px;
}

.progress-bar-segmented {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.progress-segment {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.progress-segment::before {
    content: attr(data-step);
}

.progress-segment:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.progress-segment.completed {
    background: var(--primary);
    color: white;
    cursor: pointer;
}

.progress-segment.completed:hover {
    background: #00c4e6;
    box-shadow: 0 2px 8px rgba(0, 217, 255, 0.4);
}

.progress-segment.current {
    background: var(--secondary);
    color: white;
    box-shadow: 0 0 0 3px rgba(0, 184, 148, 0.3);
    animation: currentPulse 2s infinite;
}

@keyframes currentPulse {

    0%,
    100% {
        box-shadow: 0 0 0 3px rgba(0, 184, 148, 0.3);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(0, 184, 148, 0.1);
    }
}

.progress-segment.future {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.3);
    cursor: not-allowed;
}

.progress-segment.future:hover {
    transform: none;
}

.header-right {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* MAIN CHAT */
.main-stage {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg-light);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.message {
    display: flex;
    gap: 15px;
    max-width: 80%;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.ai-message {
    align-self: flex-start;
}

.message.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.avatar i {
    font-size: 1.2rem;
    color: white;
}

.user-message .avatar {
    background: var(--bubble-user);
}

.bubble {
    background: var(--bubble-ai);
    color: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    line-height: 1.6;
    position: relative;
}

.user-message .bubble {
    background: var(--bubble-user);
}

.bubble p {
    margin: 0;
}

/* Markdown Styles */
.bubble h1,
.bubble h2,
.bubble h3 {
    margin: 15px 0 10px 0;
    font-weight: 600;
}

.bubble h1 {
    font-size: 1.4rem;
}

.bubble h2 {
    font-size: 1.2rem;
}

.bubble h3 {
    font-size: 1.1rem;
}

.bubble ul {
    margin: 10px 0;
    padding-left: 20px;
}

.bubble li {
    margin: 5px 0;
}

.bubble strong {
    font-weight: 700;
}

.bubble em {
    font-style: italic;
}

.bubble code {
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

.bubble pre {
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
    overflow-x: auto;
}

.bubble pre code {
    background: transparent;
    padding: 0;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 10px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.7;
    }

    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* CONTROL DECK (FOOTER) */
.control-deck {
    background: white;
    padding: 20px 30px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    position: relative;
    min-height: 100px;
}

.connection-status {
    position: absolute;
    top: 5px;
    left: 30px;
    font-size: 0.75rem;
    color: #999;
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-red);
}

.status-dot.connected {
    background: var(--secondary);
}

.wave-animation {
    position: absolute;
    top: 5px;
    right: 30px;
    display: none;
    gap: 3px;
    height: 20px;
}

.wave-animation.active {
    display: flex;
}

.wave-bar {
    width: 3px;
    background: var(--primary);
    border-radius: 2px;
    animation: wave 1s ease-in-out infinite;
}

.wave-bar:nth-child(1) {
    animation-delay: 0s;
}

.wave-bar:nth-child(2) {
    animation-delay: 0.1s;
}

.wave-bar:nth-child(3) {
    animation-delay: 0.2s;
}

.wave-bar:nth-child(4) {
    animation-delay: 0.3s;
}

.wave-bar:nth-child(5) {
    animation-delay: 0.4s;
}

@keyframes wave {

    0%,
    100% {
        transform: scaleY(0.5);
    }

    50% {
        transform: scaleY(1);
    }
}

/* Input Wrapper & Controls */
.input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
}

.text-input-container {
    flex: 1;
    background: #f5f5f5;
    border-radius: 25px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    min-height: 50px;
}

.user-input,
#user-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-family: inherit;
    font-size: 1rem;
    resize: none;
    min-height: 24px;
    max-height: 150px;
    color: var(--text-dark);
}

.user-input::placeholder {
    color: #999;
}

.control-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: var(--secondary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s;
    box-shadow: 0 2px 10px rgba(0, 184, 148, 0.3);
    flex-shrink: 0;
}

.control-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 184, 148, 0.4);
}

.control-btn.secondary-btn {
    background: #e0e0e0;
    color: var(--text-dark);
    box-shadow: none;
}

.control-btn.secondary-btn:hover {
    background: #d0d0d0;
}

.control-btn.recording {
    background: var(--accent-red);
    color: white;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(255, 118, 117, 0.7);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(255, 118, 117, 0);
    }
}

/* TTS Button */
.tts-container {
    margin-top: 10px;
}

.tts-button {
    background: rgba(255, 255, 255, 0.3);
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: all 0.3s;
}

.tts-button:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

.tts-button.playing {
    background: rgba(255, 118, 117, 0.5);
}

/* Modals - Hidden by default */
.modal-overlay,
.dashboard-overlay {
    display: none !important;
}

.modal-overlay.active,
.dashboard-overlay.active {
    display: flex !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
}

.modal-title {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--bg-dark);
    text-align: center;
}

.form-group {
    margin-bottom: 15px;
}

.form-label {
    font-size: 0.9rem;
}

.auth-link {
    color: var(--primary);
    cursor: pointer;
    font-weight: 600;
}

.auth-link:hover {
    text-decoration: underline;
}