/* ================================================
   GARDEN — Game-Style Plant Farm UI
   Inspired by Happy Farm / Merge Garden games
   ================================================ */

/* ===== FULLSCREEN GARDEN CONTAINER ===== */
.garden-world {
    position: relative;
    min-height: 80vh;
    background: linear-gradient(180deg, #7ec850 0%, #5da83a 30%, #6db844 60%, #4a9a2e 100%);
    background-image: url('/images/garden-bg.png');
    background-size: cover;
    background-position: center;
    border-radius: 16px;
    overflow: hidden;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

/* Vine overlay on edges */
.garden-world::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        linear-gradient(90deg, rgba(34, 100, 20, 0.4) 0%, transparent 8%, transparent 92%, rgba(34, 100, 20, 0.4) 100%),
        linear-gradient(180deg, rgba(34, 100, 20, 0.15) 0%, transparent 5%, transparent 95%, rgba(34, 100, 20, 0.25) 100%);
    pointer-events: none;
    z-index: 1;
    border-radius: 16px;
}

/* ===== MASCOT / LEVEL ICON ===== */
.garden-mascot {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(6px);
    padding: 6px 12px;
    border-radius: 20px;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.garden-mascot-icon {
    font-size: 1.4rem;
}

/* ===== 3x3 PLOT GRID ===== */
.garden-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 420px;
    z-index: 2;
    margin-top: 50px;
}

/* ===== INDIVIDUAL PLOT ===== */
.garden-tile {
    position: relative;
    aspect-ratio: 1;
    border-radius: 14px;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.garden-tile:hover {
    transform: translateY(-4px) scale(1.03);
}

.garden-tile:active {
    transform: translateY(0) scale(0.97);
}

/* --- Soil Texture Layers --- */
.garden-soil {
    position: absolute;
    inset: 0;
    border-radius: 14px;
    overflow: hidden;
    z-index: 0;
}

/* Empty tile — sandy/rocky */
.garden-tile-empty .garden-soil {
    background:
        linear-gradient(145deg, #d4b968 0%, #c5a74f 30%, #b89a42 60%, #a88d3a 100%);
    border: 3px solid #9a7e30;
    box-shadow:
        inset 0 -6px 12px rgba(0, 0, 0, 0.2),
        inset 0 3px 6px rgba(255, 255, 255, 0.15),
        0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Rocky texture overlay for empty */
.garden-tile-empty .garden-soil::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 80%, rgba(180, 160, 100, 0.6) 0%, transparent 25%),
        radial-gradient(circle at 75% 25%, rgba(160, 140, 90, 0.5) 0%, transparent 20%),
        radial-gradient(circle at 50% 60%, rgba(200, 180, 120, 0.4) 0%, transparent 30%),
        radial-gradient(circle at 85% 85%, rgba(140, 120, 70, 0.6) 0%, transparent 18%),
        radial-gradient(circle at 15% 30%, rgba(170, 150, 100, 0.5) 0%, transparent 22%);
    border-radius: 14px;
}

/* Planted/sprout tile — darker soil */
.garden-tile-sprout .garden-soil {
    background:
        linear-gradient(145deg, #8b6d3a 0%, #7a5e30 40%, #6a5028 100%);
    border: 3px solid #5a4220;
    box-shadow:
        inset 0 -6px 12px rgba(0, 0, 0, 0.25),
        inset 0 3px 6px rgba(255, 255, 255, 0.1),
        0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Grass patches on sprout tile */
.garden-tile-sprout .garden-soil::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(ellipse at 10% 90%, rgba(80, 140, 40, 0.5) 0%, transparent 30%),
        radial-gradient(ellipse at 90% 10%, rgba(80, 140, 40, 0.4) 0%, transparent 25%),
        radial-gradient(ellipse at 50% 95%, rgba(60, 120, 30, 0.4) 0%, transparent 20%);
    border-radius: 14px;
}

/* Growing tile — rich dark soil with more grass */
.garden-tile-growing .garden-soil {
    background:
        linear-gradient(145deg, #7a5e30 0%, #6a4e25 40%, #5a3e1a 100%);
    border: 3px solid #4a3015;
    box-shadow:
        inset 0 -6px 12px rgba(0, 0, 0, 0.3),
        inset 0 3px 6px rgba(255, 255, 255, 0.08),
        0 4px 12px rgba(0, 0, 0, 0.3);
}

.garden-tile-growing .garden-soil::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(ellipse at 5% 95%, rgba(80, 140, 40, 0.6) 0%, transparent 35%),
        radial-gradient(ellipse at 95% 5%, rgba(80, 140, 40, 0.5) 0%, transparent 30%),
        radial-gradient(ellipse at 15% 15%, rgba(60, 120, 30, 0.4) 0%, transparent 25%),
        radial-gradient(ellipse at 85% 90%, rgba(60, 120, 30, 0.5) 0%, transparent 28%);
    border-radius: 14px;
}

/* Mature tile — rich brown */
.garden-tile-mature .garden-soil {
    background:
        linear-gradient(145deg, #8b6d3a 0%, #7a5c2e 40%, #6b4d22 100%);
    border: 3px solid #5a3e18;
    box-shadow:
        inset 0 -8px 14px rgba(0, 0, 0, 0.25),
        inset 0 3px 8px rgba(255, 255, 255, 0.1),
        0 5px 15px rgba(0, 0, 0, 0.35);
}

.garden-tile-mature .garden-soil::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 50% 50%, rgba(180, 160, 100, 0.15) 0%, transparent 50%);
    border-radius: 14px;
}

/* ===== TIMER BADGE ===== */
.garden-timer-badge {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    background: linear-gradient(135deg, #4a7fbf, #3a6aa8);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 3px 14px;
    border-radius: 12px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.3);
    font-family: 'Baloo 2', monospace;
    letter-spacing: 0.5px;
}

/* ===== PROGRESS BAR (GOLDEN) ===== */
.garden-progress-bar {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    width: 80%;
    height: 18px;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.garden-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #f0b020, #ffd54f, #f0b020);
    border-radius: 8px;
    transition: width 0.6s ease;
    position: relative;
    box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.15), inset 0 2px 4px rgba(255, 255, 255, 0.4);
}

/* Sparkle animation for almost-ready */
.garden-progress-fill.sparkle::after {
    content: '✨';
    position: absolute;
    right: -2px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    animation: gardenSparkle 1s ease-in-out infinite;
}

@keyframes gardenSparkle {

    0%,
    100% {
        opacity: 0.5;
        transform: translateY(-50%) scale(0.8);
    }

    50% {
        opacity: 1;
        transform: translateY(-50%) scale(1.2);
    }
}

/* ===== PLANT IMAGE ===== */
.garden-plant {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.garden-plant-img {
    max-width: 75%;
    max-height: 75%;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    transition: transform 0.3s ease;
    image-rendering: auto;
}

.garden-tile:hover .garden-plant-img {
    transform: scale(1.08);
}

/* Growth stage animations */
.garden-plant-seed {
    animation: gardenSeedBounce 0.5s ease-out;
}

.garden-plant-sprout {
    animation: gardenGrowUp 0.6s ease-out;
}

.garden-plant-growing {
    animation: gardenGrowUp 0.6s ease-out;
    filter: drop-shadow(0 4px 10px rgba(46, 180, 80, 0.3));
}

.garden-plant-mature {
    animation: gardenGrowUp 0.6s ease-out;
    filter: drop-shadow(0 4px 12px rgba(241, 196, 15, 0.4));
}

@keyframes gardenSeedBounce {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }

    60% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes gardenGrowUp {
    0% {
        transform: scale(0.5) translateY(10px);
        opacity: 0;
    }

    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* Empty plot icon */
.garden-empty-icon {
    font-size: 2.2rem;
    opacity: 0.2;
    z-index: 3;
}

/* ===== ACTION BADGE (needs water/fertilize/harvest) ===== */
.garden-action-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 6;
    font-size: 0.6rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 8px;
    color: #fff;
    animation: gardenBadgePop 0.4s ease-out;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.garden-action-badge.water {
    background: linear-gradient(135deg, #3498db, #2980b9);
}

.garden-action-badge.fertilize {
    background: linear-gradient(135deg, #e67e22, #d35400);
}

.garden-action-badge.harvest {
    background: linear-gradient(135deg, #f1c40f, #f39c12);
    color: #222;
}

@keyframes gardenBadgePop {
    0% {
        transform: scale(0);
    }

    70% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
    }
}

/* Pulsing border for action-needed tiles */
.garden-tile-needs-action {
    animation: gardenTilePulse 1.5s infinite;
}

@keyframes gardenTilePulse {

    0%,
    100% {
        box-shadow: 0 0 6px rgba(231, 76, 60, 0.3);
    }

    50% {
        box-shadow: 0 0 20px rgba(231, 76, 60, 0.6);
    }
}

/* Ready-to-harvest golden pulse */
.garden-tile-ready {
    animation: gardenReadyPulse 1.5s infinite;
}

@keyframes gardenReadyPulse {

    0%,
    100% {
        box-shadow: 0 0 8px rgba(241, 196, 15, 0.3);
    }

    50% {
        box-shadow: 0 0 25px rgba(241, 196, 15, 0.6);
    }
}

/* ===== ACTION BUTTONS INSIDE TILE ===== */
.garden-action-btn {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 6;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 5px 14px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-family: 'Baloo 2', sans-serif;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

.garden-action-btn:hover {
    transform: translateX(-50%) scale(1.08);
    filter: brightness(1.1);
}

.garden-action-btn:active {
    transform: translateX(-50%) scale(0.95);
}

.garden-action-btn.water {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: #fff;
}

.garden-action-btn.fertilize {
    background: linear-gradient(135deg, #e67e22, #d35400);
    color: #fff;
}

.garden-action-btn.harvest {
    background: linear-gradient(135deg, #f1c40f, #f39c12);
    color: #222;
    font-size: 0.7rem;
}

.garden-action-btn.plant {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: #fff;
}

/* ===== WATER/FERTILIZE EFFECT ===== */
.garden-fx {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    pointer-events: none;
    opacity: 0;
    font-size: 1.4rem;
}

.garden-fx.active {
    animation: gardenFxDrop 1s ease-out forwards;
}

@keyframes gardenFxDrop {
    0% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(40px);
    }
}

/* ===== SEED SELECTION DRAWER ===== */
.garden-seed-drawer {
    z-index: 5;
    width: 100%;
    max-width: 420px;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 10px 14px;
    margin-top: 8px;
}

.garden-seed-drawer-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.garden-seeds-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.garden-seed-item {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.15);
    cursor: pointer;
    transition: all 0.2s;
    color: #fff;
}

.garden-seed-item:hover {
    background: rgba(46, 204, 113, 0.2);
    border-color: rgba(46, 204, 113, 0.4);
    transform: translateY(-2px);
}

.garden-seed-item.active {
    background: rgba(46, 204, 113, 0.3);
    border-color: rgba(46, 204, 113, 0.6);
    box-shadow: 0 0 12px rgba(46, 204, 113, 0.3);
}

.garden-seed-icon {
    font-size: 1.1rem;
}

.garden-seed-label {
    font-size: 0.72rem;
    font-weight: 700;
}

.garden-seed-qty {
    font-size: 0.6rem;
    opacity: 0.7;
}

.garden-empty-seeds {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.78rem;
    padding: 10px;
}

/* ===== HARVEST INVENTORY PANEL ===== */
.garden-harvest-panel {
    z-index: 5;
    width: 100%;
    max-width: 420px;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 10px 14px;
    margin-top: 4px;
}

.garden-harvest-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.garden-harvest-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.garden-harvest-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.garden-harvest-ico {
    font-size: 1.3rem;
    min-width: 28px;
    text-align: center;
}

.garden-harvest-ico img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.garden-harvest-info {
    flex: 1;
}

.garden-harvest-name {
    font-weight: 700;
    font-size: 0.75rem;
    color: #fff;
}

.garden-harvest-qty {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.65rem;
}

.garden-harvest-btns {
    display: flex;
    gap: 4px;
    margin-top: 3px;
}

.garden-hbtn {
    font-size: 0.62rem;
    padding: 3px 10px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 700;
    font-family: 'Baloo 2', sans-serif;
    transition: all 0.2s;
}

.garden-hbtn:hover {
    filter: brightness(1.15);
    transform: scale(1.04);
}

.garden-hbtn-sell {
    background: rgba(241, 196, 15, 0.3);
    color: #ffd54f;
}

.garden-hbtn-feed {
    background: rgba(46, 204, 113, 0.3);
    color: #55efc4;
}

/* ===== UNLOCK PLOT BUTTON ===== */
.garden-unlock-btn {
    z-index: 5;
    background: rgba(255, 255, 255, 0.1);
    border: 2px dashed rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.7);
    padding: 10px 24px;
    border-radius: 14px;
    cursor: pointer;
    font-family: 'Baloo 2', sans-serif;
    font-weight: 700;
    font-size: 0.8rem;
    transition: all 0.2s;
    margin-top: 4px;
}

.garden-unlock-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.5);
    color: #fff;
    transform: translateY(-2px);
}

/* ===== GUIDE BANNER ===== */
.garden-guide {
    z-index: 5;
    width: 100%;
    max-width: 420px;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(6px);
    border-radius: 12px;
    padding: 8px 14px;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.5;
}

.garden-guide b {
    color: #ffd54f;
}

.garden-guide-steps {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.garden-guide-step {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    font-size: 0.62rem;
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.85);
}

.garden-guide-step .arrow {
    opacity: 0.5;
    margin: 0 1px;
    color: rgba(255, 255, 255, 0.5);
}

/* ===== RESPONSIVE ===== */
@media (min-width: 768px) {
    .garden-grid {
        max-width: 500px;
        gap: 14px;
    }

    .garden-seed-drawer,
    .garden-harvest-panel,
    .garden-guide {
        max-width: 500px;
    }

    .garden-timer-badge {
        font-size: 0.8rem;
        padding: 4px 16px;
    }

    .garden-plant-img {
        max-width: 80%;
        max-height: 80%;
    }
}

@media (max-width: 380px) {
    .garden-grid {
        gap: 6px;
    }

    .garden-timer-badge {
        font-size: 0.6rem;
        padding: 2px 10px;
    }

    .garden-action-btn {
        font-size: 0.58rem;
        padding: 4px 10px;
    }
}