/* ============================================
   MENTAL HEALTH COMPANION - ENHANCED STYLES
   ============================================ */

/* CSS Variables for Easy Theming */
:root {
    /* Primary Colors - Calming Purple/Blue Gradient */
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --primary-light: #7c8ef0;
    --secondary: #764ba2;
    --accent: #f093fb;
    --accent-light: #f5b3ff;
    
    /* Background Colors */
    --background: #0a0a1b;
    --background-alt: #0f0f1e;
    --surface: #1a1a2e;
    --surface-light: #252540;
    --surface-hover: #2d2d4a;
    
    /* Text Colors */
    --text: #e8e8f0;
    --text-secondary: #a0a0b8;
    --text-tertiary: #70708a;
    
    /* Status Colors */
    --success: #48bb78;
    --warning: #ed8936;
    --danger: #f56565;
    --info: #4299e1;
    
    /* Border & Divider */
    --border: #2d2d44;
    --border-light: #3a3a54;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(102, 126, 234, 0.3);
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 50%;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, var(--background) 0%, var(--background-alt) 100%);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Container Layout */
.container {
    display: flex;
    height: 100vh;
    max-width: 1920px;
    margin: 0 auto;
    position: relative;
}

/* ============================================
   SIDEBAR STYLES
   ============================================ */

.sidebar {
    width: 280px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 2rem 1rem;
    position: relative;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: linear-gradient(180deg, rgba(102, 126, 234, 0.1) 0%, transparent 100%);
    pointer-events: none;
}

/* Logo Section */
.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 3rem;
    padding: 0 0.5rem;
    position: relative;
    z-index: 1;
}

.logo svg {
    filter: drop-shadow(0 4px 12px rgba(102, 126, 234, 0.4));
    animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { filter: drop-shadow(0 4px 12px rgba(102, 126, 234, 0.4)); }
    50% { filter: drop-shadow(0 4px 20px rgba(102, 126, 234, 0.6)); }
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

/* Navigation Menu */
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    position: relative;
    z-index: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-align: left;
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
}

.nav-item .icon {
    font-size: 1.3rem;
    transition: transform var(--transition-normal);
    z-index: 1;
}

.nav-item span:not(.icon) {
    z-index: 1;
}

.nav-item:hover {
    background: var(--surface-light);
    color: var(--text);
    transform: translateX(5px);
}

.nav-item:hover .icon {
    transform: scale(1.1);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    box-shadow: var(--shadow-glow);
    transform: translateX(5px);
}

.nav-item.active::before {
    transform: translateX(0);
}

.nav-item:active {
    transform: translateX(3px) scale(0.98);
}

/* Emergency Card */
.sidebar-footer {
    margin-top: auto;
    position: relative;
    z-index: 1;
}

.emergency-card {
    background: linear-gradient(135deg, #f56565 0%, #ed8936 100%);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    animation: subtle-pulse 4s ease-in-out infinite;
}

@keyframes subtle-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.emergency-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.emergency-card h3 {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    position: relative;
}

.emergency-card p {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    position: relative;
}

.emergency-card strong {
    font-weight: 700;
    font-size: 1.05rem;
}

.emergency-card small {
    font-size: 0.75rem;
    opacity: 0.9;
    position: relative;
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--background);
    overflow: hidden;
    position: relative;
}

.main-content::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

/* View Container */
.view {
    display: none;
    flex-direction: column;
    height: 100%;
    padding: 2rem;
    overflow-y: auto;
    animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.view.active {
    display: flex;
}

/* View Header */
.view-header {
    margin-bottom: 2rem;
    animation: slideInLeft 0.5s ease;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.view-header h2 {
    font-size: 2.25rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    letter-spacing: -1px;
}

.view-header p {
    color: var(--text-secondary);
    font-size: 1.05rem;
}

/* ============================================
   CHAT INTERFACE
   ============================================ */

/* Chat Header */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.chat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, transparent 100%);
    pointer-events: none;
}

.header-content {
    position: relative;
    z-index: 1;
}

.header-content h2 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
    font-weight: 700;
}

.header-content p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.btn-clear {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    cursor: pointer;
    transition: all var(--transition-normal);
    font-weight: 500;
    position: relative;
    z-index: 1;
}

.btn-clear:hover {
    background: var(--danger);
    border-color: var(--danger);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 101, 101, 0.4);
}

.btn-clear:active {
    transform: translateY(0);
}

