/**
 * WooCommerce Custom Styling
 * Aligns Cart & Checkout with Trade Engine Accounts Dashboard Theme
 */

/* ============================================
   CSS Variables - Dashboard Design System
   ============================================ */
:root {
    --te-bg-primary: #0f172a;      /* slate-900 */
    --te-bg-secondary: #1e293b;    /* slate-800 */
    --te-bg-card: #1e293b;         /* slate-800 */
    --te-border-primary: #334155;  /* slate-700 */
    --te-border-secondary: #475569;/* slate-600 */
    --te-text-primary: #ffffff;
    --te-text-secondary: #cbd5e1;  /* slate-300 */
    --te-text-muted: #94a3b8;      /* slate-400 */
    --te-accent-emerald: #10b981;  /* emerald-500 */
    --te-accent-amber: #f59e0b;    /* amber-500 */
    --te-accent-blue: #3b82f6;     /* blue-500 */
    --te-accent-error: #ef4444;    /* red-500 */
}

/* ============================================
   Global WooCommerce Overrides
   ============================================ */
.woocommerce,
.woocommerce-page {
    background: var(--te-bg-primary);
    color: var(--te-text-secondary);
}

.woocommerce .woocommerce-breadcrumb {
    color: var(--te-text-muted);
    margin-bottom: 2rem;
}

.woocommerce .woocommerce-breadcrumb a {
    color: var(--te-accent-blue);
    text-decoration: none;
}

.woocommerce .woocommerce-breadcrumb a:hover {
    color: var(--te-accent-emerald);
}

/* ============================================
   Cart Page Styling
   ============================================ */
.woocommerce-cart {
    background: var(--te-bg-primary);
    min-height: 100vh;
    padding: 2rem 0;
}

.woocommerce table.shop_table {
    background: var(--te-bg-card);
    border: 1px solid var(--te-border-primary);
    border-radius: 0.75rem;
    color: var(--te-text-secondary);
    overflow: hidden;
}

.woocommerce table.shop_table thead {
    background: rgba(15, 23, 42, 0.5);
    border-bottom: 1px solid var(--te-border-primary);
}

