/* Base styles */
body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 20px;
    background: linear-gradient(135deg, #74b9ff, #a29bfe);
    color: #333;
    line-height: 1.6;
    transition: background 0.3s, color 0.3s;
}

body.dark {
    background: linear-gradient(135deg, #2d3436, #636e72);
    color: #ddd;
}

header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
}

#theme-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #6c5ce7;
    color: #fff;
    border: none;
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.3s;
}

#theme-toggle:hover {
    background: #a29bfe;
}

.grid-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: background 0.3s;
}

body.dark main {
    background: #34495e;
}

/* Form styles */
#habit-form, #todo-form {
    display: grid;
    grid-template-columns: 1fr 1fr 100px auto;
    gap: 10px;
    margin-bottom: 20px;
}

#habit-goal {
    width: 100px;
}

button {
    padding: 10px 15px;
    background: #6c5ce7;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

button:hover {
    background: #a29bfe;
    transform: scale(1.05);
}

/* Fitness Column */
#fitness-column {
    background: #e8f5e8;
    padding: 15px;
    border-radius: 8px;
}

body.dark #fitness-column {
    background: #2c3e50;
}

.fitness-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0;
    padding: 10px;
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

body.dark .fitness-item {
    background: #34495e;
}

#water-tracker {
    display: flex;
    align-items: center;
    gap: 10px;
}

#water-meter {
    font-weight: bold;
    color: #00b894;
}

/* To-Do List Box */
#todo-section {
    background: #e8f5e8;
    padding: 15px;
    border-radius: 8px;
}

body.dark #todo-section {
    background: #2c3e50;
}

/* Habit cards */
.habit-card, .todo-item {
    background: #f8f9fa;
    padding: 15px;
    margin: 10px 0;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    animation: slideIn 0.5s;
    cursor: grab;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

body.dark .habit-card, body.dark .todo-item {
    background: #2c3e50;
}

.habit-card.completed, .todo-item.completed {
    background: #d4edda;
    border-left: 5px solid #28a745;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

body.dark .habit-card.completed, body.dark .todo-item.completed {
    background: #27ae60;
}

.category-icon {
    font-size: 1.5em;
    margin-right: 10px;
}

.streak {
    font-weight: bold;
    color: #e17055;
}

.goal-progress {
    font-size: 0.9em;
    color: #666;
}

/* Progress bar */
#progress-bar {
    width: 100%;
    height: 20px;
    background: #ddd;
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
}

#progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00b894, #00cec9);
    width: 0%;
    transition: width 0.5s;
}

/* Completion Circle */
#completion-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: conic-gradient(#00b894 0% 0%, #ddd 0% 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #fff;
    margin: 10px auto;
    transition: background 0.5s;
}

body.dark #completion-circle {
    background: conic-gradient(#00cec9 0% 0%, #34495e 0% 100%);
}

/* Calendar grid */
#calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    margin-top: 10px;
}

.day {
    padding: 10px;
    text-align: center;
    border-radius: 5px;
    background: #f1f2f6;
    transition: background 0.3s;
}

body.dark .day {
    background: #34495e;
}

.day.completed {
    background: #00b894;
    color: #fff;
}

/* Analytics */
#analytics-section p {
    font-size: 1.1em;
}

/* Affirmation */
#affirmation-section {
    text-align: center;
    margin-top: 20px;
}

#affirmation-text {
    font-style: italic;
    color: #6c5ce7;
}

/* Modal for journal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    width: 80%;
    max-width: 400px;
}

body.dark .modal-content {
    background: #34495e;
}

textarea {
    width: 100%;
    height: 80px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

/* Confetti animation */
.confetti {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #ffd700;
    animation: fall 3s linear infinite;
}

@keyframes fall {
    to { transform: translateY(100vh) rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .grid-container {
        grid-template-columns: 1fr;
    }
    #habit-form, #todo-form {
        grid-template-columns: 1fr;
    }
    .habit-card, .todo-item {
        flex-direction: column;
        align-items: flex-start;
    }
}