/* Shared styles for the buy-online store pages (cart, checkout, prices) */

/* ---- Price + stock on product cards ---- */
.price-tag {
    font-size: 1.6rem;
    font-weight: 700;
    color: #2c5530;
    font-family: 'Montserrat', sans-serif;
}

.stock-note {
    font-size: 0.85rem;
    color: #666;
}

.stock-note.low {
    color: #c62828;
    font-weight: 600;
}

.sold-out-badge {
    background: #9e9e9e !important;
}

.add-cart-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.4rem;
    background: #2c5530;
    color: white;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.add-cart-btn:hover:not(:disabled) {
    background: #4a7c59;
    transform: translateY(-2px);
}

.add-cart-btn:disabled {
    background: #bbb;
    cursor: not-allowed;
}

.add-cart-btn.added {
    background: #1b5e20;
}

/* ---- Floating cart button ---- */
.cart-fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #2c5530;
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    z-index: 900;
    transition: all 0.3s ease;
}

.cart-fab:hover {
    background: #4a7c59;
    transform: scale(1.08);
}

.cart-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #c62828;
    color: white;
    min-width: 24px;
    height: 24px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}

/* ---- Cart drawer ---- */
.cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1050;
    display: none;
}

.cart-overlay.open {
    display: block;
}

.cart-drawer {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    max-width: 95vw;
    height: 100%;
    background: white;
    z-index: 1060;
    display: flex;
    flex-direction: column;
    box-shadow: -5px 0 30px rgba(0,0,0,0.2);
    transition: right 0.3s ease;
}

.cart-drawer.open {
    right: 0;
}

.cart-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: #2c5530;
    color: white;
}

.cart-drawer-header h3 {
    margin: 0;
    font-family: 'Montserrat', sans-serif;
}

.cart-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem;
}

.cart-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid #eee;
    align-items: center;
}

.cart-item img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 8px;
    background: #f0f0f0;
}

.cart-item-info {
    flex: 1;
}

.cart-item-info h4 {
    margin: 0 0 0.25rem;
    font-size: 0.95rem;
    color: #333;
}

.cart-item-price {
    color: #2c5530;
    font-weight: 700;
}

.qty-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.qty-controls button {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid #ccc;
    background: white;
    cursor: pointer;
    font-weight: 700;
}

.qty-controls button:hover {
    background: #e8f5e9;
}

.cart-drawer-footer {
    padding: 1.25rem 1.5rem;
    border-top: 2px solid #eee;
}

.cart-subtotal {
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.checkout-btn {
    display: block;
    width: 100%;
    padding: 1rem;
    background: #2c5530;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background 0.3s;
}

.checkout-btn:hover:not(:disabled) {
    background: #4a7c59;
}

.checkout-btn:disabled {
    background: #bbb;
    cursor: not-allowed;
}

.cart-empty {
    text-align: center;
    color: #888;
    padding: 3rem 1rem;
}

.cart-empty i {
    font-size: 3rem;
    opacity: 0.3;
    margin-bottom: 1rem;
}

/* ---- Checkout page ---- */
.checkout-wrap {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem 4rem;
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 2rem;
    align-items: start;
}

.checkout-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    padding: 2rem;
}

.checkout-card h2 {
    color: #2c5530;
    font-family: 'Montserrat', sans-serif;
    margin-top: 0;
    font-size: 1.4rem;
}

.form-row {
    margin-bottom: 1rem;
}

.form-row label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: #444;
    font-size: 0.95rem;
}

.form-row input,
.form-row select {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 1rem;
    box-sizing: border-box;
}

.form-row input:focus {
    outline: none;
    border-color: #2c5530;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.shipping-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    padding: 0.9rem 1rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.shipping-option:hover {
    border-color: #4a7c59;
}

.shipping-option.selected {
    border-color: #2c5530;
    background: #e8f5e9;
}

.shipping-option .ship-name {
    font-weight: 600;
    color: #333;
}

.shipping-option .ship-eta {
    font-size: 0.85rem;
    color: #666;
}

.shipping-option .ship-price {
    margin-left: auto;
    font-weight: 700;
    color: #2c5530;
    font-size: 1.05rem;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    color: #555;
}

.summary-line.total {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2c5530;
    border-top: 2px solid #eee;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
}

.checkout-error {
    background: #ffebee;
    color: #c62828;
    border-radius: 8px;
    padding: 0.9rem 1rem;
    margin: 1rem 0;
    display: none;
}

.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255,255,255,0.4);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    .checkout-wrap {
        grid-template-columns: 1fr;
    }

    .cart-fab {
        bottom: 1rem;
        right: 1rem;
    }
}
