/* ===== GARDEN MODULE CSS ===== */

/* Layout chính — khung do .main-panel (style.css) đảm nhiệm: nền/viền/bo/padding.
   Không đặt padding riêng ở đây để không đè .main-panel (garden.css nạp sau style.css). */
.garden-wrapper {
    max-width: 100%;
    margin: 0;
}

/* Tab cha — dùng chung "Parent tab style" với khối Cài đặt admin để thống nhất */
.garden-tabs-parent {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    margin-top: 0;
    padding-bottom: 4px;
    border-bottom: 2px solid #d9eaf7;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.garden-tab-btn {
    flex: 0 0 auto;
    padding: 10px 18px;
    border: none;
    border-radius: 12px 12px 0 0;
    background: #eef4f9;
    color: #1f4e79;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
}

.garden-tab-btn:hover {
    background: #dbe9f6;
}

.garden-tab-btn.active {
    background: #1f4e79;
    color: #ffffff;
    border-bottom-color: #f0b400;
}

/* Panel */
.garden-panel {
    display: none;
}

.garden-panel.active {
    display: block;
}

.garden-child-panel {
    display: none;
}

.garden-child-panel.active {
    display: block;
}

.hidden {
    display: none !important;
}

/* Spin links */
.garden-spin-links {
    display: flex;
    gap: 16px;
    padding: 24px 0;
    justify-content: center;
}

.garden-spin-link-btn {
    padding: 14px 32px;
    background: #1f4e79;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.garden-spin-link-btn:hover {
    background: #2f75b5;
}

/* Tab con — dùng chung "Child tab style" với khối Cài đặt admin (hình viên thuốc) */
.garden-tabs-child {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    margin-top: 6px;
    padding: 6px 8px;
    border-radius: 10px;
    background: #f8fbff;
    border: 1px dashed #d9eaf7;
    /* [GĐ3] 4 tab: trên mobile (nowrap) đã cuộn ngang được nhờ overflow-x auto sẵn có. */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.garden-child-tab-btn {
    flex: 0 0 auto;
    padding: 7px 14px;
    border: 1.5px solid #b7c7d6;
    border-radius: 999px;
    background: #ffffff;
    color: #1f4e79;
    font-weight: 600;
    font-size: 13.5px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
    white-space: nowrap;
}

.garden-child-tab-btn:hover {
    background: #e8f1fb;
    border-color: #2f75b5;
}

.garden-child-tab-btn.active {
    background: #2f75b5;
    color: #ffffff;
    border-color: #2f75b5;
    box-shadow: 0 4px 10px rgba(47, 117, 181, 0.25);
}

/* Tài nguyên */
.garden-resources {
    display: flex;
    gap: 20px;
    padding: 10px 14px;
    background: #e8f5e9;
    border-radius: 10px;
    margin-bottom: 14px;
    font-size: 15px;
    font-weight: bold;
    flex-wrap: wrap;
}

/* Grid ô đất — 3 cột × 3 hàng, ô thấp + ngang để 9 ô lọt trong viewport không cuộn */
.garden-plots-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 1fr;
    gap: 10px;
}

/* Ô đất — bố cục NGANG (40% ảnh / 60% nội dung). Ảnh cây tự co giãn lấp cột trái. */
.garden-plot {
    border: 2px solid #a5d6a7;
    border-radius: 12px;
    background: #f9fbe7;
    min-height: 0;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    padding: 6px 8px;
    gap: 8px;
    text-align: left;
    position: relative;
    transition: box-shadow 0.2s;
    box-sizing: border-box;
    overflow: hidden;
}

.garden-plot:hover {
    box-shadow: 0 4px 16px #a5d6a744;
}

.garden-plot.locked {
    background: #f5f5f5;
    border-color: #ccc;
    color: #999;
    cursor: default;
}

.garden-plot.empty {
    cursor: pointer;
    border-style: dashed;
}

.garden-plot.empty:hover {
    background: #e8f5e9;
}

/* Cột trái: ảnh cây ăn hết khung trừ 5px lề, căn giữa */
.plot-left {
    flex: 0 0 40%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: 5px;          /* "trừ đi 5–6 px" — ảnh tự lấp phần còn lại */
    box-sizing: border-box;
}

