/* =========================================================
   GREEN HOUSE ADMIN
   Main Style + Responsive
   ========================================================= */

* {
    box-sizing: border-box;
}

html {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    font-family: Arial, "Noto Sans Thai", sans-serif;
    background: #f5f7f2;
    color: #203126;
    max-width: 100%;
    overflow-x: hidden;
}

img {
    max-width: 100%;
}

a {
    text-decoration: none;
    color: inherit;
}

/* =========================================================
   MAIN LAYOUT
   ========================================================= */

.shell {
    min-height: 100vh;
}

/* =========================================================
   TOP BAR
   ========================================================= */

.topbar {
    min-height: 72px;
    background: #ffffff;
    border-bottom: 1px solid #e1e8df;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 6%;

    position: sticky;
    top: 0;
    z-index: 50;
}

.brand {
    font-size: 22px;
    font-weight: 800;
    color: #245c3a;
}

.brand span {
    font-size: 11px;
    background: #e8f2e9;
    padding: 5px 8px;
    border-radius: 20px;
    margin-left: 7px;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 20px;

    font-size: 14px;
    color: #6d786f;
}

.top-actions a {
    color: #b14d45;
    font-weight: 700;
}

/* =========================================================
   MAIN
   ========================================================= */

main {
    width: 100%;
    max-width: 1180px;

    margin: 0 auto;

    padding: 42px 22px 70px;
}

/* =========================================================
   HERO
   ========================================================= */

.hero {
    background:
        linear-gradient(
            135deg,
            #e7f2e4 0%,
            #f9f6e8 100%
        );

    border: 1px solid #dce8d9;
    border-radius: 26px;

    padding: 34px 38px;

    display: flex;
    justify-content: space-between;
    align-items: center;

    overflow: hidden;
}

.eyebrow {
    font-size: 12px;
    letter-spacing: 2px;
    color: #66816d;
    font-weight: 800;
}

.hero h1 {
    font-size: 38px;
    margin: 8px 0;
    line-height: 1.2;
}

.hero p {
    margin: 0;
    color: #738077;
    line-height: 1.7;
}

.hero-icon {
    font-size: 70px;
    line-height: 1;
}

/* =========================================================
   PAGE HEADER
   ========================================================= */

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin-bottom: 22px;
}

.page-head h1 {
    font-size: 38px;
    margin: 8px 0;
}

/* =========================================================
   STATISTICS
   ========================================================= */

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);

    gap: 16px;

    margin: 20px 0;
}

.stats > div {
    background: #ffffff;

    border: 1px solid #e3e9e1;
    border-radius: 18px;

    padding: 20px;
}

.stats span,
.stats small {
    display: block;

    color: #7b867d;
    font-size: 13px;
}

.stats strong {
    display: inline-block;

    font-size: 30px;

    margin: 6px 0;

    color: #285c3b;
}

/* =========================================================
   TOOLBAR / SEARCH
   ========================================================= */

.toolbar {
    display: flex;

    justify-content: space-between;
    align-items: center;

    gap: 12px;

    margin: 25px 0;
}

.toolbar form {
    display: flex;

    gap: 8px;

    flex: 1;
}

.toolbar input {
    width: 100%;
    max-width: 430px;
}

/* =========================================================
   INPUT / SELECT / TEXTAREA
   ========================================================= */

input,
select,
textarea {
    width: 100%;

    border: 1px solid #d8e0d7;
    border-radius: 12px;

    padding: 12px 14px;

    font: inherit;

    background: #ffffff;

    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #76a27d;

    box-shadow:
        0 0 0 3px #e7f1e8;
}

/* =========================================================
   BUTTON
   ========================================================= */

