/* CSS Reset and Variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Modern Color Palette */
    --primary: #8B5FBF;
    --primary-light: #A98DC5;
    --primary-dark: #6B46C1;
    --secondary: #06D6A0;
    --accent: #FFD166;
    --danger: #EF476F;
    
    /* Emotion Colors */
    --calm: #06D6A0;
    --sadness: #118AB2;
    --anxiety: #FF9E6D;
    --fear: #EF476F;
    --joy: #FFD166;
    
    /* Neutral Palette */
    --bg-light: #FAFAFA;
    --bg-card: #FFFFFF;
    --text-light: #333333;
    --text-muted: #666666;
    --border: #E0E0E0;
    
    /* Dark Mode */
    --bg-dark: #1A1A2E;
    --bg-card-dark: #16213E;
    --text-dark: #E6E6E6;
    --border-dark: #2D3047;
    
    /* Typography */
    --font-main: 'Quicksand', sans-serif;
    --font-accent: 'Pacifico', cursive;
    
    /* Effects */
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 20px 60px rgba(0, 0, 0, 0.12);
    --radius: 20px;
    --radius-sm: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Variables */
body.dark-mode {
    --bg-light: var(--bg-dark);
    --bg-card: var(--bg-card-dark);
    --text-light: var(--text-dark);
    --text-muted: #A0A0A0;
    --border: var(--border-dark);
}

/* Base Styles */
body {
    font-family: var(--font-main);
    background: var(--bg-light);
    color: var(--text-light);
    min-height: 100vh;
    overflow-x: hidden;
    transition: var(--transition);
}

.app-container {
    display: flex;
    min-height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    gap: 20px;
    padding: 20px;
}

/* Left Panel Styles */
.left-panel {
    width: 320px;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 30px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
    position: sticky;
    top: 20px;
    height: calc(100vh - 40px);
    overflow-y: auto;
}

.logo-container {
    text-align: center;
    margin-bottom: 30px;
}

.logo-icon {
    font-size: 64px;
    margin-bottom: 15px;
    animation: gentle-pulse 3s infinite;
}

@keyframes gentle-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.9; }
}

.logo-text {
    font-family: var(--font-accent);
    font-size: 28px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.tagline {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
}

.stats-card {
    background: linear-gradient(135deg, rgba(139, 95, 191, 0.1), rgba(6, 214, 160, 0.1));
    border-radius: var(--radius-sm);
    padding: 20px;
    margin-bottom: 25px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.stat-item:last-child {
    margin-bottom: 0;
}

.stat-item i {
    font-size: 24px;
    color: var(--primary);
    background: rgba(139, 95, 191, 0.1);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-item h3 {
    font-size: 16px;
    margin-bottom: 4px;
}

.stat-item p {
    font-size: 13px;
    color: var(--text-muted);
}

.emotional-state {
    margin-top: 20px;
}

.emotional-state h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    margin-bottom: 20px;
    color: var(--text-light);
}

.emotional-state h3 i {
    color: var(--danger);
}

.emotion-display {
    text-align: center;
}

.emotion-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--calm), var(--secondary));
    font-size: 18px;
    font-weight: 600;
    color: white;
    transition: var(--transition);
    box-shadow: 0 10px 30px rgba(6, 214, 160, 0.3);
}

.intensity-bar {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.intensity-fill {
    height: 100%;
    width: 30%;
    background: linear-gradient(90deg, var(--calm), var(--secondary));
    border-radius: 4px;
    transition: var(--transition);
}

.intensity-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}

.quick-actions {
    margin-top: 30px;
}

.quick-actions h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    margin-bottom: 15px;
    color: var(--text-light);
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 15px 10px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
}

.action-btn:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: var(--shadow-hover);
}

.action-btn i {
    font-size: 20px;
    color: var(--primary);
}

.action-btn span {
    font-size: 12px;
    font-weight: 600;
}

.privacy-note {
    margin-top: auto;
    padding: 15px;
    background: rgba(6, 214, 160, 0.1);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.privacy-note i {
    color: var(--secondary);
}

/* Main Area Styles */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.chat-header {
    padding: 25px 30px;
    background: linear-gradient(135deg, rgba(139, 95, 191, 0.1), rgba(6, 214, 160, 0.1));
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.header-left h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    margin-bottom: 5px;
}

.header-left h2 i {
    color: var(--primary);
}

.session-id {
    font-size: 13px;
    color: var(--text-muted);
}

.header-right {
    display: flex;
    gap: 10px;
}

.header-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--bg-card);
    color: var(--text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.header-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: rotate(15deg);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    background: var(--bg-light);
}

