@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap');

:root {
    --primary: #FF6B6B; /* Playful Red/Pink */
    --secondary: #4ECDC4; /* Teal */
    --bg: #F7F9FC;
    --card: #FFFFFF;
    --text: #2D3436;
    --water: #45B7D1;
    --accent: #FFE66D;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Nunito', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 20px 20px 80px 20px; /* Extra padding bottom for nav */
    display: flex;
    justify-content: center;
}

.container {
    width: 100%;
    max-width: 500px;
}

h1 {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 20px;
    text-align: center;
    color: var(--primary);
}

.card {
    background: var(--card);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.02);
}

.card h2 {
    font-size: 20px;
    margin-top: 0;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #555;
}

.stat-value {
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 15px;
    color: var(--text);
}

.btn-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 15px;
    border-radius: 15px;
    font-size: 16px;
    font-weight: 700;
    font-family: 'Nunito', sans-serif;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

button:active {
    transform: scale(0.98);
}

button.secondary {
    background: var(--water);
}

button.outline {
    background: transparent;
    border: 2px solid #eee;
    color: #888;
    box-shadow: none;
    padding: 8px 15px;
    font-size: 14px;
}

input[type="number"], input[type="text"], input[type="time"], input[type="date"] {
    width: 100%;
    padding: 15px;
    border-radius: 15px;
    border: 2px solid #EEF2F5;
    font-size: 18px;
    margin-bottom: 15px;
    outline: none;
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    transition: border-color 0.2s;
    background: #fff;
    color: var(--text);
}

textarea {
    width: 100%;
    padding: 15px;
    border-radius: 15px;
    border: 2px solid #EEF2F5;
    font-size: 16px;
    margin-bottom: 15px;
    outline: none;
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    transition: border-color 0.2s;
    resize: vertical;
    min-height: 100px;
}

textarea:focus, input:focus {
    border-color: var(--secondary);
}

/* History Styles */
.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #F0F0F0;
}

.history-item:last-child {
    border-bottom: none;
}

.date-label {
    color: #A0A0A0;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}

/* Navigation Tabs */
.nav-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 15px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    z-index: 100;
}

.nav-item {
    color: #CCC;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: color 0.2s;
}

.nav-item.active {
    color: var(--primary);
}

.nav-icon {
    font-size: 24px;
    margin-bottom: 4px;
    display: block;
}

/* Views */
.view {
    display: none;
}
.view.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: white;
    width: 90%;
    max-width: 400px;
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* Habit Heatmap */
.heatmap-wrapper {
    display: flex;
    align-items: flex-end; /* Align day labels with grid */
    gap: 5px;
}
.heatmap-days {
    display: grid;
    grid-template-rows: repeat(7, 12px);
    gap: 3px;
    padding-top: 20px; /* Offset for month labels */
    margin-right: 5px;
}
.heatmap-day-label {
    font-size: 10px;
    color: #959DA5;
    line-height: 12px;
    height: 12px;
    visibility: hidden; /* Hide some days */
}
.heatmap-day-label.visible {
    visibility: visible;
}
.heatmap-scroll-area {
    overflow-x: auto;
    flex: 1;
}
.heatmap-months {
    position: relative;
    height: 15px;
    margin-bottom: 5px;
    white-space: nowrap;
}
.heatmap-month-label {
    position: absolute;
    font-size: 10px;
    color: #959DA5;
    font-weight: 600;
}
.heatmap-grid {
    display: grid;
    grid-template-rows: repeat(7, 12px);
    grid-auto-flow: column;
    gap: 3px;
}
.heatmap-cell {
    width: 12px;
    height: 12px;
    background-color: #ebedf0;
    border-radius: 2px;
}
.heatmap-cell.level-1 { background-color: #9be9a8; }
.heatmap-cell.level-2 { background-color: #40c463; }
.heatmap-cell.level-3 { background-color: #30a14e; }
.heatmap-cell.level-4 { background-color: #216e39; }

/* Filter Inputs */
.filter-row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
}
.filter-row input {
    margin-bottom: 0;
    padding: 10px;
    font-size: 14px;
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    cursor: pointer;
    z-index: 90;
}
/* Notepad Styles */
.note-card {
    background: white;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid #eee;
    margin-bottom: 10px;
    cursor: pointer;
    transition: transform 0.1s;
}
.note-card:active { transform: scale(0.98); }
.note-title { font-weight: 700; font-size: 16px; margin-bottom: 5px; }
.note-preview { font-size: 14px; color: #666; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.note-tag {
    display: inline-block;
    background: #E3F2FD;
    color: #1976D2;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-bottom: 5px;
    text-transform: uppercase;
    font-weight: 700;
}
#editor-container { height: 250px; background: white; border-radius: 0 0 12px 12px; }
.ql-toolbar { border-radius: 12px 12px 0 0; background: #f8f8f8; }
.ql-container { border-radius: 0 0 12px 12px; font-family: 'Nunito', sans-serif; font-size: 16px; }

/* Journal Archive */
.journal-entry { border-bottom: 1px solid #eee; padding: 15px 0; }
.journal-entry:last-child { border-bottom: none; }
.journal-date { font-weight: 800; color: var(--primary); margin-bottom: 8px; }
.journal-section { margin-bottom: 6px; }
.journal-label { font-size: 12px; color: #888; font-weight: 700; text-transform: uppercase; }
.reminder-card { border-left: 5px solid #FF6B6B; background: #fff5f5; }

.habit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}
.habit-btn {
    background: #f0f0f0;
    color: #555;
    padding: 12px;
    border-radius: 12px;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}
.habit-btn.completed {
    background: #E3FCEF;
    color: #006644;
    border-color: #36B37E;
}
.settings-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f9f9f9;
    margin-bottom: 8px;
    border-radius: 8px;
}
.delete-btn {
    background: #FF5630;
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 6px;
    color: white;
    border: none;
    cursor: pointer;
}