/* ===== CUTE GARDEN THEME ===== */
:root {
    --primary-green: #88d498;
    --secondary-green: #c6dabf;
    --accent-color: #ff9aa2;
    /* Pastel Red/Pink */
    --accent-secondary: #c7ceea;
    /* Pastel Purple/Blue */
    --text-color: #555;
    --bg-gradient-start: #f3f9f3;
    --bg-gradient-end: #eafbe4;
    --card-bg: rgba(255, 255, 255, 0.9);
    --shadow-soft: 0 10px 25px rgba(136, 212, 152, 0.2);
    --font-main: 'Quicksand', 'Noto Sans TC', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background Pattern (Subtle Polka Dots or soft shapes) */
.background-pattern {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(#88d498 1px, transparent 1px);
    background-size: 30px 30px;
    opacity: 0.15;
    z-index: -1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;

}

.header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    color: #4a7c59;
    margin-bottom: 5px;
}

.header h1 i {
    color: var(--primary-green);
    animation: bounce 2s infinite;
}

.last-updated {
    font-size: 0.9rem;
    color: #888;
    background: white;
    padding: 5px 15px;
    border-radius: 20px;
    display: inline-block;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

/* Tab Navigation */
.sky-controls {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0 10px;
    margin-bottom: 20px;
    position: relative;
    z-index: 50;
    /* Ensure controls are clickable */
}

.tab-navigation.embedded {
    display: flex;
    gap: 10px;
    margin: 0;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.7);
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 0.9rem;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(2px);
}

.tab-btn i {
    font-size: 1rem;
}

.tab-btn.active {
    background: white;
    color: var(--primary-green);
    box-shadow: 0 4px 10px rgba(136, 212, 152, 0.4);
    transform: translateY(-1px);
    font-weight: 700;
}

.tab-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.9);
}

.last-updated.embedded {
    font-size: 0.75rem;
    color: #555;
    background: rgba(255, 255, 255, 0.6);
    padding: 5px 12px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 5px;
    backdrop-filter: blur(2px);
    margin: 0;
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
    width: 100%;
    /* Full width */
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Sky and Sun */
.sky-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px 20px 50px 20px;
    background: linear-gradient(to bottom, #87CEEB 0%, rgba(255, 255, 255, 0) 100%);
    border-radius: 20px 20px 0 0;
    margin-bottom: -40px;
    /* Overlap with garden */
    position: relative;
    z-index: 1;
}

.sun-visual {
    width: 150px;
    height: 150px;
    margin-bottom: 20px;
    position: relative;
    transition: all 1s ease;
}

.sun-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.sun-rays {
    transform-origin: center;
    animation: rotateRays 10s linear infinite;
    opacity: 0.8;
}

@keyframes rotateRays {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.sun-visual.night .sun-rays {
    display: none;
}

/* Garden Scene */
.garden-scene {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    /* Align plants at the bottom */
    gap: 40px;
    flex-wrap: wrap;
    padding: 20px;
    min-height: 400px;
    /* Space for plants to grow */
    position: relative;
    /* Ground/Soil illusion */
    border-bottom: 10px solid #8d6e63;
    border-radius: 5px;
    margin-bottom: 40px;
    background: linear-gradient(to top, rgba(255, 255, 255, 0.5), transparent);
}

.plant-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: 250px;
}

/* Plant Visuals & Animation */
.plant-visual {
    width: 200px;
    height: 300px;
    position: relative;
    transition: all 0.5s ease;
}

.plant-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

/* Base Plant Styles */
.stem {
    transform-origin: bottom center;
    transition: d 1s ease;
}

.leaves use {
    transform-origin: 100px 150px;
    /* Pivot around stem generally */
    transition: all 1s ease-in-out;
}

/* Faces */
.face {
    transition: all 0.5s ease;
    opacity: 0.8;
}

/* Droopy/Thirsty State (Applied via JS class .droopy) */
.plant-visual.droopy .stem {
    /* CSS cannot animate path 'd' simply without SMIL or complex keyframes, 
       but we can use transform to bend it */
    transform: rotate(10deg);
}

.plant-visual.droopy .leaves use {
    transform: rotate(20deg) translateY(20px) !important;
    filter: grayscale(0.5);
    /* Withered look */
}

.plant-visual.droopy .face path {
    /* Sad mouth - invert curve via rotation/scale or just hide happy mouth and show sad one */
    /* Simple CSS trick: rotate 180deg */
    transform: rotate(180deg);
    transform-origin: center;
}

/* Happy State */
.plant-visual.happy {
    animation: sway 4s ease-in-out infinite;
}

@keyframes sway {

    0%,
    100% {
        transform: rotate(0deg);
    }

    50% {
        transform: rotate(2deg);
    }
}

/* Status Bubble */
.plant-status-bubble {
    position: absolute;
    top: 50px;
    right: -20px;
    background: white;
    padding: 8px 15px;
    border-radius: 15px;
    border-bottom-left-radius: 0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10;
}

@keyframes popIn {
    from {
        transform: scale(0);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Mini Info Card */
.mini-card {
    background: white;
    padding: 15px;
    border-radius: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    text-align: center;
    width: 100%;
    margin-top: 10px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.mini-card:hover {
    border-color: var(--primary-green);
    transform: translateY(-5px);
}

.mini-card h3 {
    font-size: 1.1rem;
    margin-bottom: 5px;
    color: var(--text-color);
}

.moisture-text {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-green);
    margin-bottom: 10px;
}

.cute-select {
    padding: 8px 12px;
    border-radius: 15px;
    border: 1px solid #eee;
    font-family: var(--font-main);
    background: #f9f9f9;
    cursor: pointer;
    font-size: 0.9rem;
    width: 100%;
    outline: none;
}

/* Environment Summary Bubble */
.env-summary {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.env-chip {
    background: rgba(255, 255, 255, 0.8);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #666;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 8px;
}

.env-chip i {
    color: #ffd54f;
    /* Yellow for sun/light */
}

/* Charts */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.chart-card {
    background: white;
    padding: 20px;
    border-radius: 25px;
    box-shadow: var(--shadow-soft);
}

.chart-card h2 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-card h2 i {
    color: var(--primary-green);
}

/* Responsive */
@media (max-width: 600px) {
    .header h1 {
        font-size: 1.8rem;
    }

    /* Mobile Horizontal Scroll */
    .garden-scene {
        padding: 10px;
        padding-left: 20px;
        /* Start padding */
        gap: 20px;

        display: flex;
        justify-content: flex-start;
        /* Align start to allow scroll */
        overflow-x: auto;
        flex-wrap: nowrap;
        /* Prevent wrapping */
        scroll-snap-type: x mandatory;

        /* Hide scrollbar */
        -ms-overflow-style: none;
        /* IE and Edge */
        scrollbar-width: none;
        /* Firefox */
    }

    .garden-scene::-webkit-scrollbar {
        display: none;
    }

    .plant-container {
        min-width: 85%;
        /* Card width */
        scroll-snap-align: center;
        margin-bottom: 0;
    }
}