:root {
    --primary: #ff638a;
    --secondary: #ff639f;
    --bg: rgba(219, 21, 54, 0.33);
    --white: #ffffff;
    --text: #333;
    --gray: #f1f1f1;
}

* {
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background: var(--bg);
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

/* --- UTILITY --- */
.hidden {
    display: none !important;
}

/* --- SIDEBAR --- */
#menu-dots {
    position: fixed;
    top: 30px;
    left: 30px;
    font-size: 24px;
    cursor: pointer;
    z-index: 1000;
    background: var(--white);
    padding: 10px;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

#sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100%;
    width: 280px;
    background: var(--white);
    z-index: 999;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 25px;
    display: flex;
    flex-direction: column;
}

.sidebar-hidden {
    transform: translateX(-100%);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.menu-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.menu-nav button {
    width: 100%;
    padding: 12px 15px;
    border: none;
    background: var(--gray);
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    text-align: left;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.menu-nav button i {
    color: var(--primary);
}

.menu-nav button:hover {
    background: #e8e8e8;
    transform: translateX(5px);
}

/* --- APP UI & SECTIONS --- */
.app-container {
    background: var(--white);
    width: 90%;
    max-width: 650px;
    max-height: 90vh;
    padding: 40px;
    border-radius: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.05);
    text-align: center;
    overflow-y: auto;
}

.side-sec {
    animation: fadeIn 0.4s ease-out;
}

/* --- JOURNALING --- */
textarea {
    width: 100%;
    height: 200px;
    border: 2px solid var(--gray);
    border-radius: 15px;
    padding: 15px;
    font-size: 16px;
    margin: 20px 0;
    outline: none;
    resize: none;
    transition: border-color 0.3s;
}

textarea:focus {
    border-color: var(--primary);
}

#saveBtn {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    padding: 15px;
    border-radius: 12px;
    font-size: 18px;
    cursor: pointer;
    transition: 0.2s;
}

#saveBtn:hover {
    background: #e05278;
    transform: translateY(-2px);
}

/* --- HISTORY CARDS --- */
#history-list {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.hist-card {
    background: var(--gray);
    padding: 15px;
    border-radius: 15px;
    text-align: left;
    border-left: 5px solid var(--primary);
}

.hist-date {
    font-size: 12px;
    color: #888;
    margin-bottom: 5px;
}

.hist-text {
    font-size: 14px;
    color: var(--text);
}

/* --- CHART & RECAP --- */
.stats-box {
    display: flex;
    justify-content: space-around;
    background: var(--gray);
    padding: 15px;
    border-radius: 15px;
    margin-bottom: 20px;
}

.recap-box {
    background: rgba(108, 99, 255, 0.05);
    border-left: 4px solid var(--secondary);
    padding: 20px;
    margin: 20px 0;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.6;
    text-align: left;
    color: var(--text);
}

.primary-btn {
    background-color: var(--secondary);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.3s;
}

.primary-btn:hover {
    background-color: #5851db;
    transform: scale(1.05);
}

/* --- CHAT SYSTEM --- */
#chat-trigger {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--primary);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(255, 99, 138, 0.3);
    z-index: 1000;
}

#chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 320px;
    height: 450px;
    /* Keep this fixed */
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    /* Stacks header, body, and input */
    overflow: hidden;
    /* Prevents the window itself from scrolling */
    z-index: 1000;
}

#chat-body {
    flex: 1;
    /* This makes the body take up all available space */
    padding: 15px;
    overflow-y: auto;
    /* This allows ONLY the messages to scroll */
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-input-box {
    display: flex;
    padding: 10px;
    border-top: 1px solid #eee;
    background: white;
    /* Ensures it stays visible over messages */
}

.chat-head {
    background: var(--primary);
    color: white;
    padding: 15px;
    font-weight: 600;
}

.user-msg {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    padding: 10px 15px;
    border-radius: 15px 15px 0 15px;
    max-width: 80%;
    font-size: 14px;
}

.bot-msg {
    align-self: flex-start;
    background: var(--gray);
    color: var(--text);
    padding: 10px 15px;
    border-radius: 15px 15px 15px 0;
    max-width: 80%;
    font-size: 14px;
}

/* --- ANIMATIONS --- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}