/* Cột phải: dạng cột dọc, các phần co giãn vừa khít */
.plot-right {
    flex: 1 1 60%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    justify-content: space-between;
}

.plot-right-locked,
.plot-right-empty {
    justify-content: center;
    align-items: center;
    text-align: center;
}

/* Wrap ảnh / icon: chiếm trọn cột trái để ảnh có thể phóng to hết cỡ */
.plant-svg-wrap {
    width: 100%;
    height: 100%;
    font-size: 38px;
    line-height: 1;
    margin: 0;
    transition: transform 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.plant-svg-wrap img {
    max-width: 100%;
    max-height: 100%;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
}

.plant-lock-icon,
.plant-empty-icon {
    font-size: 54px;
}

/* Trạng thái héo */
.garden-plot.wilting .plant-svg-wrap {
    animation: wilt-sway 1.5s ease-in-out infinite;
    filter: saturate(0.3);
}

.garden-plot.wilting-severe .plant-svg-wrap {
    animation: wilt-droop 2s ease-in-out infinite;
    filter: saturate(0.1) brightness(0.7);
}

@keyframes wilt-sway {

    0%,
    100% {
        transform: rotate(-5deg);
    }

    50% {
        transform: rotate(5deg);
    }
}

@keyframes wilt-droop {

    0%,
    100% {
        transform: rotate(-12deg) scaleY(0.9);
    }

    50% {
        transform: rotate(12deg) scaleY(0.85);
    }
}

/* Nở hoa */
.garden-plot.blooming .plant-svg-wrap {
    animation: bloom-pulse 1s ease-in-out infinite;
}

@keyframes bloom-pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.12);
    }
}

/* Tên cây ngay phía trên thanh tiến độ */
.plot-plant-name {
    font-size: 13px;
    font-weight: 700;
    color: #1f4e79;
    margin: 0;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.15;
}

