/* =========================================================
   Kirana Cart — product page, cart page, toast
   ========================================================= */

/* ---------- Product page quantity selector ---------- */
.ks-product__layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

.ks-product__media img {
    width: 100%;
    border-radius: 14px;
    display: block;
    background: #f9fafb;
}

.ks-product__image--placeholder {
    width: 100%;
    aspect-ratio: 1;
    background: #f9fafb;
    border-radius: 14px;
}

.ks-product__price {
    font-size: 1.5rem;
    margin: 0 0 12px;
    color: #075c2d;
    font-weight: 700;
}

.ks-product__price-value {
    font-size: 1.75rem;
}

.ks-product__price-unit {
    font-size: 0.9rem;
    color: #6b7280;
    font-weight: 400;
}

.ks-product__price--unset {
    color: #dc2626;
    font-size: 1rem;
    font-weight: 400;
}

.ks-product__meta p {
    margin: 0 0 8px;
    font-size: 0.95rem;
    color: #4b5563;
}

.ks-in-stock { color: #0a7d3e; font-weight: 600; }
.ks-out-of-stock { color: #dc2626; font-weight: 600; }

/* Preset buttons */
.ks-preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
    margin: 16px 0;
}

.ks-preset-btn {
    min-height: 44px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.92rem;
    font-weight: 600;
    color: #1f2937;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ks-preset-btn:hover {
    border-color: #0a7d3e;
    color: #0a7d3e;
}

.ks-preset-btn.is-active {
    background: #0a7d3e;
    border-color: #0a7d3e;
    color: #fff;
}

/* Custom quantity */
.ks-quantity-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 16px 0;
}

.ks-quantity-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 48px;
    padding: 0 14px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
}

.ks-quantity-input:focus {
    outline: none;
    border-color: #0a7d3e;
    box-shadow: 0 0 0 3px rgba(10, 125, 62, 0.15);
}

.ks-quantity-unit {
    font-size: 1rem;
    color: #6b7280;
    font-weight: 600;
}

/* Live price + Add to cart */
.ks-line-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f0f6fc;
    border-radius: 8px;
    margin: 16px 0;
}

.ks-line-total__label {
    color: #4b5563;
    font-size: 0.92rem;
}

.ks-line-total__value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #075c2d;
}

.ks-add-to-cart {
    width: 100%;
    min-height: 52px;
    padding: 14px 24px;
    background: #0a7d3e;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.ks-add-to-cart:hover:not(:disabled) {
    background: #075c2d;
}

.ks-add-to-cart:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ks-error-message {
    color: #dc2626;
    font-size: 0.9rem;
    margin: 8px 0;
    min-height: 1.2em;
}

/* ---------- Toast ---------- */
.ks-toast-region {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: 320px;
}

.ks-toast {
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 0.92rem;
    font-weight: 600;
    color: #fff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: auto;
}

.ks-toast--visible {
    transform: translateY(0);
    opacity: 1;
}

.ks-toast--success { background: #16a34a; }
.ks-toast--error   { background: #dc2626; }
.ks-toast--info    { background: #0a7d3e; }

/* ---------- Cart page ---------- */
.ks-cart__layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin: 24px 0;
}

.ks-cart__heading {
    font-size: 1.35rem;
    margin: 0 0 16px;
}

.ks-cart-list {
    list-style: none;
    padding: 0;
    margin: 0;
    border-top: 1px solid #e5e7eb;
}

.ks-cart-item {
    display: grid;
    grid-template-columns: 64px 1fr auto;
    gap: 14px;
    padding: 16px 0;
    border-bottom: 1px solid #e5e7eb;
    align-items: center;
}

.ks-cart-item__media img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 8px;
    background: #f9fafb;
}

.ks-cart-item__title {
    margin: 0 0 4px;
    font-size: 1rem;
}

.ks-cart-item__title a {
    color: #1f2937;
    text-decoration: none;
}

.ks-cart-item__title a:hover {
    color: #0a7d3e;
    text-decoration: underline;
}

.ks-cart-item__meta {
    margin: 0 0 8px;
    color: #6b7280;
    font-size: 0.85rem;
}

.ks-cart-item__controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.ks-cart-item__qty {
    width: 90px;
    height: 36px;
    padding: 0 8px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.92rem;
}

.ks-cart-item__unit {
    color: #6b7280;
    font-size: 0.85rem;
}

.ks-cart-item__remove {
    width: 32px;
    height: 32px;
    padding: 0;
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    border-radius: 6px;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}

.ks-cart-item__remove:hover {
    background: #dc2626;
    color: #fff;
}

.ks-cart-item__price {
    font-weight: 700;
    color: #075c2d;
    font-size: 1rem;
    text-align: right;
    white-space: nowrap;
}

.ks-cart-item__warn {
    color: #dc2626;
    font-size: 0.85rem;
    margin: 4px 0 0;
}

/* Summary box */
.ks-cart__summary {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 20px;
    align-self: start;
}

.ks-cart__summary-heading {
    font-size: 1.15rem;
    margin: 0 0 16px;
}

.ks-cart-summary {
    margin: 0 0 20px;
}

.ks-cart-summary__row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed #e5e7eb;
}

.ks-cart-summary__row dt {
    color: #4b5563;
    font-size: 0.92rem;
}

.ks-cart-summary__row dd {
    margin: 0;
    font-weight: 600;
    color: #1f2937;
}

.ks-cart-summary__row--total {
    border-bottom: none;
    border-top: 2px solid #e5e7eb;
    margin-top: 8px;
    padding-top: 12px;
}

.ks-cart-summary__row--total dt {
    font-weight: 700;
    color: #1f2937;
    font-size: 1rem;
}

.ks-cart-summary__row--total dd {
    font-size: 1.25rem;
    color: #075c2d;
}

.ks-cart__checkout {
    margin-bottom: 12px;
}

.ks-cart__note {
    font-size: 0.85rem;
    color: #6b7280;
    text-align: center;
    margin: 0;
}

/* Empty state */
.ks-cart__empty {
    text-align: center;
    padding: 60px 20px;
}

.ks-cart__empty h2 {
    margin: 0 0 12px;
    font-size: 1.5rem;
}

.ks-cart__empty p {
    color: #6b7280;
    margin-bottom: 24px;
}

/* ---------- Responsive ---------- */
@media (min-width: 768px) {
    .ks-cart__layout {
        grid-template-columns: 1fr 320px;
        align-items: start;
    }
}

@media (min-width: 1024px) {
    .ks-product__layout {
        grid-template-columns: 1fr 1fr;
        gap: 40px;
        align-items: start;
    }

    .ks-cart__layout {
        grid-template-columns: 1fr 360px;
    }
}