.btn {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    min-height: 42px;

    border: 0;
    border-radius: 11px;

    padding: 11px 16px;

    background: #e9efe9;

    color: #31543b;

    font-weight: 700;

    cursor: pointer;

    transition:
        transform .15s ease,
        box-shadow .15s ease,
        background .15s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn.primary {
    background: #2f7047;
    color: #ffffff;
}

.btn.primary:hover {
    background: #255d3a;
}

.btn.ghost {
    background: #ffffff;

    border: 1px solid #d8e0d7;
}

.btn.small {
    min-height: 38px;

    padding: 8px 12px;

    font-size: 13px;
}

.btn.danger {
    background: #fff0ee;

    color: #b34b43;
}

.btn.danger:hover {
    background: #ffe4e1;
}

/* =========================================================
   PRODUCT GRID
   ========================================================= */

.product-grid {
    display: grid;

    grid-template-columns: repeat(3, minmax(0, 1fr));

    gap: 20px;
}

/* =========================================================
   PRODUCT CARD
   ========================================================= */

.product-card {
    background: #ffffff;

    border: 1px solid #e1e8df;

    border-radius: 20px;

    overflow: hidden;

    box-shadow:
        0 8px 25px rgba(42, 71, 49, .05);

    transition:
        transform .2s ease,
        box-shadow .2s ease;
}

.product-card:hover {
    transform: translateY(-3px);

    box-shadow:
        0 14px 32px rgba(42, 71, 49, .10);
}

/* =========================================================
   PRODUCT IMAGE
   ========================================================= */

.product-image {
    height: 210px;

    background: #edf3eb;

    position: relative;

    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;

    object-fit: cover;

    display: block;
}

.no-image {
    width: 100%;
    height: 100%;

    display: grid;
    place-items: center;

    font-size: 60px;
}

/* =========================================================
   STOCK
   ========================================================= */

.stock {
    position: absolute;

    right: 12px;
    top: 12px;

    background: #ffffff;

    padding: 6px 10px;

    border-radius: 20px;

    font-size: 12px;

    font-weight: 800;

    color: #39704a;

    box-shadow:
        0 3px 10px rgba(0, 0, 0, .08);
}

.stock.low {
    color: #a06c1f;
}

.stock.out {
    color: #b44d45;
}

/* =========================================================
   PRODUCT BODY
   ========================================================= */

.product-body {
    padding: 18px;
}

.tag {
    display: inline-block;

    font-size: 11px;

    background: #edf5ed;

    color: #4e7657;

    border-radius: 20px;

    padding: 5px 9px;
}

.product-body h2 {
    font-size: 20px;

    margin: 12px 0 6px;

    line-height: 1.3;

    color: #24452f;
}

.product-body p {
    height: 42px;

    margin: 0;

    color: #7c857f;

    font-size: 13px;

    line-height: 1.6;

    overflow: hidden;
}

/* =========================================================
   PRODUCT FOOT
   ========================================================= */

.product-foot {
    display: flex;

    justify-content: space-between;
    align-items: center;

    gap: 10px;

    margin-top: 16px;
}

.product-foot > strong {
    font-size: 21px;

    color: #245f3c;

    white-space: nowrap;
}

.product-foot > div {
    display: flex;

    gap: 6px;

    margin-left: auto;
}

/* =========================================================
   EMPTY
   ========================================================= */

.empty {
    grid-column: 1 / -1;

    text-align: center;

    background: #ffffff;

    border: 1px dashed #ccd8cc;

    padding: 50px;

    border-radius: 20px;

    color: #748078;
}

.empty a {
    color: #2f7047;

    font-weight: 800;
}

/* =========================================================
   FORM PANEL
   ========================================================= */

.panel {
    width: 100%;
    max-width: 850px;

    background: #ffffff;

    border: 1px solid #e1e8df;

    border-radius: 22px;

    padding: 28px;
}

.form {
    display: grid;

    gap: 16px;
}

.field label {
    display: block;

    font-weight: 700;

    font-size: 14px;

    margin-bottom: 7px;
}

.field small {
    display: block;

    color: #89928c;

    margin-top: 5px;
}

.grid2 {
    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 16px;
}

.preview img {
    width: 150px;
    height: 150px;

    object-fit: cover;

    border-radius: 16px;
}

/* =========================================================
   AUTH / LOGIN
   ========================================================= */

.auth-page {
    min-height: 100vh;

    display: grid;
    place-items: center;

    background:
        radial-gradient(
            circle at 20% 10%,
            #e7f2e3,
            transparent 30%
        ),
        #f5f7f2;

    padding: 20px;
}

.auth-card {
    width: min(450px, 100%);

    background: #ffffff;

    border: 1px solid #e1e8df;

    border-radius: 25px;

    padding: 35px;

    box-shadow:
        0 20px 60px rgba(42, 71, 49, .10);
}

.auth-card h1 {
    margin: 10px 0 5px;
}

.auth-card .brand {
    margin-bottom: 10px;
}

.auth-card .form {
    margin-top: 24px;
}

.plant-mark {
    font-size: 45px;
}

/* =========================================================
   ALERT
   ========================================================= */

.alert,
.success {
    padding: 11px 13px;

    border-radius: 11px;

    margin: 15px 0;

    font-size: 14px;
}

.alert {
    background: #fff0ee;

    color: #a7433c;
}

.success {
    background: #eaf5eb;

    color: #397047;
}

/* =========================================================
   MUTED
   ========================================================= */

.muted {
    color: #738077;
}

/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 850px) {

    .product-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .stats {
        grid-template-columns:
            repeat(3, 1fr);
    }

    .hero h1,
    .page-head h1 {
        font-size: 30px;
    }
}

/* =========================================================
   MOBILE
   ให้ยังดูคล้าย Desktop
   ========================================================= */