/* Chat Container */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 3rem 2rem;
    max-width: 600px;
    margin: auto;
    animation: fadeIn 0.6s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.welcome-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.welcome-message h3 {
    font-size: 2rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.welcome-message p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.8;
}

/* Quick Starters */
.quick-starters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.quick-start-btn {
    padding: 1.25rem;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    cursor: pointer;
    transition: all var(--transition-normal);
    font-size: 0.95rem;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.quick-start-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.quick-start-btn:hover {
    border-color: var(--primary);
    transform: translateY(-5px);
    box-shadow: var(--shadow-glow);
}

.quick-start-btn:hover::before {
    opacity: 0.1;
}

.quick-start-btn:active {
    transform: translateY(-3px);
}

/* Chat Messages */
.message {
    display: flex;
    gap: 1rem;
    animation: slideIn 0.3s ease;
    max-width: 80%;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    margin-left: auto;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-normal);
}

.message:hover .message-avatar {
    transform: scale(1.1);
}

.message.bot .message-avatar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
}

.message.user .message-avatar {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.message-content {
    background: var(--surface);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    line-height: 1.7;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
    position: relative;
}

.message-content::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
}

.message.bot .message-content::before {
    left: -8px;
    top: 12px;
    border-width: 8px 8px 8px 0;
    border-color: transparent var(--surface) transparent transparent;
}

.message.user .message-content {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
}

.message.user .message-content::before {
    right: -8px;
    top: 12px;
    border-width: 8px 0 8px 8px;
    border-color: transparent transparent transparent var(--secondary);
}

.message:hover .message-content {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 0.4rem;
    padding: 1rem;
}

.typing-indicator span {
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: var(--radius-full);
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% { 
        transform: translateY(0);
        opacity: 0.5;
    }
    30% { 
        transform: translateY(-12px);
        opacity: 1;
    }
}

/* Chat Input */
.chat-input-container {
    padding: 1.5rem 2rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
    margin-top: 1rem;
    box-shadow: var(--shadow-md);
    position: relative;
}

.chat-input-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
}

.input-wrapper {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

#user-input {
    flex: 1;
    background: var(--surface-light);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 1.5rem;
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
    resize: none;
    max-height: 150px;
    transition: all var(--transition-normal);
    line-height: 1.5;
}

#user-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

#user-input::placeholder {
    color: var(--text-tertiary);
}

.btn-send {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.btn-send:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--shadow-glow);
}

.btn-send:active {
    transform: translateY(-1px) scale(1.02);
}

.btn-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-send svg {
    transition: transform var(--transition-normal);
}

.btn-send:hover svg {
    transform: translateX(2px);
}

/* ============================================
   MOOD TRACKER
   ============================================ */

.mood-selector {
    background: var(--surface);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.mood-selector h3 {
    margin-bottom: 2rem;
    font-size: 1.4rem;
    font-weight: 600;
}

.mood-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.mood-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem 1rem;
    background: var(--surface-light);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.mood-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.mood-btn:hover {
    border-color: var(--primary);
    transform: translateY(-5px) scale(1.05);
    box-shadow: var(--shadow-md);
}

.mood-btn:hover::before {
    opacity: 0.1;
}

.mood-btn.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    transform: translateY(-5px) scale(1.05);
    box-shadow: var(--shadow-glow);
}

.mood-btn.selected::before {
    opacity: 1;
}

.mood-emoji {
    font-size: 3rem;
    transition: transform var(--transition-normal);
    position: relative;
    z-index: 1;
}

.mood-btn:hover .mood-emoji {
    transform: scale(1.2) rotate(5deg);
}

.mood-btn span:last-child {
    font-weight: 500;
    position: relative;
    z-index: 1;
}

#mood-note {
    width: 100%;
    background: var(--surface-light);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    margin-bottom: 1.5rem;
    transition: all var(--transition-normal);
    min-height: 100px;
}

#mood-note:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

#mood-note::placeholder {
    color: var(--text-tertiary);
}

/* Mood History */
.mood-history {
    background: var(--surface);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.mood-history h3 {
    margin-bottom: 2rem;
    font-size: 1.4rem;
    font-weight: 600;
}

.chart-container {
    background: var(--surface-light);
    padding: 2.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
}

.mood-entries-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mood-entry {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    background: var(--surface-light);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary);
    transition: all var(--transition-normal);
    cursor: pointer;
}

