/*--------------------------------------------------------------
    Custom styles - giữ nguyên file style.css gốc
---------------------------------------------------------------*/

/* =========================================================
   FIX: Bootstrap 3 col float gây "kẹt" card khi chiều cao
   không đều — biến row thành flex, các card co dãn đều hàng.
   Áp cho khu vực sản phẩm trang chủ + danh sách.
   ========================================================= */
.featured-flat > .row,
#list-produce .featured-flat > .row {
    display: flex;
    flex-wrap: wrap;
}
.featured-flat > .row > [class*="col-"],
#list-produce .featured-flat > .row > [class*="col-"] {
    display: flex;
    flex-direction: column;
    margin-bottom: 18px;
}
.featured-flat > .row > [class*="col-"] > .flat-item,
#list-produce .featured-flat > .row > [class*="col-"] > .flat-item {
    width: 100%;
    display: flex;
    flex-direction: column;
    height: 100%;
}
/* Ảnh + nội dung: ảnh giữ nguyên ratio, info đẩy xuống đáy đều nhau */
.featured-flat .flat-item .flat-item-info { flex: 1 1 auto; }

/* =========================================================
   CART PAGE
   ========================================================= */
.cart-area { padding-top: 30px; padding-bottom: 60px; background: #fafafa; }
.cart-title { font-weight: 700; font-size: 18px; margin: 0 0 18px; color: #333; }

/* Empty */
.cart-empty { background: #fff; border: 1px solid #eee; border-radius: 8px; padding: 50px 20px; }
.cart-empty-icon { margin-bottom: 16px; }
.cart-empty p { font-size: 16px; color: #666; margin-bottom: 18px; }

/* ----- DESKTOP TABLE ----- */
.cart-desktop { display: block !important; background: #fff; border: 1px solid #eee; border-radius: 8px; overflow: hidden; }
.cart-mobile { display: none !important; }

.cart-table { margin: 0; }
.cart-table thead th {
    background: #f6f6f6;
    color: #333;
    font-weight: 600;
    text-align: center;
    vertical-align: middle;
    border-bottom: 2px solid #e6e6e6;
    white-space: nowrap;
}
.cart-table td { vertical-align: middle; }
.cart-table .td-img { text-align: center; width: 100px; }
.cart-table .td-img img {
    width: 80px !important;
    height: 80px !important;
    max-width: 80px !important;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #eee;
}
.cart-pname { color: #333; font-weight: 500; }
.cart-pname:hover { color: #a81f25; }

.cart-table .td-qty { width: 180px; text-align: center; }
.cart-table .td-price { width: 140px; text-align: right; white-space: nowrap; }
.cart-table .td-total { color: #d9534f; font-weight: 700; }
.cart-table .td-act { width: 80px; text-align: center; }

.qty-group { display: inline-flex; gap: 6px; align-items: center; }
.qty-group .qty-input {
    width: 64px; height: 36px;
    text-align: center; padding: 4px 4px;
    display: inline-block; border-radius: 4px;
}
.qty-group .qty-update { height: 36px; padding: 0 12px; }

/* ----- MOBILE CARDS ----- */
.cart-card {
    display: flex;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.cart-card-img {
    flex: 0 0 88px;
    width: 88px; height: 88px;
    margin-right: 12px;
    display: block;
}
.cart-card-img img {
    width: 88px !important;
    height: 88px !important;
    max-width: 88px !important;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #eee;
    display: block;
}
.cart-card-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.cart-card-name {
    color: #222; font-weight: 600; font-size: 14px; line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
}
.cart-card-name:hover { color: #a81f25; }
.cart-card-price { font-size: 13px; color: #888; margin-bottom: 8px; }
.cart-card-unit { color: #666; }

.cart-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* +/- stepper */
.qty-stepper {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid #d8d8d8;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    height: 36px;
}
.qty-stepper .qty-btn {
    width: 32px; height: 36px;
    border: 0;
    background: #f5f5f5;
    color: #333;
    font-size: 18px; line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background .15s;
}
.qty-stepper .qty-btn:active { background: #e5e5e5; }
.qty-stepper .qty-input {
    width: 44px; height: 36px;
    border: 0;
    border-left: 1px solid #e5e5e5;
    border-right: 1px solid #e5e5e5;
    text-align: center;
    padding: 0;
    background: #fff;
    font-size: 14px; font-weight: 600;
    -moz-appearance: textfield;
}
.qty-stepper .qty-input::-webkit-outer-spin-button,
.qty-stepper .qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.cart-card-del {
    width: 36px; height: 36px;
    border: 1px solid #f1d5d6;
    background: #fff5f5;
    color: #d9534f;
    border-radius: 6px;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background .15s;
}
.cart-card-del:active { background: #ffe8e8; }

.cart-card-total {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #eee;
    display: flex; justify-content: space-between; align-items: baseline;
    font-size: 13px; color: #666;
}
.cart-card-total strong { color: #d9534f; font-size: 15px; font-weight: 700; }

/* ----- SUMMARY + CHECKOUT BTN ----- */
.cart-summary {
    margin-top: 16px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 14px 18px;
}
.cart-summary-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 0;
    font-size: 14px; color: #555;
}
.cart-summary-row strong { color: #333; font-weight: 600; }
.cart-summary-total { border-top: 1px dashed #e2e2e2; margin-top: 6px; padding-top: 12px; font-size: 15px; }
.cart-summary-total strong { color: #d9534f; font-size: 18px; font-weight: 700; }

.cart-actions { margin-top: 18px; text-align: center; }
.btn-checkout {
    display: inline-block;
    padding: 12px 36px;
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    letter-spacing: .3px;
}

/* ----- CHECKOUT FORM ----- */
.checkout-wrap {
    margin-top: 24px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 20px 12px;
}
.checkout-form-title {
    font-size: 16px; font-weight: 700;
    margin: 0 0 14px; color: #333;
    text-align: center;
}
.checkout-form input[type="text"],
.checkout-form input[type="tel"],
.checkout-form input[type="email"] {
    width: 100%;
    height: 46px;
    padding: 8px 14px;
    margin-bottom: 12px;
    border: 1px solid #d8d8d8;
    border-radius: 6px;
    font-size: 15px;
    background: #fff;
    -webkit-appearance: none;
    appearance: none;
}
.checkout-form input:focus {
    outline: none;
    border-color: #95c41f;
    box-shadow: 0 0 0 3px rgba(149,196,31,.18);
}
.checkout-form .required-2 {
    color: #d9534f; font-size: 13px;
    display: none; margin: -6px 0 10px;
    line-height: 1.45;
}
.checkout-form .required-2:empty { display: none !important; }
.pay-method {
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 12px 14px;
    margin: 10px 0 16px;
}
.pay-method label { font-weight: 600; margin: 0 0 6px; display: block; }
.pay-note { font-size: 13px; color: #666; line-height: 1.55; margin: 0; }

.checkout-submit { text-align: center; }
.checkout-submit .spinner { margin: 12px auto 0; }
.checkout-submit .sendMail {
    display: none; margin-top: 12px; font-size: 14px; line-height: 1.5;
}
.send-success { color: #95c41f; }
.send-error   { color: #d9534f; }

/* ----- BREAKPOINTS ----- */
@media (max-width: 767px) {
    .cart-area { padding-top: 16px; padding-bottom: 80px; }
    .cart-title { font-size: 15px; margin-bottom: 12px; text-align: center; }

    /* swap layout */
    .cart-desktop { display: none !important; }
    .cart-mobile { display: block !important; }

    .cart-summary { padding: 12px 14px; }
    .cart-actions { margin-top: 14px; }
    .btn-checkout { width: 100%; padding: 14px 16px; font-size: 15px; }

    .checkout-wrap { padding: 16px 12px; margin-top: 16px; }
    .checkout-form input[type="text"],
    .checkout-form input[type="tel"],
    .checkout-form input[type="email"] { font-size: 16px; } /* iOS không zoom */
}

@media (max-width: 380px) {
    .cart-card { padding: 10px; }
    .cart-card-img { flex: 0 0 76px; width: 76px; height: 76px; margin-right: 10px; }
    .cart-card-img img { width: 76px !important; height: 76px !important; max-width: 76px !important; }
    .cart-card-name { font-size: 13px; }
    .qty-stepper .qty-btn { width: 30px; }
    .qty-stepper .qty-input { width: 38px; font-size: 13px; }
    .cart-card-del { width: 34px; height: 36px; }
}