.welcome-message {
    margin-bottom: 30px;
}

.welcome-bubble {
    display: flex;
    gap: 20px;
    background: var(--bg-card);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.welcome-avatar {
    font-size: 48px;
    flex-shrink: 0;
}

.welcome-content h3 {
    font-size: 20px;
    margin-bottom: 10px;
    color: var(--text-light);
}

.welcome-content p {
    margin-bottom: 10px;
    line-height: 1.6;
    color: var(--text-muted);
}

.welcome-tip {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--primary);
}

.message-container {
    margin-bottom: 20px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-bubble {
    max-width: 70%;
    padding: 18px 22px;
    border-radius: var(--radius);
    line-height: 1.5;
    position: relative;
    box-shadow: var(--shadow);
}

.message-bubble.user {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 5px;
}

.message-bubble.ai {
    background: var(--bg-card);
    color: var(--text-light);
    margin-right: auto;
    border-bottom-left-radius: 5px;
}

.message-content {
    margin-bottom: 8px;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    text-align: right;
}

.typing-indicator {
    padding: 0 30px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    opacity: 0;
    transition: opacity 0.3s;
}

.typing-indicator.active {
    opacity: 1;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    animation: typingBounce 1.4s infinite;
}

.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

/* Input Area */
.input-area {
    padding: 25px 30px;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
}

.input-wrapper {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
}

textarea {
    flex: 1;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 18px 20px;
    font-family: var(--font-main);
    font-size: 16px;
    resize: none;
    background: var(--bg-light);
    color: var(--text-light);
    transition: var(--transition);
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 95, 191, 0.1);
}

.send-btn, .voice-btn {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: var(--transition);
    flex-shrink: 0;
}

.send-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(139, 95, 191, 0.3);
}

.voice-btn {
    background: var(--bg-light);
    color: var(--text-light);
    border: 2px solid var(--border);
}

.voice-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.input-hints {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    padding: 25px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    padding: 30px;
}

.exercise-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 25px;
    text-align: center;
    color: var(--text-light);
}

.exercise-steps {
    margin-bottom: 30px;
}

.step {
    background: rgba(139, 95, 191, 0.1);
    padding: 15px 20px;
    margin-bottom: 10px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 15px;
}

.step-number {
    width: 30px;
    height: 30px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    flex-shrink: 0;
}

.timer-container {
    text-align: center;
    margin: 30px 0;
}

.timer-circle {
    width: 120px;
    height: 120px;
    border: 4px solid var(--primary);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    font-weight: 600;
}

.timer-circle span:first-child {
    font-size: 32px;
    color: var(--primary);
}

.timer-circle span:last-child {
    font-size: 14px;
    color: var(--text-muted);
}

.start-btn {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition);
}

.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(139, 95, 191, 0.4);
}

/* Floating Elements */
.floating-elements {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: -1;
}

.float-1, .float-2, .float-3, .float-4 {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    opacity: 0.1;
    filter: blur(40px);
}

.float-1 { width: 300px; height: 300px; top: 10%; left: 5%; }
.float-2 { width: 200px; height: 200px; bottom: 20%; right: 10%; }
.float-3 { width: 150px; height: 150px; top: 40%; right: 20%; }
.float-4 { width: 250px; height: 250px; bottom: 10%; left: 15%; }

/* Responsive Design */
@media (max-width: 1024px) {
    .app-container {
        flex-direction: column;
        padding: 10px;
    }
    
    .left-panel {
        width: 100%;
        height: auto;
        position: static;
        margin-bottom: 20px;
    }
    
    .action-buttons {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (max-width: 768px) {
    .app-container {
        padding: 0;
    }
    
    .left-panel, .main-area {
        border-radius: 0;
    }
    
    .chat-header, .chat-messages, .input-area {
        padding: 20px;
    }
    
    .message-bubble {
        max-width: 85%;
    }
    
    .action-buttons {
        grid-template-columns: repeat(3, 1fr);
    }
}