/* Text giai đoạn: NẰM NGAY PHÍA TRÊN thanh tiến độ (không còn đè lên thanh) */
.plot-progress-label {
    text-align: center;
    color: #01579b;        /* xanh nước biển đậm, đọc rõ trên nền vàng nhạt của card */
    font-size: 12px;
    font-weight: 700;
    line-height: 1.1;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== Thanh tiến độ XANH NƯỚC BIỂN — mỏng, cùng độ cao với các mốc tròn ===== */
.plot-progress-track {
    position: relative;
    width: 100%;
    height: 10px;          /* mỏng, bằng các điểm giai đoạn */
    border-radius: 999px;
    background: #cfd8dc;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
}

.plot-progress-fill {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 0%;
    background: linear-gradient(90deg, #0288d1, #01579b); /* ocean blue */
    border-radius: 999px;
    transition: width 0.4s ease;
    z-index: 1;
}

.plot-progress-dots {
    position: absolute;
    inset: 0;              /* phủ kín thanh để các mốc nằm chính xác trên trục bar */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    z-index: 2;
    pointer-events: none;
}

.plot-progress-dot {
    width: 10px;           /* bằng chiều cao thanh để khớp visually */
    height: 10px;
    box-sizing: border-box;
    border-radius: 50%;
    background: #ffffff;
    border: 1.5px solid #455a64;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
    flex: 0 0 auto;
}

.plot-progress-dot.active {
    background: #ffd54f;   /* vàng nổi bật trên nền ocean blue */
    border-color: #f57f17;
    transform: scale(1.18);
    box-shadow: 0 0 5px rgba(255, 213, 79, 0.9), 0 1px 2px rgba(0, 0, 0, 0.25);
}

.plot-water-text {
    font-size: 10.5px;
    color: #5a6b7b;
    text-align: center;
    margin: 0;
    line-height: 1;
}

/* Cụm nút nằm trong cột phải — Tưới căn TRÁI thanh progress, Bón căn PHẢI thanh progress.
   2 nút chia đều phần ngang của cột phải, cách nhau một khe nhỏ (~6px). */
.plot-actions {
    display: flex;
    width: 100%;
    gap: 6px;
    margin-top: 2px;
}

.plot-actions .plot-btn {
    flex: 1 1 0;
    min-width: 0;
}

.plot-actions-harvest {
    /* Khi nở hoa: nút Thu hoạch chiếm trọn chiều rộng */
    justify-content: stretch;
}

.plot-actions-harvest .plot-btn-harvest {
    flex: 1;
}

/* Nút trong ô đất — cao hơn 1 chút cho dễ bấm (padding dọc tăng từ 4px → 7px) */
.plot-btn {
    margin: 0;
    padding: 7px 10px;
    border: none;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
    line-height: 1.15;
}

.plot-btn-water {
    background: #0288d1;
    color: #fff;
}

.plot-btn-water:hover {
    background: #01579b;
}

.plot-btn-harvest {
    background: #ffb300;
    color: #fff;
    animation: bloom-pulse 1s infinite;
    font-size: 12px;
    padding: 5px 10px;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.plot-btn-harvest:hover {
    background: #f57f17;
}

.plot-btn-revive {
    background: #66bb6a;
    color: #fff;
}

.plot-btn-revive:hover {
    background: #2e7d32;
}

/* Khóa & ô trống */
.plot-lock-info {
    font-size: 12px;
    color: #888;
    text-align: center;
    line-height: 1.25;
}

.plot-empty-title {
    font-size: 13px;
    font-weight: 700;
    color: #6d8c44;
}

.plot-empty-sub {
    font-size: 11.5px;
    color: #888;
}

/* Cửa hàng hạt giống */
.garden-shop-info {
    padding: 10px 14px;
    background: #fff9c4;
    border-radius: 10px;
    font-size: 15px;
    font-weight: bold;
    margin-bottom: 14px;
}

.garden-shop-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.garden-seed-card {
    border: 2px solid #ffe082;
    border-radius: 12px;
    background: #fffde7;
    padding: 12px 8px;
    text-align: center;
    cursor: pointer;
    transition: box-shadow 0.2s;
}

.garden-seed-card:hover {
    box-shadow: 0 4px 14px #ffe08255;
}

.garden-seed-card.legendary {
    border-color: #ce93d8;
    background: #fce4ec;
}

.seed-emoji {
    font-size: 38px;
    margin-bottom: 6px;
}

.seed-name {
    font-size: 13px;
    font-weight: bold;
    color: #4a148c;
    margin-bottom: 4px;
}

.seed-price {
    font-size: 12px;
    color: #e65100;
}

.seed-water-need {
    font-size: 11px;
    color: #0277bd;
}

.seed-harvest {
    font-size: 11px;
    color: #2e7d32;
}

.seed-buy-btn {
    margin-top: 8px;
    padding: 5px 14px;
    background: #43a047;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
}

.seed-buy-btn:disabled {
    background: #ccc;
    cursor: default;
}

/* Bộ sưu tập */
.garden-collection-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    padding: 8px 0;
}

.collection-card {
    border: 2px solid #b2dfdb;
    border-radius: 12px;
    background: #e0f2f1;
    padding: 10px 6px;
    text-align: center;
    font-size: 12px;
}

.collection-card .seed-emoji {
    font-size: 32px;
}

.collection-count {
    font-weight: bold;
    color: #00695c;
}

/* Mobile */
@media (max-width: 800px) {
    .garden-tabs-parent,
    .garden-tabs-child {
        flex-wrap: nowrap;
    }
    .garden-tab-btn {
        padding: 9px 14px;
        font-size: 14px;
    }
    .garden-child-tab-btn {
        padding: 6px 12px;
        font-size: 13px;
    }
}

@media (max-width: 600px) {
    /* Điện thoại: 1 mảnh đất / hàng để có đủ chỗ cho ảnh + thông tin. */
    .garden-plots-grid {
        grid-template-columns: 1fr;
    }

    /* Card rộng full nên cần chiều cao tối thiểu cho ảnh cây có đất "thở".
       Bố cục NGANG (40% ảnh / 60% nội dung) vẫn giữ nguyên như PC. */
    .garden-plot {
        min-height: 130px;
    }

    .garden-tabs-parent {
        gap: 4px;
    }

    .garden-tab-btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    .garden-child-tab-btn {
        padding: 6px 10px;
        font-size: 12.5px;
    }
}

/* 🔘 Đồng bộ khung nút khu vườn (token chung từ style.css; GIỮ màu) */
.plot-btn {
    border-radius: var(--btn-radius);
    min-height: var(--btn-min-h-sm);
}

.seed-buy-btn {
    border-radius: var(--btn-radius);
    padding: var(--btn-pad-y-sm) var(--btn-pad-x-sm);
    min-height: var(--btn-min-h-sm);
}

.garden-spin-link-btn {
    border-radius: var(--btn-radius);
}

/* ============================================================
   [GĐ3] TAB "BÓ HOA YÊU THƯƠNG" (màn của trẻ) — mobile-first
   ============================================================ */
.bouquet-empty {
    padding: 22px 14px;
    text-align: center;
    color: #8a8a8a;
    font-size: 15px;
}

/* Các thẻ bó hoa để tặng */
.bouquet-cards-child {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

/* Khi CHƯA có bó hoa nào: căn giữa (ngang + dọc) thông báo trong vùng tab. */
.bouquet-cards-child.is-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 240px;
    margin-bottom: 0;
}

.bouquet-gift-card {
    background: linear-gradient(160deg, #fff, #fff6fb);
    border: 2px solid #f8c8dd;
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 2px 10px rgba(194, 24, 91, 0.08);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bouquet-gift-title {
    font-weight: 800;
    font-size: 15.5px;
    color: #c2185b;
    line-height: 1.3;
}

.bouquet-req-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bouquet-req {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: 9px;
    background: #fff;
    border: 1px solid #eee;
    font-size: 14px;
}

.bouquet-req.ok {
    border-color: #b9e6c4;
    background: #f3fbf5;
}

.bouquet-req.lack {
    border-color: #f3d2d2;
    background: #fdf5f5;
}

.bouquet-req-ico {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bouquet-req-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #4a3b33;
}

.bouquet-req-count {
    flex: 0 0 auto;
    font-weight: 700;
    color: #2e7d32;
}

.bouquet-req.lack .bouquet-req-count {
    color: #c62828;
}

.bouquet-gift-reward {
    font-size: 14px;
    color: #6a1b9a;
    font-weight: 600;
}

.bouquet-gift-btn {
    margin-top: 2px;
    padding: 11px 14px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 800;
    color: #fff;
    background: #c7ccd1;
    cursor: not-allowed;
    width: 100%;
}

.bouquet-gift-btn.ready {
    background: #ec407a;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(236, 64, 122, 0.35);
}

.bouquet-gift-btn.ready:hover {
    background: #d81b60;
}

/* Khu kho hoa + segmented */
.bouquet-inventory-section {
    border-top: 1px dashed #e0c8d4;
    padding-top: 12px;
}

.bouquet-segmented {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.bouquet-seg-btn {
    flex: 1 1 0;
    padding: 10px 12px;
    border: 1.5px solid #f0a8c4;
    background: #fff;
    color: #c2185b;
    font-weight: 700;
    font-size: 15px;
    border-radius: 999px;
    cursor: pointer;
}

.bouquet-seg-btn.active {
    background: #ec407a;
    color: #fff;
    border-color: #ec407a;
}

.bouquet-inventory-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.bouquet-inv-card {
    background: #fffdf6;
    border: 1.5px solid #ffe6a8;
    border-radius: 12px;
    padding: 10px;
    text-align: center;
}

.bouquet-inv-ico {
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bouquet-inv-name {
    font-size: 13px;
    font-weight: 600;
    color: #5d4037;
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bouquet-inv-count {
    font-weight: 800;
    color: #e65100;
    margin-top: 2px;
}

/* "Hoa đã tặng": danh sách 1 cột, gọn cho mobile */
.bouquet-inventory-list.gifted-mode {
    grid-template-columns: 1fr;
}

.bouquet-gifted-card {
    background: #fff;
    border: 1px solid #f0d6e1;
    border-radius: 12px;
    padding: 10px 12px;
}

.bouquet-gifted-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.bouquet-gifted-name {
    font-weight: 800;
    color: #c2185b;
    font-size: 14.5px;
}

.bouquet-gifted-date {
    font-size: 12.5px;
    color: #999;
}

.bouquet-gifted-flowers {
    margin-top: 4px;
    font-size: 13.5px;
    color: #5d4037;
}

