:root {
    --primary: #D81B60;
    /* Old Pink */
    --secondary: #FCE4EC;
    /* Soft Pink */
    --accent: #FFFFFF;
    --text-dark: #2D3436;
    --text-light: #636E72;
    --bg-app: #F8F9FA;
    --card-bg: #FFFFFF;
    --transition: all 0.3s ease;
}

.dark-theme {
    --bg-app: #121212;
    --card-bg: #1E1E1E;
    --text-dark: #F5F5F5;
    --text-light: #B2BEC3;
    --secondary: #3E1B2A;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Roboto, sans-serif;
}

body {
    background-color: var(--bg-app);
    color: var(--text-dark);
    transition: var(--transition);
}

.app-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
}

/* Header */
.main-header {
    background-color: var(--primary);
    padding: 40px 20px;
    border-radius: 0 0 30px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

/* Cards */
.card {
    background: var(--card-bg);
    margin: 20px;
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

/* Calendar */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.calendar-header button {
    background: var(--secondary);
    color: var(--primary);
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-header button:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.05);
}

.calendar-grid-header,
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
}

.calendar-grid-header span {
    font-weight: bold;
    color: var(--primary);
    font-size: 0.8rem;
    margin-bottom: 10px;
}

.day {
    padding: 12px 0;
    font-size: 0.9rem;
    cursor: pointer;
    position: relative;
    z-index: 1;
}

.day.selected {
    background: var(--primary);
    color: white;
    border-radius: 50%;
}

/* Range Marking */
.day.in-range {
    background: var(--secondary);
    color: var(--primary);
    border-radius: 0;
}

.day.range-start {
    background: var(--primary) !important;
    color: white !important;
    border-radius: 50% 0 0 50% !important;
}

.day.range-end {
    background: var(--primary) !important;
    color: white !important;
    border-radius: 0 50% 50% 0 !important;
}

/* Ongoing period - haid belum ada tanggal akhir */
.day.ongoing {
    background: rgba(216, 27, 96, 0.15);
    color: var(--primary);
    border-radius: 0;
}

.day.range-start.ongoing {
    background: var(--primary) !important;
    color: white !important;
    border-radius: 50% 0 0 50% !important;
    position: relative;
}

.day.range-start.ongoing::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: white;
    animation: pulse-dot 1.2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: translateX(-50%) scale(1); }
    50% { opacity: 0.3; transform: translateX(-50%) scale(1.6); }
}

/* Action Menu */
.action-menu {
    display: flex;
    justify-content: space-around;
    padding: 0 20px;
}

.action-item {
    border: none;
    background: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.icon-circle {
    width: 60px;
    height: 60px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: var(--transition);
}

.primary-bg {
    background-color: var(--primary);
}

.text-white {
    color: white;
}

.action-item span {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-dark);
}

.action-item:hover .icon-circle {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(216, 27, 96, 0.3);
}

/* AI Recommendations */
.ai-header {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary);
    margin-bottom: 15px;
}

.recommendation-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 15px;
}