.mood-entry:hover {
    transform: translateX(5px);
    background: var(--surface-hover);
    box-shadow: var(--shadow-sm);
}

.mood-entry-emoji {
    font-size: 2.5rem;
}

.mood-entry-content {
    flex: 1;
}

.mood-entry-date {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.mood-entry-note {
    margin-top: 0.75rem;
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.6;
}

/* ============================================
   RESOURCES SECTION
   ============================================ */

.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 1.5rem;
}

.resource-card {
    background: var(--surface);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.resource-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, transparent 100%);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.resource-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.resource-card:hover::before {
    opacity: 1;
}

.resource-icon {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    animation: float 3s ease-in-out infinite;
    animation-delay: calc(var(--delay, 0) * 0.2s);
}

.resource-card:nth-child(1) .resource-icon { --delay: 0; }
.resource-card:nth-child(2) .resource-icon { --delay: 1; }
.resource-card:nth-child(3) .resource-icon { --delay: 2; }
.resource-card:nth-child(4) .resource-icon { --delay: 3; }
.resource-card:nth-child(5) .resource-icon { --delay: 4; }
.resource-card:nth-child(6) .resource-icon { --delay: 5; }

.resource-card h3 {
    margin-bottom: 1rem;
    font-size: 1.35rem;
    font-weight: 600;
    position: relative;
}

.resource-card p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.7;
    position: relative;
}

.helpline-list {
    list-style: none;
    padding: 0;
    position: relative;
}

.helpline-list li {
    padding: 1rem 0;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    transition: all var(--transition-fast);
}

.helpline-list li:last-child {
    border-bottom: none;
}

.helpline-list li:hover {
    color: var(--text);
    padding-left: 0.5rem;
}

.btn-resource {
    padding: 0.875rem 2rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    cursor: pointer;
    transition: all var(--transition-normal);
    font-size: 1rem;
    font-weight: 600;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.btn-resource:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow);
}

.btn-resource:active {
    transform: translateY(-1px);
}

/* ============================================
   JOURNAL SECTION
   ============================================ */

.journal-editor {
    background: var(--surface);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.journal-title-input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--border);
    padding: 1.25rem 0;
    color: var(--text);
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    transition: all var(--transition-normal);
}

.journal-title-input:focus {
    outline: none;
    border-bottom-color: var(--primary);
}

.journal-title-input::placeholder {
    color: var(--text-tertiary);
    font-weight: 500;
}

#journal-content {
    width: 100%;
    background: var(--surface-light);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    color: var(--text);
    font-family: 'Georgia', serif;
    font-size: 1.05rem;
    line-height: 1.8;
    resize: vertical;
    margin-bottom: 1.5rem;
    transition: all var(--transition-normal);
    min-height: 300px;
}

#journal-content:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

#journal-content::placeholder {
    color: var(--text-tertiary);
    font-family: inherit;
}

.journal-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-primary {
    padding: 1rem 2.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    cursor: pointer;
    transition: all var(--transition-normal);
    font-size: 1rem;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow);
}

.btn-primary:active {
    transform: translateY(-1px);
}

.btn-secondary {
    padding: 1rem 2.5rem;
    background: var(--surface-light);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    cursor: pointer;
    transition: all var(--transition-normal);
    font-size: 1rem;
    font-weight: 600;
}

.btn-secondary:hover {
    border-color: var(--primary);
    background: var(--surface);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:active {
    transform: translateY(0);
}

/* Journal Entries List */
.journal-entries {
    background: var(--surface);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.journal-entries h3 {
    margin-bottom: 2rem;
    font-size: 1.4rem;
    font-weight: 600;
}

#journal-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.journal-item {
    background: var(--surface-light);
    padding: 2rem;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary);
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.journal-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, transparent 100%);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.journal-item:hover {
    transform: translateX(8px);
    background: var(--surface-hover);
    box-shadow: var(--shadow-md);
}

.journal-item:hover::before {
    opacity: 1;
}

.journal-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    position: relative;
}

.journal-item-title {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text);
}