.woocommerce table.shop_table thead th {
    color: var(--te-text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1.25rem 1.5rem;
    border: none;
}

.woocommerce table.shop_table tbody tr {
    border-bottom: 1px solid var(--te-border-primary);
    transition: background-color 0.2s;
}

.woocommerce table.shop_table tbody tr:hover {
    background: rgba(51, 65, 85, 0.3);
}

.woocommerce table.shop_table tbody td {
    color: var(--te-text-secondary);
    padding: 1.5rem;
    border: none;
    vertical-align: middle;
}

.woocommerce table.shop_table .product-name a {
    color: var(--te-accent-blue);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s;
}

.woocommerce table.shop_table .product-name a:hover {
    color: var(--te-accent-emerald);
}

.woocommerce table.shop_table .product-price,
.woocommerce table.shop_table .product-subtotal {
    color: var(--te-text-primary);
    font-weight: 700;
    font-size: 1.125rem;
}

/* Quantity Input */
.woocommerce .quantity {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.woocommerce .quantity .qty {
    background: var(--te-bg-primary);
    border: 1px solid var(--te-border-primary);
    border-radius: 0.5rem;
    color: var(--te-text-primary);
    padding: 0.5rem 1rem;
    width: 70px;
    text-align: center;
    font-weight: 600;
}

.woocommerce .quantity .qty:focus {
    outline: none;
    border-color: var(--te-accent-blue);
}

/* Remove Button */
.woocommerce a.remove {
    background: rgba(239, 68, 68, 0.1) !important;
    color: var(--te-accent-error) !important;
    border: 1px solid rgba(239, 68, 68, 0.2) !important;
    border-radius: 0.5rem !important;
    width: 32px !important;
    height: 32px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    transition: all 0.2s;
}

.woocommerce a.remove:hover {
    background: rgba(239, 68, 68, 0.2) !important;
    color: #ffffff !important;
}

/* Cart Totals */
.cart_totals {
    background: var(--te-bg-card);
    border: 1px solid var(--te-border-primary);
    border-radius: 0.75rem;
    padding: 2rem;
}

.cart_totals h2 {
    color: var(--te-text-primary);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.cart_totals table {
    background: transparent;
    border: none;
}

.cart_totals table th,
.cart_totals table td {
    border-top: 1px solid var(--te-border-primary);
    padding: 1rem 0;
    color: var(--te-text-secondary);
}

.cart_totals table .order-total th,
.cart_totals table .order-total td {
    color: var(--te-text-primary);
    font-size: 1.5rem;
    font-weight: 700;
    padding-top: 1.5rem;
}

/* Proceed to Checkout Button */
.woocommerce-cart .wc-proceed-to-checkout {
    padding: 0;
    margin-top: 1.5rem;
}

.woocommerce-cart .wc-proceed-to-checkout a.checkout-button {
    background: var(--te-accent-amber);
    color: #000000;
    border: none;
    border-radius: 0.5rem;
    padding: 1rem 2rem;
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
    width: 100%;
    display: block;
    transition: all 0.2s;
    text-decoration: none;
}

.woocommerce-cart .wc-proceed-to-checkout a.checkout-button:hover {
    background: #d97706;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

/* ============================================
   Checkout Page Styling
   ============================================ */
.woocommerce-checkout {
    background: var(--te-bg-primary);
    min-height: 100vh;
    padding: 2rem 0;
}

.woocommerce form.checkout {
    background: transparent;
}

.woocommerce .col2-set {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .woocommerce .col2-set {
        grid-template-columns: 1fr 1fr;
    }
}

/* Checkout Sections */
.woocommerce-billing-fields,
.woocommerce-additional-fields {
    background: var(--te-bg-card);
    border: 1px solid var(--te-border-primary);
    border-radius: 0.75rem;
    padding: 2rem;
    margin-bottom: 2rem;
}

.woocommerce-billing-fields h3,
.woocommerce-additional-fields h3,
.woocommerce-checkout #order_review_heading {
    color: var(--te-text-primary);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* Form Fields */
.woocommerce form .form-row {
    margin-bottom: 1.25rem;
}

.woocommerce form .form-row label {
    color: var(--te-text-muted);
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    display: block;
}

.woocommerce form .form-row label .required {
    color: var(--te-accent-error);
}

.woocommerce form .form-row input.input-text,
.woocommerce form .form-row textarea,
.woocommerce form .form-row select {
    background: var(--te-bg-primary);
    border: 1px solid var(--te-border-primary);
    border-radius: 0.5rem;
    color: var(--te-text-primary);
    padding: 0.75rem 1rem;
    width: 100%;
    transition: all 0.2s;
}

.woocommerce form .form-row input.input-text:focus,
.woocommerce form .form-row textarea:focus,
.woocommerce form .form-row select:focus {
    outline: none;
    border-color: var(--te-accent-blue);
    background: rgba(59, 130, 246, 0.05);
}

/* Order Review */
#order_review,
#order_review_heading {
    background: var(--te-bg-card);
    border: 1px solid var(--te-border-primary);
    border-radius: 0.75rem;
    padding: 2rem;
}

.woocommerce-checkout-review-order-table {
    background: transparent;
    border: none;
}

.woocommerce-checkout-review-order-table thead th {
    color: var(--te-text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1rem 0;
    border-bottom: 1px solid var(--te-border-primary);
}

.woocommerce-checkout-review-order-table tbody tr {
    border-bottom: 1px solid var(--te-border-primary);
}

.woocommerce-checkout-review-order-table tbody td {
    color: var(--te-text-secondary);
    padding: 1rem 0;
}

.woocommerce-checkout-review-order-table tfoot tr {
    border-top: 1px solid var(--te-border-primary);
}

.woocommerce-checkout-review-order-table tfoot th,
.woocommerce-checkout-review-order-table tfoot td {
    color: var(--te-text-secondary);
    padding: 1rem 0;
}

.woocommerce-checkout-review-order-table .order-total th,
.woocommerce-checkout-review-order-table .order-total td {
    color: var(--te-text-primary);
    font-size: 1.5rem;
    font-weight: 700;
    padding-top: 1.5rem;
}

/* Payment Methods */
.woocommerce-checkout #payment {
    background: transparent;
    margin-top: 1.5rem;
}

.woocommerce-checkout #payment ul.payment_methods {
    background: transparent;
    border: none;
    padding: 0;
}

.woocommerce-checkout #payment ul.payment_methods li {
    background: var(--te-bg-primary);
    border: 1px solid var(--te-border-primary);
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
    padding: 1rem;
    transition: all 0.2s;
}

.woocommerce-checkout #payment ul.payment_methods li:hover {
    border-color: var(--te-accent-blue);
}