.rec-item {
    background: var(--secondary);
    padding: 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Custom Graph */
.chart-wrapper {
    display: flex;
    position: relative;
    padding-left: 20px;
    margin-bottom: 25px; /* Added margin to prevent labels from overlapping next section */
}

.y-axis {
    position: absolute;
    left: 0;
    top: 20px;
    bottom: 0;
    width: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-size: 0.65rem;
    color: var(--text-light);
    text-align: right;
    padding-bottom: 25px;
}

.chart-container {
    flex: 1;
    height: 150px;
    display: flex;
    align-items: flex-end;
    justify-content: space-evenly; /* Better spacing for mobile */
    padding-top: 20px;
    border-bottom: 2px solid var(--secondary);
    gap: 2px; /* Small gap to ensure bars don't touch on very tiny screens */
}

.bar {
    width: 100%; /* Responsive width */
    max-width: 30px; /* Don't get too wide on desktop */
    min-width: 12px; /* Ensure visibility on small screens */
    background: var(--secondary);
    border-radius: 6px 6px 0 0;
    position: relative;
    height: calc(var(--h) * 3);
    transition: var(--transition);
    cursor: pointer; /* Feedback that it's clickable */
}

.bar.active {
    background: var(--primary);
}

.bar-label {
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem; /* Smaller for mobile fit */
    text-align: center;
    color: var(--text-dark);
    line-height: 1.2;
}

.chart-tooltip {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border-radius: 12px;
    padding: 15px;
    width: 200px;
    z-index: 100;
    transition: opacity 0.3s;
}

.chart-tooltip.hidden {
    opacity: 0;
    pointer-events: none;
}

.tooltip-close {
    position: absolute;
    top: 5px;
    right: 10px;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-light);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.animate-fade-in {
    animation: fadeIn 0.8s ease forwards;
}

.animate-slide-up {
    animation: slideUp 0.6s ease forwards;
}

/* Chat Modal */
.chat-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-app);
    z-index: 1000;
    display: flex;
    flex-direction: row;
    transition: transform 0.3s ease;
    overflow: hidden;
}

.chat-modal.hidden {
    transform: translateY(100%);
}

/* Chat Sidebar */
.chat-sidebar {
    width: 260px;
    background-color: var(--card-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, margin-left 0.3s ease;
    z-index: 10;
}

.chat-sidebar.collapsed {
    transform: translateX(-100%);
    margin-left: -260px;
}

@media (max-width: 768px) {
    .chat-sidebar {
        position: absolute;
        height: 100%;
        left: 0;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h3 {
    color: var(--primary);
}

.sidebar-menu {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-btn {
    background: transparent;
    border: none;
    color: var(--text-dark);
    text-align: left;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    transition: background 0.2s;
}

.sidebar-btn:hover {
    background: rgba(255, 107, 129, 0.1);
    color: var(--primary);
}

.sidebar-btn.new-chat-btn {
    background: var(--primary);
    color: white;
    font-weight: 600;
}

.sidebar-btn.new-chat-btn:hover {
    background: #ff4d6d;
    color: white;
}

.sidebar-history {
    padding: 15px;
    flex: 1;
    overflow-y: auto;
}

.sidebar-history h4 {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 10px;
    text-transform: uppercase;
}

.history-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.history-list li {
    padding: 10px 15px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    transition: background 0.2s;
    position: relative;
}

.history-list li i.fa-message {
    font-size: 0.8rem;
    opacity: 0.7;
}

.history-list li .chat-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-list li.active {
    background: var(--secondary);
    color: var(--primary);
}

.history-list li:hover {
    background: var(--bg-app);
}

/* Chat Item Actions */
.chat-item-actions {
    opacity: 0;
    transition: opacity 0.2s;
}

.history-list li:hover .chat-item-actions,
.history-list li.active .chat-item-actions {
    opacity: 1;
}

.action-dots {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 5px;
}

.delete-popup {
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border-radius: 8px;
    z-index: 100;
    padding: 5px;
    display: none;
}

.delete-popup.show {
    display: block;
}

.delete-btn {
    background: none;
    border: none;
    color: #ff4d6d;
    padding: 8px 12px;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 5px;
}

.delete-btn:hover {
    background: #fff0f3;
}

/* Spotlight Walkthrough */
.spotlight-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.72);
    z-index: 5000;
    pointer-events: none; /* Clicks pass through to highlighted element */
    /* No transition on initial clip-path to prevent flickering */
}

.guide-tooltip {
    position: fixed;
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    z-index: 5001;
    max-width: 300px;
    color: #333;
    pointer-events: auto;
}

.guide-tooltip h4 { color: var(--primary); margin-bottom: 10px; }
.guide-tooltip p { font-size: 0.9rem; line-height: 1.5; margin-bottom: 15px; }
.guide-btn-group { display: flex; justify-content: flex-end; gap: 10px; }
.guide-next { 
    background: var(--primary); color: white; border: none; 
    padding: 8px 15px; border-radius: 8px; cursor: pointer; 
}
.guide-skip {
    background: none; border: 1px solid #ddd; 
    padding: 8px 15px; border-radius: 8px; cursor: pointer;
}

/* Chat Sidebar Active */
.chat-sidebar.active {
    transform: translateX(0);
}

/* Chat Main Area */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
}

.icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-dark);
    transition: color 0.2s;
    padding: 5px;
}

