/* --- Base & Typography --- */
:root {
    --font-family: 'Nunito', sans-serif;
    --panel-bg: rgba(255, 255, 255, 0.7);
    --text-color: #333;
    --primary-color: #86A8E7;
    --accent-color: #7FDEB5;
    --border-radius-lg: 12px;
    --border-radius-sm: 8px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

body {
    font-family: var(--font-family);
    margin: 0;
    padding: 2rem;
    box-sizing: border-box;
    background: #a7d8f0; /* Fallback color */
    color: var(--text-color);
    transition: background 0.5s ease;
}

h1, h2 {
    font-weight: 700;
    margin-top: 0;
}

h1 {
    font-size: 2rem;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    padding-bottom: 0.5rem;
}

/* --- Layout --- */
.app-container {
    display: flex;
    gap: 2rem;
    height: calc(100vh - 4rem);
}

.panel {
    padding: 2rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    background-color: var(--panel-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: background-color 0.5s ease;
    z-index: 10;
}

.task-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.garden-panel {
    flex: 2;
    display: flex;
    flex-direction: column;
}

header {
    margin-bottom: 1.5rem;
}

/* --- Task Manager --- */
#task-form {
    display: flex;
    margin-bottom: 1.5rem;
}

#task-input {
    flex-grow: 1;
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
}

#task-form button {
    padding: 0.75rem 1.5rem;
    border: none;
    background-color: var(--primary-color);
    color: white;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    margin-left: 0.5rem;
    transition: background-color 0.3s;
}

#task-form button:hover {
    background-color: #6c94d8;
}

#task-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    flex-grow: 1;
}

#task-list li {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--border-radius-sm);
    transition: all 0.3s;
}

#task-list li.completed {
    text-decoration: line-through;
    opacity: 0.6;
}

#task-list li input[type="checkbox"] {
    margin-right: 0.75rem;
    width: 18px;
    height: 18px;
}

#task-list li .delete-btn {
    margin-left: auto;
    background: none;
    border: none;
    color: #ff6b6b;
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.5;
    transition: opacity 0.3s;
}

#task-list li:hover .delete-btn {
    opacity: 1;
}


/* --- Garden --- */
.garden-panel header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#garden {
    flex-grow: 1;
    position: relative;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    background: transparent;
}

/* --- Background Scene --- */
.sky {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60%;
    background: linear-gradient(to bottom, #a7d8f0, #cce7f5);
    z-index: 1;
}

.cloud {
    position: absolute;
    background: white;
    border-radius: 50px;
    opacity: 0.9;
}
.cloud-1 {
    top: 15%;
    left: 10%;
    width: 120px;
    height: 40px;
}
.cloud-2 {
    top: 25%;
    right: 15%;
    width: 150px;
    height: 50px;
}
.cloud::before, .cloud::after {
    content: '';
    position: absolute;
    background: white;
    border-radius: 50%;
}
.cloud-1::before { top: -20px; left: 20px; width: 50px; height: 50px; }
.cloud-1::after { top: -10px; right: 30px; width: 40px; height: 40px; }
.cloud-2::before { top: -30px; left: 30px; width: 70px; height: 70px; }
.cloud-2::after { top: -20px; right: 20px; width: 60px; height: 60px; }


.hills {
    position: absolute;
    bottom: 10%;
    left: 0;
    width: 100%;
    height: 40%;
    z-index: 2;
}
.hill {
    position: absolute;
    bottom: 0;
    border-radius: 50% 50% 0 0;
}
.hill-1 {
    left: -20%;
    width: 80%;
    height: 80%;
    background: #c5dcb7;
}
.hill-2 {
    right: -15%;
    width: 70%;
    height: 60%;
    background: #b3d0a7;
}

.ground {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 15%;
    background: #9fcc93;
    z-index: 3;
}


.garden-controls {
    margin-top: 1rem;
    text-align: center;
}

.garden-controls button, .theme-btn {
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--primary-color);
    background-color: transparent;
    color: var(--primary-color);
    cursor: pointer;
    margin: 0 0.25rem;
    transition: all 0.3s;
}

.garden-controls button:hover, .theme-btn:hover, .theme-btn.active {
    background-color: var(--primary-color);
    color: white;
}

/* --- New Flower Styles --- */
.garden-element {
    position: absolute;
    bottom: 5%;
    transform-origin: bottom center;
    z-index: 7;
    transition: transform 0.5s ease-out;
}