.journal-item-date {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.journal-item-preview {
    color: var(--text-secondary);
    line-height: 1.7;
    position: relative;
}

/* ============================================
   MODAL STYLES
   ============================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--surface);
    padding: 3rem;
    border-radius: var(--radius-xl);
    max-width: 550px;
    width: 90%;
    position: relative;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.4s ease;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
}

.modal-close:hover {
    background: var(--surface-light);
    color: var(--danger);
    transform: rotate(90deg);
}

.breathing-exercise h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.breathing-exercise p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.breathing-circle {
    width: 220px;
    height: 220px;
    margin: 2rem auto;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    animation: breathe 16s infinite;
    box-shadow: 0 0 40px rgba(102, 126, 234, 0.6);
    position: relative;
}

.breathing-circle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 180px;
    height: 180px;
    border-radius: var(--radius-full);
    background: var(--surface);
    animation: breathe-inner 16s infinite;
}

@keyframes breathe {
    0%, 100% { 
        transform: scale(1);
        opacity: 0.5;
    }
    12.5% { 
        transform: scale(1.5);
        opacity: 1;
    }
    37.5% { 
        transform: scale(1.5);
        opacity: 1;
    }
    50% { 
        transform: scale(1);
        opacity: 0.5;
    }
}

@keyframes breathe-inner {
    0%, 100% { 
        transform: translate(-50%, -50%) scale(1);
    }
    12.5% { 
        transform: translate(-50%, -50%) scale(0.7);
    }
    37.5% { 
        transform: translate(-50%, -50%) scale(0.7);
    }
    50% { 
        transform: translate(-50%, -50%) scale(1);
    }
}

.breathing-instruction {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 2rem 0;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    animation: breatheText 16s infinite;
}

@keyframes breatheText {
    0%, 12.5% { 
        content: 'Breathe In';
        color: var(--primary);
    }
    12.6%, 25% { 
        content: 'Hold';
        color: var(--secondary);
    }
    25.1%, 37.5% { 
        content: 'Breathe Out';
        color: var(--info);
    }
    37.6%, 50% { 
        content: 'Hold';
        color: var(--secondary);
    }
    50.1% {
        content: 'Breathe In';
        color: var(--primary);
    }
}

/* ============================================
   SCROLLBAR STYLES
   ============================================ */

::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--surface);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: var(--radius-sm);
    border: 2px solid var(--surface);
    transition: background var(--transition-normal);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

::-webkit-scrollbar-corner {
    background: var(--surface);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border) var(--surface);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 1024px) {
    .resources-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
    
    .quick-starters {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 80px;
        padding: 1rem 0.5rem;
    }

    .logo h1, 
    .nav-item span:not(.icon) {
        display: none;
    }

    .logo {
        justify-content: center;
        margin-bottom: 2rem;
    }

    .nav-item {
        justify-content: center;
        padding: 1rem;
    }

    .nav-item:hover,
    .nav-item.active {
        transform: translateX(0) scale(1.05);
    }

    .emergency-card {
        font-size: 0.7rem;
        padding: 1rem;
    }

    .emergency-card h3 {
        font-size: 0.8rem;
    }

    .emergency-card p {
        font-size: 0.75rem;
    }

    .view {
        padding: 1rem;
    }

    .view-header h2 {
        font-size: 1.75rem;
    }

    .chat-header {
        flex-direction: column;
        gap: 1rem;
        padding: 1.5rem;
    }

    .header-content h2 {
        font-size: 1.5rem;
    }

    .message {
        max-width: 90%;
    }

    .resources-grid {
        grid-template-columns: 1fr;
    }

    .mood-options {
        grid-template-columns: repeat(2, 1fr);
    }

    .journal-actions {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
    }

    .quick-starters {
        grid-template-columns: 1fr;
    }

    .modal-content {
        padding: 2rem;
        width: 95%;
    }

    .breathing-circle {
        width: 180px;
        height: 180px;
    }

    .breathing-circle::before {
        width: 140px;
        height: 140px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 70px;
    }

    .view-header h2 {
        font-size: 1.5rem;
    }

    .chat-container {
        padding: 1rem;
    }

    .mood-options {
        grid-template-columns: 1fr;
    }

    .mood-btn {
        padding: 1.5rem 1rem;
    }

    .journal-editor,
    .journal-entries,
    .mood-selector,
    .mood-history {
        padding: 1.5rem;
    }

    #journal-content {
        min-height: 200px;
        font-size: 1rem;
    }

    .resource-card {
        padding: 1.5rem;
    }
}

/* ============================================
   ACCESSIBILITY & UTILITIES
   ============================================ */

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print styles */
@media print {
    .sidebar,
    .chat-input-container,
    .btn-clear,
    .modal {
        display: none !important;
    }

    .view {
        padding: 0;
    }

    body {
        background: white;
    }
}