.woocommerce-checkout #payment ul.payment_methods li input[type="radio"]:checked + label {
    color: var(--te-text-primary);
}

.woocommerce-checkout #payment div.payment_box {
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: var(--te-text-secondary);
    border-radius: 0.5rem;
    margin-top: 1rem;
    padding: 1rem;
}

/* Place Order Button */
.woocommerce-checkout #place_order {
    background: var(--te-accent-amber);
    color: #000000;
    border: none;
    border-radius: 0.5rem;
    padding: 1rem 2rem;
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    width: 100%;
    cursor: pointer;
    transition: all 0.2s;
}

.woocommerce-checkout #place_order:hover {
    background: #d97706;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

/* ============================================
   Notices & Messages
   ============================================ */
.woocommerce-message,
.woocommerce-info,
.woocommerce-error {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: var(--te-accent-emerald);
    border-radius: 0.5rem;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
}

.woocommerce-info {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.2);
    color: var(--te-accent-blue);
}

.woocommerce-error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--te-accent-error);
}

.woocommerce-message a,
.woocommerce-info a,
.woocommerce-error a {
    color: inherit;
    font-weight: 700;
    text-decoration: underline;
}

.woocommerce-message a:hover,
.woocommerce-info a:hover,
.woocommerce-error a:hover {
    text-decoration: none;
}

/* ============================================
   Buttons
   ============================================ */
.woocommerce button.button,
.woocommerce a.button,
.woocommerce input.button {
    background: var(--te-bg-secondary);
    color: var(--te-text-primary);
    border: 1px solid var(--te-border-primary);
    border-radius: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
}

.woocommerce button.button:hover,
.woocommerce a.button:hover,
.woocommerce input.button:hover {
    background: var(--te-border-secondary);
    border-color: var(--te-border-secondary);
}

.woocommerce button.button.alt,
.woocommerce a.button.alt,
.woocommerce input.button.alt {
    background: var(--te-accent-emerald);
    color: #ffffff;
    border-color: var(--te-accent-emerald);
}

.woocommerce button.button.alt:hover,
.woocommerce a.button.alt:hover,
.woocommerce input.button.alt:hover {
    background: #059669;
    border-color: #059669;
}

/* ============================================
   Loading States
   ============================================ */
.woocommerce .blockUI.blockOverlay {
    background: rgba(15, 23, 42, 0.8) !important;
}

.woocommerce .loader {
    border-color: var(--te-accent-amber) transparent transparent transparent;
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 768px) {
    .woocommerce table.shop_table {
        font-size: 0.875rem;
    }
    
    .woocommerce table.shop_table thead {
        display: none;
    }
    
    .woocommerce table.shop_table tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid var(--te-border-primary);
        border-radius: 0.75rem;
        padding: 1rem;
    }
    
    .woocommerce table.shop_table tbody td {
        display: block;
        text-align: left;
        padding: 0.5rem 0;
        border: none;
    }
    
    .woocommerce table.shop_table tbody td::before {
        content: attr(data-title) ": ";
        font-weight: 700;
        color: var(--te-text-muted);
        text-transform: uppercase;
        font-size: 0.75rem;
        letter-spacing: 0.05em;
    }
}

