:root {
    --primary: #4a6741;
    --primary-dark: #3a5334;
    --primary-light: #5c7d52;
    --accent: #c9a227;
    --bg-warm: #faf8f5;
    --bg-cream: #f5f2ed;
    --text-dark: #2d3436;
    --text-medium: #636e72;
    --text-light: #b2bec3;
    --border: #e0dcd5;
    --white: #ffffff;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.12);
}

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

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif;
    background: var(--bg-warm);
    color: var(--text-dark);
    line-height: 1.6;
}

/* Login page */
.login-container {
    max-width: 420px;
    margin: 80px auto;
    padding: 48px 40px;
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}

.login-container h1 {
    margin-bottom: 8px;
    text-align: center;
    color: var(--primary);
    font-size: 28px;
    font-weight: 600;
}

.login-container .subtitle {
    text-align: center;
    color: var(--text-medium);
    margin-bottom: 32px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-dark);
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 103, 65, 0.1);
}

.login-container button {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.login-container button:hover {
    background: var(--primary-dark);
}

.login-container button:active {
    transform: scale(0.98);
}

.error {
    background: #fef2f2;
    color: #b91c1c;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 24px;
    font-size: 14px;
    border: 1px solid #fecaca;
}

/* App layout */
.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--primary);
    color: var(--white);
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.brand-icon {
    font-size: 24px;
    color: var(--accent);
}

.brand-text {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h2 {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.7;
}

.new-btn {
    color: var(--white);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 12px;
    background: rgba(255,255,255,0.15);
    border-radius: 6px;
    transition: background 0.2s;
}

.new-btn:hover {
    background: rgba(255,255,255,0.25);
}

.conversation-list {
    flex: 1;
    overflow-y: auto;
    list-style: none;
    padding: 0 12px;
}

.conversation-list li {
    margin-bottom: 4px;
}

.conversation-list li a {
    display: block;
    padding: 12px 16px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 14px;
    border-radius: 8px;
    transition: background 0.2s;
}

.conversation-list li:hover a {
    background: rgba(255,255,255,0.1);
}

.conversation-list li.active a {
    background: rgba(255,255,255,0.2);
    color: var(--white);
    font-weight: 500;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
}

.sidebar-footer a {
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
}

.sidebar-footer a:hover {
    color: var(--white);
}

/* Chat main area */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-warm);
    min-width: 0;
}

.chat-header {
    padding: 20px 32px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
}

.chat-header h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
}

/* Messages area */
.messages {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
}

.empty-state {
    text-align: center;
    padding: 80px 40px;
    max-width: 400px;
    margin: 0 auto;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-medium);
    font-size: 15px;
    line-height: 1.6;
}

/* Message bubbles */
.message {
    max-width: 720px;
    margin-bottom: 24px;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.message-author {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
}

.message.assistant .message-author {
    color: var(--primary);
}

.message-time {
    font-size: 12px;
    color: var(--text-light);
}

.message-content {
    padding: 16px 20px;
    border-radius: 12px;
    font-size: 15px;
    line-height: 1.7;
    white-space: pre-wrap;
}

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

.message.assistant .message-content {
    background: var(--white);
    color: var(--text-dark);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.message.error .message-content {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

/* Input form */
.input-form {
    padding: 24px 32px;
    background: var(--white);
    border-top: 1px solid var(--border);
}

.input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    background: var(--bg-cream);
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 8px 8px 8px 20px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 103, 65, 0.1);
}

.input-form textarea {
    flex: 1;
    padding: 10px 0;
    border: none;
    background: transparent;
    font-size: 16px;
    font-family: inherit;
    resize: none;
    max-height: 150px;
    line-height: 1.5;
}

.input-form textarea:focus {
    outline: none;
}

.input-form textarea::placeholder {
    color: var(--text-light);
}

.input-form button {
    width: 44px;
    height: 44px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
    flex-shrink: 0;
}

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

.input-form button:active {
    transform: scale(0.95);
}

.input-form button:disabled {
    background: var(--text-light);
    cursor: not-allowed;
}

.input-form button.loading {
    background: var(--text-light);
}

.input-hint {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-light);
    text-align: center;
}