@media (max-width: 768px) {

    body {
        font-size: 14px;
    }

    .topbar {
        min-height: 64px;

        padding: 0 15px;
    }

    .brand {
        font-size: 19px;
    }

    .brand span {
        font-size: 9px;

        padding: 4px 7px;
    }

    .top-actions {
        gap: 10px;

        font-size: 12px;
    }

    main {
        width: 100%;

        padding: 22px 14px 45px;
    }

    /* HERO */

    .hero {
        padding: 24px;

        border-radius: 20px;
    }

    .hero h1 {
        font-size: 30px;

        line-height: 1.25;
    }

    .hero p {
        font-size: 13px;
    }

    .hero-icon {
        font-size: 50px;
    }

    /* STATS */

    .stats {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));

        gap: 10px;

        margin: 15px 0;
    }

    .stats > div {
        padding: 14px;

        border-radius: 15px;
    }

    .stats strong {
        font-size: 24px;
    }

    .stats span,
    .stats small {
        font-size: 11px;
    }

    /* TOOLBAR */

    .toolbar {
        display: flex;

        flex-direction: row;

        align-items: center;

        gap: 8px;

        margin: 18px 0;
    }

    .toolbar form {
        display: flex;

        flex: 1;

        gap: 7px;

        min-width: 0;
    }

    .toolbar input {
        min-width: 0;

        width: 100%;
    }

    .toolbar .btn {
        white-space: nowrap;
    }

    /* PRODUCT */

    .product-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));

        gap: 12px;
    }

    .product-card {
        width: 100%;

        border-radius: 16px;
    }

    .product-image {
        height: 190px;
    }

    .product-body {
        padding: 13px;
    }

    .product-body h2 {
        font-size: 17px;

        margin: 9px 0 5px;
    }

    .product-body p {
        height: 38px;

        font-size: 12px;
    }

    .tag {
        font-size: 10px;

        padding: 4px 7px;
    }

    .stock {
        right: 8px;
        top: 8px;

        padding: 5px 8px;

        font-size: 10px;
    }

    .product-foot {
        display: flex;

        align-items: center;

        justify-content: space-between;

        gap: 7px;

        margin-top: 12px;
    }

    .product-foot > strong {
        font-size: 17px;
    }

    .product-foot > div {
        display: flex;

        gap: 5px;

        margin-left: auto;
    }

    /* EDIT / DELETE */

    .product-foot .btn.small {
        min-height: 40px;

        min-width: 58px;

        padding: 8px 11px;

        font-size: 13px;

        border-radius: 9px;

        font-weight: 800;
    }

    .product-foot .btn.danger {
        min-width: 58px;
    }

    /* FORM */

    .page-head {
        gap: 12px;
    }

    .page-head h1 {
        font-size: 28px;
    }

    .panel {
        width: 100%;

        padding: 20px;
    }

    .grid2 {
        grid-template-columns:
            1fr 1fr;

        gap: 12px;
    }

    input,
    select,
    textarea {
        font-size: 16px;
    }

    /* BUTTON */

    .btn {
        min-height: 42px;

        padding: 10px 14px;
    }
}

/* =========================================================
   SMALL PHONE
   ========================================================= */

@media (max-width: 480px) {

    main {
        padding: 18px 10px 35px;
    }

    .topbar {
        padding: 0 11px;
    }

    .brand {
        font-size: 17px;
    }

    .brand span {
        display: none;
    }

    .top-actions {
        font-size: 11px;

        gap: 7px;
    }

    /* HERO */

    .hero {
        padding: 20px 16px;
    }

    .hero h1 {
        font-size: 25px;
    }

    .hero-icon {
        display: none;
    }

    /* STATS */

    .stats {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));

        gap: 7px;
    }

    .stats > div {
        padding: 12px 8px;
    }

    .stats strong {
        font-size: 20px;
    }

    .stats span,
    .stats small {
        font-size: 9px;
    }

    /* TOOLBAR */

    .toolbar {
        flex-direction: row;
    }

    .toolbar form {
        flex: 1;
    }

    .toolbar input {
        min-width: 0;
    }

    /* PRODUCT */

    .product-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));

        gap: 9px;
    }

    .product-image {
        height: 155px;
    }

    .product-body {
        padding: 11px;
    }

    .product-body h2 {
        font-size: 15px;
    }

    .product-body p {
        font-size: 11px;

        height: 35px;
    }

    .product-foot {
        flex-direction: column;

        align-items: stretch;

        gap: 8px;
    }

    .product-foot > strong {
        font-size: 17px;
    }

    .product-foot > div {
        width: 100%;

        display: flex;

        gap: 6px;

        margin-left: 0;
    }

    /* ปุ่มใหญ่ กดง่าย */

    .product-foot .btn.small {
        flex: 1;

        width: 50%;

        min-height: 42px;

        padding: 9px 5px;

        font-size: 13px;
    }

    /* FORM */

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

/* =========================================================
   VERY SMALL PHONE
   ========================================================= */

@media (max-width: 360px) {

    .product-grid {
        gap: 7px;
    }

    .product-image {
        height: 135px;
    }

    .product-body {
        padding: 9px;
    }

    .product-body h2 {
        font-size: 14px;
    }

    .product-foot .btn.small {
        min-height: 40px;

        font-size: 12px;
    }
}