.garden-element.grow {
    animation: grow-animation 1.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.garden-element.shrink {
    transform: scale(0);
}

@keyframes grow-animation {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

.flower-daisy {
    width: 80px;
    height: 120px;
    position: relative;
}

.flower-daisy .stem {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 80px;
    background: #4a7c4a;
    border-radius: 3px;
}

.flower-daisy .leaf {
    position: absolute;
    bottom: 20px;
    width: 30px;
    height: 25px;
    background: #6a9a6a;
    border-radius: 50% 0;
}

.flower-daisy .leaf.left {
    left: 0;
    transform: rotate(20deg);
}

.flower-daisy .leaf.right {
    right: 0;
    transform: rotate(-20deg) scaleX(-1);
}

.flower-head {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
}

.flower-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background: #ffdd57;
    border-radius: 50%;
    z-index: 2;
}

.petal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* This is for each individual petal piece */
.petal > div {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 20px;
    margin-left: -7px;
    margin-top: -22px; /* Controls distance from center */
    border-radius: 50%;
    transform-origin: center 22px; /* PIVOT POINT: (width/2) (margin-top) */
}

/* Petal Colors */
.petal-pink > div { background-color: #ffaccb; }
.petal-yellow > div { background-color: #fff38a; }
.petal-purple > div { background-color: #d9abff; }
.petal-white > div { background-color: #ffffff; }

/* Position and rotate each petal */
.petal .p1 { transform: rotate(0deg); }
.petal .p2 { transform: rotate(45deg); }
.petal .p3 { transform: rotate(90deg); }
.petal .p4 { transform: rotate(135deg); }
.petal .p5 { transform: rotate(180deg); }
.petal .p6 { transform: rotate(225deg); }
.petal .p7 { transform: rotate(270deg); }
.petal .p8 { transform: rotate(315deg); }

/* --- Fantasy Forest Theme --- */

body[data-theme="fantasy"] {
    --primary-color: #9e7fde;
    --accent-color: #d9abff;
}

body[data-theme="fantasy"] .cloud,
body[data-theme="fantasy"] .hills {
    display: none;
}

.fantasy-scene {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
    /* Background moved to #garden */
}

body[data-theme="fantasy"] #garden {
    background: linear-gradient(to bottom, #1a0c2e, #3a1a5c);
}

body[data-theme="fantasy"] .fantasy-scene {
    opacity: 1;
}

body[data-theme="fantasy"] .sky {
    background: none;
}

body[data-theme="fantasy"] .ground {
    background: #2c1f3a;
}

.fantasy-moon {
    position: absolute;
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #f7f2d7;
    box-shadow: 0 0 40px rgba(247, 242, 215, 0.7), 
                0 0 80px rgba(247, 242, 215, 0.5),
                inset 0 0 10px rgba(255,255,255,0.5);
}

.fantasy-trees {
    position: absolute;
    bottom: 15%;
    left: 0;
    width: 100%;
    height: 50%;
    z-index: 6;
}

.tree {
    position: absolute;
    bottom: 0;
    width: 10px; /* Trunk width */
    background: #2c1f3a;
    transform-origin: bottom center;
}

.tree::after {
    content: '';
    position: absolute;
    bottom: 100%; /* Position the foliage above the trunk */
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 120px;
    background: #2c1f3a;
    border-radius: 50% 50% 30% 30% / 60% 60% 40% 40%;
    box-shadow: 0 -10px 0 #2c1f3a, 20px -25px 0 5px #2c1f3a, -20px -25px 0 5px #2c1f3a;
}

/* Individual tree styles for variety */
.tree-1 {
    left: 5%;
    height: 150px;
    transform: scale(0.8);
}
.tree-1::after {
    width: 100px;
    height: 150px;
}

.tree-2 {
    left: 20%;
    height: 180px;
    transform: scale(1);
}
.tree-2::after {
    border-radius: 40% 60% 40% 40% / 70% 70% 30% 30%;
    box-shadow: 0 -15px 0 #2c1f3a, 25px -30px 0 8px #2c1f3a, -25px -30px 0 8px #2c1f3a;
}

.tree-3 {
    left: 35%;
    height: 120px;
    transform: scale(0.7);
}
.tree-3::after {
    width: 70px;
    height: 110px;
    box-shadow: 0 -8px 0 #2c1f3a, 15px -20px 0 3px #2c1f3a, -15px -20px 0 3px #2c1f3a;
}

.tree-4 {
    right: 5%;
    height: 160px;
    transform: scale(0.9);
}
.tree-4::after {
    width: 90px;
    height: 140px;
    border-radius: 60% 40% 50% 50% / 70% 70% 30% 30%;
}

.tree-5 {
    right: 25%;
    height: 200px;
    transform: scale(1.1);
}
.tree-5::after {
    width: 110px;
    height: 160px;
    box-shadow: 0 -20px 0 #2c1f3a, 30px -40px 0 10px #2c1f3a, -30px -40px 0 10px #2c1f3a;
}

.tree-6 {
    right: 40%;
    height: 140px;
    transform: scale(0.8);
}

/* --- Stars --- */
@keyframes flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

.stars-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60%; /* Cover the sky area */
    z-index: 5;
}

.star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: white;
    border-radius: 50%;
    animation: flicker 3s infinite alternate;
}

/* Random star positions and animation delays */
.star:nth-child(1) { top: 10%; left: 5%; animation-delay: 0.1s; }
.star:nth-child(2) { top: 50%; left: 10%; animation-delay: 0.5s; }
.star:nth-child(3) { top: 20%; left: 15%; animation-delay: 1.2s; }
.star:nth-child(4) { top: 40%; left: 20%; animation-delay: 0.8s; }
.star:nth-child(5) { top: 60%; left: 25%; animation-delay: 0.3s; }
.star:nth-child(6) { top: 15%; left: 30%; animation-delay: 1.5s; }
.star:nth-child(7) { top: 35%; left: 35%; animation-delay: 0.2s; }
.star:nth-child(8) { top: 55%; left: 40%; animation-delay: 1s; }
.star:nth-child(9) { top: 5%; left: 45%; animation-delay: 0.7s; }
.star:nth-child(10) { top: 25%; left: 50%; animation-delay: 1.3s; }
.star:nth-child(11) { top: 45%; left: 55%; animation-delay: 0.4s; }
.star:nth-child(12) { top: 65%; left: 60%; animation-delay: 1.1s; }
.star:nth-child(13) { top: 10%; left: 65%; animation-delay: 0.6s; }
.star:nth-child(14) { top: 30%; left: 70%; animation-delay: 1.4s; }
.star:nth-child(15) { top: 50%; left: 75%; animation-delay: 0.9s; }
.star:nth-child(16) { top: 70%; left: 80%; animation-delay: 0.1s; }
.star:nth-child(17) { top: 20%; left: 85%; animation-delay: 1.6s; }
.star:nth-child(18) { top: 40%; left: 90%; animation-delay: 0.3s; }
.star:nth-child(19) { top: 60%; left: 95%; animation-delay: 1s; }
.star:nth-child(20) { top: 5%; left: 98%; animation-delay: 0.5s; }
.star:nth-child(21) { top: 15%; left: 2%; animation-delay: 1.2s; }
.star:nth-child(22) { top: 35%; left: 8%; animation-delay: 0.8s; }
.star:nth-child(23) { top: 55%; left: 12%; animation-delay: 0.2s; }
.star:nth-child(24) { top: 25%; left: 18%; animation-delay: 1.5s; }
.star:nth-child(25) { top: 45%; left: 22%; animation-delay: 0.4s; }
.star:nth-child(26) { top: 65%; left: 28%; animation-delay: 1.1s; }
.star:nth-child(27) { top: 10%; left: 32%; animation-delay: 0.6s; }
.star:nth-child(28) { top: 30%; left: 38%; animation-delay: 1.4s; }
.star:nth-child(29) { top: 50%; left: 42%; animation-delay: 0.9s; }
.star:nth-child(30) { top: 70%; left: 48%; animation-delay: 0.1s; }
.star:nth-child(31) { top: 20%; left: 52%; animation-delay: 1.6s; }
.star:nth-child(32) { top: 40%; left: 58%; animation-delay: 0.3s; }
.star:nth-child(33) { top: 60%; left: 62%; animation-delay: 1s; }
.star:nth-child(34) { top: 5%; left: 68%; animation-delay: 0.5s; }
.star:nth-child(35) { top: 25%; left: 72%; animation-delay: 1.3s; }
.star:nth-child(36) { top: 45%; left: 78%; animation-delay: 0.4s; }
.star:nth-child(37) { top: 65%; left: 82%; animation-delay: 1.1s; }
.star:nth-child(38) { top: 10%; left: 88%; animation-delay: 0.6s; }
.star:nth-child(39) { top: 30%; left: 92%; animation-delay: 1.4s; }
.star:nth-child(40) { top: 50%; left: 96%; animation-delay: 0.9s; }
.star:nth-child(41) { top: 70%; left: 3%; animation-delay: 0.2s; }
.star:nth-child(42) { top: 15%; left: 9%; animation-delay: 1.5s; }
.star:nth-child(43) { top: 35%; left: 14%; animation-delay: 0.8s; }
.star:nth-child(44) { top: 55%; left: 19%; animation-delay: 0.1s; }
.star:nth-child(45) { top: 25%; left: 24%; animation-delay: 1.2s; }
.star:nth-child(46) { top: 45%; left: 29%; animation-delay: 0.7s; }
.star:nth-child(47) { top: 65%; left: 34%; animation-delay: 1.6s; }
.star:nth-child(48) { top: 10%; left: 39%; animation-delay: 0.3s; }
.star:nth-child(49) { top: 30%; left: 44%; animation-delay: 1s; }
.star:nth-child(50) { top: 50%; left: 49%; animation-delay: 0.5s; }