/* Scrollbar styling */
.messages::-webkit-scrollbar,
.conversation-list::-webkit-scrollbar {
    width: 6px;
}

.messages::-webkit-scrollbar-track,
.conversation-list::-webkit-scrollbar-track {
    background: transparent;
}

.messages::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.conversation-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    
    .messages {
        padding: 20px;
    }
    
    .input-form {
        padding: 16px 20px;
    }
}

/* Session list improvements */
.conv-item {
    margin-bottom: 4px;
}

.conv-link {
    display: block;
    padding: 12px 16px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 14px;
    border-radius: 8px;
    transition: background 0.2s;
}

.conv-item:hover .conv-link {
    background: rgba(255,255,255,0.1);
}

.conv-item.active .conv-link {
    background: rgba(255,255,255,0.2);
    color: var(--white);
}

.conv-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.conv-title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-dates {
    display: flex;
    flex-direction: column;
    font-size: 11px;
    opacity: 0.6;
    margin-top: 4px;
    gap: 8px;
}

.edit-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    padding: 2px 6px;
    font-size: 14px;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

.edit-btn:hover {
    background: rgba(255,255,255,0.2);
    color: white;
}

.header-edit {
    color: var(--text-light);
}

.header-edit:hover {
    background: var(--bg-cream);
    color: var(--primary);
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.title-edit-input {
    font-size: 18px;
    font-weight: 600;
    padding: 4px 8px;
    border: 2px solid var(--primary);
    border-radius: 6px;
    background: var(--white);
    color: var(--text-dark);
    width: 300px;
}

.sidebar-title-edit {
    font-size: 14px;
    padding: 4px 8px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    background: rgba(255,255,255,0.1);
    color: white;
    width: 100%;
}

.sidebar-title-edit:focus,
.title-edit-input:focus {
    outline: none;
}

/* Session list improvements */
.conv-item {
    margin-bottom: 4px;
}

.conv-link {
    display: block;
    padding: 12px 16px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 14px;
    border-radius: 8px;
    transition: background 0.2s;
}

.conv-item:hover .conv-link {
    background: rgba(255,255,255,0.1);
}

.conv-item.active .conv-link {
    background: rgba(255,255,255,0.2);
    color: var(--white);
}

.conv-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.conv-title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-dates {
    display: flex;
    flex-direction: column;
    font-size: 11px;
    opacity: 0.6;
    margin-top: 4px;
    gap: 8px;
}

.edit-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    padding: 2px 6px;
    font-size: 14px;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

.edit-btn:hover {
    background: rgba(255,255,255,0.2);
    color: white;
}

.header-edit {
    color: var(--text-light);
}

.header-edit:hover {
    background: var(--bg-cream);
    color: var(--primary);
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.title-edit-input {
    font-size: 18px;
    font-weight: 600;
    padding: 4px 8px;
    border: 2px solid var(--primary);
    border-radius: 6px;
    background: var(--white);
    color: var(--text-dark);
    width: 300px;
}

.sidebar-title-edit {
    font-size: 14px;
    padding: 4px 8px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    background: rgba(255,255,255,0.1);
    color: white;
    width: 100%;
}

.sidebar-title-edit:focus,
.title-edit-input:focus {
    outline: none;
}

/* Aesthetic updates */
.sidebar {
    background: #E4D7C5 !important;
}

.sidebar-brand, .sidebar-header h2, .conversation-list a, .sidebar-footer {
    color: #2d3436 !important;
}

.sidebar-footer a {
    color: #4a6741 !important;
}

.conv-link {
    color: #2d3436 !important;
}

.conv-item:hover .conv-link {
    background: rgba(0,0,0,0.05) !important;
}

.conv-item.active .conv-link {
    background: rgba(0,0,0,0.1) !important;
}

.conv-dates {
    color: #636e72 !important;
    opacity: 1 !important;
}

.edit-btn {
    color: #636e72 !important;
}

.edit-btn:hover {
    background: rgba(0,0,0,0.1) !important;
    color: #2d3436 !important;
}

.new-btn {
    background: #4a6741 !important;
    color: white !important;
}

.message.user {
    background: #E4D7C5 !important;
}

#send-btn {
    background: #F4A03F !important;
    border-color: #F4A03F !important;
}

#send-btn:hover {
    background: #e0912e !important;
    border-color: #e0912e !important;
}

