/* ========================================================
   WooCommerce Global Visual Overrides (Cart, Checkout, Account)
   ======================================================== */

/* --- 1. Order Received Page Titles --- */
.woocommerce-checkout .woocommerce-thankyou-order-received,
.woocommerce-order .woocommerce-order-details__title,
.woocommerce-cart .cart-title,
.woocommerce-checkout .checkout-title {
    font-family: 'Cormorant Garamond', 'Playfair Display', serif;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    color: #889C9B; /* Primary */
    text-align: center;
    margin-bottom: 2rem;
    font-weight: 600;
}

/* --- 2. Order Overview (Thank you page top box) --- */
.woocommerce-order-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1.5rem;
    background: #f9fafb; 
    border: none !important;
    border-radius: 1rem;
    padding: 2rem !important;
    list-style: none;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.04), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
    margin-bottom: 3rem !important;
}

.woocommerce-order-overview li {
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    color: #6b7280;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.woocommerce-order-overview li strong {
    color: #2C3E50;
    font-size: 1.125rem;
    text-transform: none;
    letter-spacing: normal;
}

/* --- 3. Shop Tables (Cart, Checkout, Order Details) --- */
table.shop_table {
    border: 1px solid #f3f4f6 !important;
    border-radius: 1rem !important;
    border-collapse: separate !important;
    border-spacing: 0;
    overflow: hidden;
    width: 100%;
    margin-bottom: 2rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
}

table.shop_table th {
    background-color: #f9fafb;
    color: #4b5563;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    padding: 1.25rem 1rem !important;
    border-bottom: 1px solid #e5e7eb !important;
}

table.shop_table td {
    padding: 1.5rem 1rem !important;
    border-bottom: 1px solid #f3f4f6 !important;
    vertical-align: middle;
}

table.shop_table tbody tr:last-child td {
    border-bottom: none !important;
}

/* --- 4. Product Meta Data Capsules (The variations/Customizations) --- */
td.product-name .wc-item-meta {
    display: none !important; /* Hidden by default, toggled via JS */
    grid-template-columns: 140px 1fr; /* Image left, attributes right */
    gap: 16px 24px;
    margin-top: 1rem !important;
    padding: 1.25rem !important;
    background-color: #f9fafb !important;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
}

/* Styles for the inner wrapper that JS will create to hold the text attributes */
.cic-meta-attributes-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr; /* 2 columns for text attributes to save height */
    gap: 12px 20px;
    align-content: start;
    width: 100%;
}

/* The wrapper holding a single property pair (Name + Value) */
.cic-meta-attr-pair {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Styles for the "Show Details" toggle button injected by JS */
.cic-toggle-meta-btn {
    display: block;
    margin-top: 12px;
    background: none;
    border: none;
    color: #889C9B;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s ease;
}
.cic-toggle-meta-btn:hover {
    color: #2C3E50;
    text-decoration: underline;
}

td.product-name .wc-item-meta dt,
td.product-name .wc-item-meta dd,
td.product-name .wc-item-meta li {
    margin: 0 !important;
    padding: 0 !important;
}

td.product-name .wc-item-meta dt,
td.product-name .wc-item-meta strong,
.cic-meta-attr-pair dt {
    font-size: 0.7rem;
    color: #6b7280;
    font-weight: 600;
    text-transform: uppercase;
    text-align: left;
    border: none !important;
}

td.product-name .wc-item-meta dd,
td.product-name .wc-item-meta p,
.cic-meta-attr-pair dd {
    color: #374151;
    font-size: 0.875rem;
    font-weight: 500;
    margin: 0 !important;
    word-break: break-word; 
    text-align: left;
}

/* Hide the raw textual WooCommerce output of the long URL after the JS converts it to image */
td.product-name .wc-item-meta p {
    line-height: 1.4;
}td.product-name .wc-item-meta a {
    display: inline-block;
    max-width: fit-content;
}

/* --- 5. Customer Details Block --- */
.woocommerce-customer-details {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    padding: 2rem;
    margin-top: 2rem;
}
.woocommerce-customer-details h2 {
    font-family: 'Cormorant Garamond', 'Playfair Display', serif;
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: #2C3E50;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 1rem;
}
.woocommerce-customer-details address {
    font-style: normal;
    color: #4b5563;
    line-height: 1.8;
}

/* --- Responsive Overrides --- */
@media (max-width: 768px) {
    .woocommerce-order-overview {
        grid-template-columns: 1fr 1fr;
        padding: 1.5rem !important;
    }
    table.shop_table {
        display: block;
        width: 100%;
    }
    table.shop_table thead {
        display: none; /* Hide headers on mobile for a card-like layout */
    }
    table.shop_table tbody,
    table.shop_table tr,
    table.shop_table td {
        display: block;
        width: 100%;
        text-align: left !important;
    }
    table.shop_table td {
        padding: 1rem !important;
        border-bottom: 1px solid #f3f4f6 !important;
    }
    
    /* Make the meta card stack vertically on mobile */
    td.product-name .wc-item-meta {
        grid-template-columns: 1fr !important;
    }
    
    /* Center the image on mobile if it stacks */
    .cic-meta-image-wrapper {
        margin: 0 auto 1rem auto;
        justify-content: center;
    }
    
    /* The attributes grid goes to 1 column on very small screens, or stays 2 columns if width allows */
    .cic-meta-attributes-grid {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }
}
