/* ==============================================
   Plant Care Scheduler — style.css
   Botanical Garden Aesthetic · Dark + Light modes
   ============================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:wght@700&display=swap');

/* ── Tokens ─────────────────────────────────── */
:root {
    --primary: #00B894;
    --primary-d: #00897B;
    --secondary: #55EFC4;
    --accent: #D4A574;
    --accent-d: #B8856A;
    --bg: #0D1A0F;
    --bg2: #122016;
    --bg3: #1a2d1e;
    --surface: rgba(26, 45, 30, 0.75);
    --border: rgba(0, 184, 148, 0.18);
    --border-h: rgba(0, 184, 148, 0.45);
    --text: #E8F5E9;
    --text-muted: #81A588;
    --radius: 16px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
    --glow: 0 0 24px rgba(0, 184, 148, 0.2);
    --water: #48CAE4;
    --fertilize: #A8D8A8;
    --repot: #D4A574;
    --healthy: #00B894;
    --warning: #F9CA24;
    --critical: #EA2027;
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Organic mesh background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 70% 60% at 15% 0%, rgba(0, 184, 148, 0.10) 0%, transparent 65%),
        radial-gradient(ellipse 50% 45% at 85% 90%, rgba(85, 239, 196, 0.07) 0%, transparent 65%),
        radial-gradient(ellipse 60% 40% at 50% 50%, rgba(212, 165, 116, 0.04) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* ── Layout ──────────────────────────────────── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 1;
}

/* ── Header ──────────────────────────────────── */
header {
    padding: 24px 0 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 28px;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-leaf {
    font-size: 2.2rem;
    line-height: 1;
    filter: drop-shadow(0 0 8px rgba(0, 184, 148, 0.5));
    animation: sway 4s ease-in-out infinite;
}

@keyframes sway {

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

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

.logo h1 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo .tagline {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ── Buttons ─────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-d));
    color: #fff;
    box-shadow: 0 2px 12px rgba(0, 184, 148, 0.35);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(0, 184, 148, 0.5);
}

.btn-secondary {
    background: var(--bg3);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--border-h);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent), var(--accent-d));
    color: #1a1a1a;
    font-weight: 600;
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    color: var(--text);
    border-color: var(--border-h);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.78rem;
}

.btn-danger {
    background: rgba(234, 32, 39, 0.15);
    color: #ff6b6b;
    border: 1px solid rgba(234, 32, 39, 0.3);
}

.btn-danger:hover {
    background: rgba(234, 32, 39, 0.25);
}

/* ── Summary Stats ────────────────────────────── */
.stats-row {
    display: flex;
    gap: 14px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.stat-chip {
    flex: 1;
    min-width: 100px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: blur(10px);
    text-align: center;
    transition: transform 0.2s;
}

.stat-chip:hover {
    transform: translateY(-2px);
    box-shadow: var(--glow);
}

.stat-chip .num {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
}

.stat-chip .lbl {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px;
}

.stat-water {
    border-top: 3px solid var(--water);
}

.stat-water .num {
    color: var(--water);
}

.stat-fert {
    border-top: 3px solid var(--fertilize);
}

.stat-fert .num {
    color: var(--fertilize);
}

.stat-repot {
    border-top: 3px solid var(--repot);
}

.stat-repot .num {
    color: var(--repot);
}

.stat-total {
    border-top: 3px solid var(--primary);
}

.stat-total .num {
    color: var(--primary);
}

/* ── Main Grid ───────────────────────────────── */
.main-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 900px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Sidebar ─────────────────────────────────── */
.sidebar-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    backdrop-filter: blur(12px);
    margin-bottom: 20px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── Plant List ──────────────────────────────── */
.plant-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.plant-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg3);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.18s ease;
}

.plant-item:hover,
.plant-item.active {
    border-color: var(--border-h);
    background: rgba(0, 184, 148, 0.08);
    box-shadow: var(--glow);
}

.plant-emoji {
    font-size: 1.6rem;
    line-height: 1;
}

.plant-info {
    flex: 1;
    min-width: 0;
}

.plant-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.plant-species {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-style: italic;
}

.plant-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dot-healthy {
    background: var(--healthy);
    box-shadow: 0 0 6px var(--healthy);
}

.dot-warning {
    background: var(--warning);
    box-shadow: 0 0 6px var(--warning);
}

.dot-critical {
    background: var(--critical);
    box-shadow: 0 0 6px var(--critical);
}

/* ── Plant Detail ────────────────────────────── */
.plant-detail-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: blur(12px);
    overflow: hidden;
}