.brand-icon {
    width: 40px;
    height: 40px;
}

.brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.sidebar-title-edit {
    background: rgba(0,0,0,0.05) !important;
    border-color: rgba(0,0,0,0.2) !important;
    color: #2d3436 !important;
}

/* Fix user bubble color - target the content, not the wrapper */
.message.user .message-content {
    background: #E4D7C5 !important;
    color: #2d3436 !important;
}

/* Fix brand icon for image */
.brand-icon {
    font-size: inherit !important;
    color: inherit !important;
    display: flex !important;
    align-items: center !important;
}

/* Fix: user wrapper should be transparent, only bubble gets color */
.message.user {
    background: transparent !important;
}

/* User bubble content only */
.message.user .message-content {
    background: #E4D7C5 !important;
    color: #2d3436 !important;
}

/* User label stays original color */
.message.user .message-author {
    color: var(--primary) !important;
}

/* New button orange */
.new-btn {
    background: #F4A03F !important;
}

.new-btn:hover {
    background: #e0912e !important;
}

/* Input focus outline orange */
#message-input:focus {
    border-color: #F4A03F !important;
    box-shadow: 0 0 0 3px rgba(244, 160, 63, 0.2) !important;
    outline: none !important;
}

.input-wrapper:focus-within {
    border-color: #F4A03F !important;
    box-shadow: 0 0 0 3px rgba(244, 160, 63, 0.2) !important;
}

/* Delete button */
.conv-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.delete-btn {
    background: none;
    border: none;
    color: rgba(0,0,0,0.3);
    cursor: pointer;
    padding: 2px 6px;
    font-size: 14px;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
    opacity: 0;
}

.conv-item:hover .delete-btn {
    opacity: 1;
}

.delete-btn:hover {
    background: rgba(220, 53, 69, 0.2);
    color: #dc3545;
}

/* Coach interface styles */
.coach-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-light);
    padding: 40px;
}

.coach-welcome h2 {
    margin: 20px 0 10px;
    color: var(--text-dark);
}

.client-email {
    color: var(--text-light);
    font-size: 14px;
    margin-left: 12px;
}

.notes-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.note-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.note-date {
    font-size: 12px;
    color: var(--text-light);
}

.note-content {
    color: var(--text-dark);
    line-height: 1.6;
    white-space: pre-wrap;
}

.note-card .delete-btn {
    opacity: 0;
    color: var(--text-light);
}

.note-card:hover .delete-btn {
    opacity: 1;
}

#note-input {
    min-height: 80px;
}

/* White background for logo area */
.sidebar-brand {
    background: white !important;
    margin: -20px -20px 20px -20px;
    padding: 20px;
}

/* Center logo area vertically */
.sidebar-brand {
    padding-top: 20px !important;
    padding-bottom: 20px !important;
}

/* Center logo area vertically */
.sidebar-brand {
    padding-top: 20px !important;
    padding-bottom: 20px !important;
}

/* Clean fix for logo area */
.sidebar-brand {
    background: white !important;
    margin: 0 !important;
    padding: 24px 20px !important;
    border-bottom: 1px solid rgba(0,0,0,0.1) !important;
}

/* Align chat header with sidebar brand */
.chat-header {
    padding: 24px 32px !important;
    background: #E4D7C5 !important;
    border-bottom: 1px solid rgba(0,0,0,0.1) !important;
}

/* Match chat header height to sidebar brand */
.chat-header {
    min-height: 72px !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
}

/* Increase chat header to match sidebar brand */
.chat-header {
    min-height: 82px !important;
}

.chat-header {
    min-height: 92px !important;
}

.chat-header {
    min-height: 85px !important;
}

.chat-header {
    min-height: 88px !important;
}