.icon-btn:hover {
    color: var(--primary);
}

.chat-header .icon-btn,
.main-header .icon-btn {
    color: white;
}

.sidebar-header .icon-btn {
    color: var(--text-dark);
}


/* Login Overlay */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-app);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease;
}

.login-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.login-card {
    background: var(--card-bg);
    padding: 2.5rem 2rem;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    text-align: center;
    max-width: 90%;
    width: 350px;
}

.login-card h2 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.login-card p {
    color: var(--text-light);
    margin-bottom: 25px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.google-btn {
    background-color: #fff;
    color: #333;
    border: 1px solid #ddd;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
    width: 100%;
    justify-content: center;
}

.google-btn:hover {
    background-color: #f5f5f5;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.google-btn i {
    color: #DB4437;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-profile.hidden {
    display: none;
}

.user-profile img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
}

.logout-btn {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 1.2rem;
    transition: color 0.2s;
}

.logout-btn:hover {
    color: var(--primary-color);
}

.chat-header {
    background-color: var(--primary);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 0 0 15px 15px;
}

.icon-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
}

.chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.welcome-card {
    text-align: center;
    margin: auto;
    color: var(--text-dark);
}

.message {
    max-width: 80%;
    display: flex;
    flex-direction: column;
}

.message.outgoing {
    align-self: flex-end;
}

.message.incoming {
    align-self: flex-start;
}

.bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.4;
    position: relative;
    word-wrap: break-word;
}

.message.outgoing .bubble {
    background-color: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.incoming .bubble {
    background-color: var(--card-bg);
    color: var(--text-dark);
    border: 1px solid var(--secondary);
    border-bottom-left-radius: 4px;
}

.bubble .time {
    display: block;
    font-size: 0.7rem;
    margin-top: 5px;
    opacity: 0.7;
    text-align: right;
}

.chat-input-area {
    padding: 15px 20px;
    background-color: var(--card-bg);
    border-top: 1px solid var(--secondary);
}

.input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    background-color: var(--bg-app);
    padding: 10px 15px;
    border-radius: 25px;
    border: 1px solid var(--secondary);
}

.input-wrapper textarea {
    flex: 1;
    border: none;
    background: none;
    resize: none;
    outline: none;
    color: var(--text-dark);
    font-size: 0.95rem;
    max-height: 100px;
}

.send-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
}

/* User Dropdown Menu */
.user-dropdown {
    position: absolute;
    top: 60px;
    right: 20px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    width: 150px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 100;
    transition: all 0.2s ease;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
}

.user-dropdown.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.dropdown-item {
    padding: 12px 15px;
    background: none;
    border: none;
    color: var(--text-dark);
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: var(--secondary);
    color: var(--primary);
}

/* Profile Modal */
.profile-modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 3000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s;
}

.profile-modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.profile-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    position: relative;
}

.profile-card h3 {
    color: var(--primary);
    margin-bottom: 20px;
}

.profile-close {
    position: absolute;
    top: 20px; right: 20px;
    background: none; border: none;
    font-size: 1.2rem; color: var(--text-light);
    cursor: pointer;
}

.form-group {
    margin-bottom: 15px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 5px;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-app);
    color: var(--text-dark);
}

.save-profile-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: background 0.2s;
}
.save-profile-btn:hover { background: #ff4d6d; }