.detail-hero {
    padding: 24px 24px 20px;
    background: linear-gradient(135deg, rgba(0, 184, 148, 0.08), rgba(85, 239, 196, 0.04));
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 20px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.detail-emoji {
    font-size: 3.5rem;
    line-height: 1;
}

.detail-meta {
    flex: 1;
    min-width: 0;
}

.detail-name {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    color: var(--text);
    line-height: 1.2;
}

.detail-species {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.9rem;
    margin: 4px 0 8px;
}

.detail-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tag {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 500;
    background: rgba(0, 184, 148, 0.12);
    color: var(--secondary);
    border: 1px solid rgba(0, 184, 148, 0.2);
}

.tag-accent {
    background: rgba(212, 165, 116, 0.12);
    color: var(--accent);
    border-color: rgba(212, 165, 116, 0.2);
}

.detail-actions {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    flex-wrap: wrap;
}

/* ── Schedule Grid ───────────────────────────── */
.schedule-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

@media (max-width: 600px) {
    .schedule-grid {
        grid-template-columns: 1fr;
    }
}

.schedule-card {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
    transition: transform 0.18s, box-shadow 0.18s;
}

.schedule-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.schedule-icon {
    font-size: 1.6rem;
    margin-bottom: 8px;
}

.schedule-type {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.schedule-days {
    font-size: 1.3rem;
    font-weight: 700;
}

.schedule-next {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.schedule-card.overdue .schedule-days {
    color: var(--critical);
}

.schedule-card.due-soon .schedule-days {
    color: var(--warning);
}

.schedule-card.ok .schedule-days {
    color: var(--primary);
}

.quick-log {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.quick-log-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-right: 4px;
}

/* ── Activity Log ────────────────────────────── */
.activity-log {
    padding: 20px;
}

.log-entry {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 184, 148, 0.08);
}

.log-entry:last-child {
    border-bottom: none;
}

.log-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
}

.log-water {
    background: var(--water);
}

.log-fertilize {
    background: var(--fertilize);
}

.log-repot {
    background: var(--repot);
}

.log-note {
    background: var(--secondary);
}

.log-content {
    flex: 1;
    min-width: 0;
}

.log-title {
    font-size: 0.875rem;
    font-weight: 500;
}

.log-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.log-note-text {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 3px;
}

/* ── Care Tips Panel ─────────────────────────── */
.tips-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 16px;
}

.tip-item {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.tip-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.tip-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 3px;
}

.tip-text {
    font-size: 0.8rem;
    color: var(--text);
    line-height: 1.4;
}

/* ── Seasonal Banner ─────────────────────────── */
.seasonal-banner {
    margin: 0 20px 16px;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(212, 165, 116, 0.1), rgba(212, 165, 116, 0.05));
    border: 1px solid rgba(212, 165, 116, 0.25);
    border-radius: var(--radius-sm);
    font-size: 0.83rem;
    display: flex;
    gap: 10px;
    align-items: center;
}

.seasonal-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.seasonal-text {
    color: var(--accent);
}

/* ── Modal ────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fade-in 0.2s ease;
}

.modal-overlay.hidden {
    display: none;
}

.modal {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
    animation: slide-up 0.25s ease;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
}

@keyframes slide-up {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.modal-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    color: var(--primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
}

.modal-close:hover {
    color: var(--text);
}

/* ── Form ────────────────────────────────────── */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 480px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group.full {
    grid-column: 1 / -1;
}

label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

input,
select,
textarea {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 0.875rem;
    padding: 10px 12px;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 184, 148, 0.12);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* ── Empty State ─────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-muted);
}

.empty-state .ei {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.875rem;
    max-width: 380px;
    margin: 0 auto;
}

/* ── Water Amount Calculator ─────────────────── */
.water-calc {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 0.84rem;
}

.water-calc label {
    color: var(--text-muted);
    font-weight: 600;
}

.water-calc select {
    max-width: 160px;
    padding: 6px 10px;
}

.water-result {
    color: var(--water);
    font-weight: 600;
}

/* ── Photo Journal ───────────────────────────── */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.photo-thumb {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    background: var(--bg3);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s;
    position: relative;
}

.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-thumb:hover {
    border-color: var(--border-h);
}

.photo-add {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1.5px dashed var(--border-h);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.15s;
    color: var(--primary);
}

.photo-add:hover {
    border-color: var(--primary);
    transform: scale(1.05);
}

/* ── Light Indicator ─────────────────────────── */
.light-bar {
    display: flex;
    gap: 4px;
    align-items: center;
    margin-top: 6px;
}

.light-seg {
    height: 6px;
    flex: 1;
    border-radius: 3px;
    background: var(--bg3);
}

.light-seg.lit-1 {
    background: #FFF176;
}

.light-seg.lit-2 {
    background: #FFEE58;
}

.light-seg.lit-3 {
    background: #FFD600;
}

.light-seg.lit-4 {
    background: #FFC107;
}

/* ── Toast ───────────────────────────────────── */
.toast-wrap {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 9999;
}

.toast {
    padding: 12px 18px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    box-shadow: var(--shadow);
    animation: slide-in 0.25s ease;
    max-width: 320px;
}

.toast.success {
    border-color: rgba(0, 184, 148, 0.4);
    color: var(--primary);
}

.toast.error {
    border-color: rgba(234, 32, 39, 0.4);
    color: #ff6b6b;
}

@keyframes slide-in {
    from {
        transform: translateX(40px);
        opacity: 0;
    }
}

/* ── Leaf Burst Animation ────────────────────── */
.leaf-burst {
    position: fixed;
    pointer-events: none;
    z-index: 9000;
    top: 0;
    left: 0;
}

.leaf-p {
    position: absolute;
    font-size: 1.2rem;
    animation: leaf-fly 1.2s ease-out forwards;
}

@keyframes leaf-fly {
    0% {
        transform: translate(0, 0) scale(0.5) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translate(var(--dx), var(--dy)) scale(1.2) rotate(var(--dr));
        opacity: 0;
    }
}

/* ── Scrollbar ───────────────────────────────── */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: var(--bg2);
}

::-webkit-scrollbar-thumb {
    background: var(--bg3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ── Responsive ──────────────────────────────── */
@media (max-width: 600px) {
    .stats-row {
        gap: 8px;
    }

    .stat-chip {
        min-width: 80px;
        padding: 12px;
    }

    .stat-chip .num {
        font-size: 1.4rem;
    }

    .detail-hero {
        flex-direction: column;
    }

    .tips-grid {
        grid-template-columns: 1fr;
    }
}