/* ==========================================================================
   Storefront Overrides
   Aggressive resets and overrides for the parent theme
   ========================================================================== */

/* Nuclear Option: Reset Schema & Global Styles */
body,
#page,
.site-content,
.site-main,
.content-area,
#primary {
    background-color: #ffffff !important;
    color: var(--color-neutral-800) !important;
    color: var(--color-neutral-800) !important;
}

/* Fix for "Footer on Side" - Clear layouts */
.container {
    display: flow-root !important;
}

/* Ensure Product content also respects this */
.product,
.hentry {
    background-color: #ffffff !important;
}

/* 
 * CRITICAL HEADER ACTION FIXES
 * These ensure icons are visible and override Storefront's button styles.
 */
.header-actions svg {
    fill: none !important;
    stroke: #475569 !important;
    width: 18px !important;
    height: 18px !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.header-actions button:hover svg,
.header-actions a:hover svg {
    stroke: #0f172a !important;
}

/* Reset Storefront overrides on header action buttons */
.header-actions button,
.header-actions .search-toggle,
.header-actions .account-toggle,
.header-actions .cart-toggle {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    color: #475569 !important;
    box-shadow: none !important;
    padding: 0 !important;
    min-width: unset !important;
    min-height: unset !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.cart-drawer-close {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    padding: 0 !important;
    color: #475569 !important;
}

.cart-drawer-close svg {
    stroke: #475569 !important;
}

/* Ensure Search Submit Icon is Visible - Button needs background */
.search-popup-form button[type="submit"] {
    background-color: var(--color-primary-600) !important;
    padding: 8px !important;
    border-radius: var(--radius-md) !important;
}

.header-actions button:hover,
.header-actions .search-toggle:hover,
.header-actions .account-toggle:hover,
.header-actions .cart-toggle:hover {
    background: var(--color-neutral-100) !important;
    background-color: var(--color-neutral-100) !important;
    color: #0f172a !important;
}

/* Ensure Search Submit Icon is Visible */
.search-popup-form button[type="submit"] svg {
    stroke: #ffffff !important;
}

/* Cart Drawer Close Button Fix */
.cart-drawer-close {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.cart-drawer-close:hover {
    background: var(--color-neutral-100) !important;
}

/* ==========================================================================
   Storefront Component Overrides
   ========================================================================== */

/* Buttons */
button,
input[type="button"],
input[type="reset"],
input[type="submit"],
.button,
.widget a.button,
.added_to_cart,
.wc-block-grid__products .wc-block-grid__product .wp-block-button__link {
    background-color: var(--color-primary-600) !important;
    color: #ffffff !important;
    border-radius: var(--radius-md) !important;
    font-weight: 500 !important;
    padding: 0.75rem 1.5rem !important;
    transition: all 0.2s ease !important;
}

button:hover,
input[type="button"]:hover,
input[type="reset"]:hover,
input[type="submit"]:hover,
.button:hover,
.widget a.button:hover,
.added_to_cart:hover,
.wc-block-grid__products .wc-block-grid__product .wp-block-button__link:hover {
    background-color: var(--color-primary-700) !important;
    color: #ffffff !important;
}

/* Exclude header actions from generic button styles */
button.search-toggle,
button.account-toggle,
button.cart-toggle,
.header-actions button {
    background-color: transparent !important;
    color: inherit !important;
    padding: 0 !important;
}

/* Typography Overrides */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--color-neutral-900) !important;
    font-family: var(--font-heading) !important;
}

body,
p,
li,
a {
    font-family: var(--font-body);
}

/* Page Content Typography (for About, Contact, etc.) */
.entry-content {
    max-width: 800px;
    /* Optimal reading width */
    margin: 0 auto;
    font-size: var(--text-base);
    line-height: 1.75;
}

.entry-content p {
    margin-bottom: var(--space-4);
}

.entry-content h1,
.entry-content h2,
.entry-content h3 {
    margin-top: var(--space-8);
    margin-bottom: var(--space-4);
    font-weight: var(--font-bold);
}

.entry-content ul,
.entry-content ol {
    margin-bottom: var(--space-4);
    padding-left: var(--space-4);
}

.entry-content li {
    margin-bottom: var(--space-2);
}

/* WooCommerce Overrides */
.onsale {
    background-color: var(--color-secondary-500) !important;
    color: #ffffff !important;
    border-radius: var(--radius-sm) !important;
}

/* Fix product image aspect ratios - preventing "tall" images */
.wc-block-grid__product-image img,
.product_list_widget img,
ul.products li.product img,
.product img {
    aspect-ratio: 1 / 1 !important;
    object-fit: cover !important;
    width: 100% !important;
    height: auto !important;
}

.price {
    font-family: var(--font-mono);
    color: var(--color-neutral-900) !important;
}

.star-rating span {
    color: var(--color-warning) !important;
}

/* Ensure mini-cart remove button is visible */
.widget_shopping_cart .remove_from_cart_button,
.woocommerce-mini-cart-item .remove {
    color: var(--color-error) !important;
    font-weight: bold !important;
    opacity: 1 !important;
}

/* ==========================================================================
   Footer Overrides (Dark Theme for "Premium" feel + Payment Icon Visibility)
   ========================================================================== */
.site-footer {
    background-color: var(--color-neutral-900) !important;
    color: var(--color-neutral-300) !important;
    padding-top: 3rem !important;
    padding-bottom: 2rem !important;
}

/* Footer Layout Fix */
.footer-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: var(--space-8);
}

@media (min-width: 768px) {
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .footer-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.footer-column {
    margin-bottom: 0 !important;
}

.site-footer h1,
.site-footer h2,
.site-footer h3,
.site-footer h4,
.site-footer h5,
.site-footer h6,
.site-footer .widget-title {
    color: #ffffff !important;
}

.site-footer a:not(.button) {
    color: var(--color-neutral-400) !important;
}

.site-footer a:not(.button):hover {
    color: #ffffff !important;
}

/* Fix social icons in dark footer */
.footer-social a {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.1);
    padding: 8px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.footer-social a:hover {
    background-color: var(--color-primary-600);
}

/* Newsletter Input in Dark Footer */
.footer-newsletter input[type="email"] {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
}

.footer-newsletter input[type="email"]::placeholder {
    color: rgba(255, 255, 255, 0.5) !important;
}

.footer-bottom {
    background-color: transparent !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 2rem;
    padding-top: 2rem;
}

/* ==========================================================================
   Account Page & Form Improvements
   ========================================================================== */

/* Account Details Form - Cleaner Look */
.woocommerce-EditAccountForm fieldset {
    border: 1px solid var(--color-neutral-200);
    padding: 2rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    background: #fff;
}

.woocommerce-EditAccountForm legend {
    font-weight: 600;
    font-size: 1.25rem;
    padding: 0 1rem;
    color: var(--color-neutral-800);
}

.woocommerce-form-row {
    margin-bottom: 1.5rem !important;
}

.woocommerce-form-row label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--color-neutral-700);
}

.woocommerce-Input {
    padding: 0.75rem 1rem !important;
    border: 1px solid var(--color-neutral-300) !important;
    border-radius: var(--radius-md) !important;
    width: 100% !important;
    font-size: 1rem !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
}

.woocommerce-Input:focus {
    border-color: var(--color-primary-500) !important;
    box-shadow: 0 0 0 3px var(--color-primary-100) !important;
    outline: none !important;
}

/* Account Navigation Sidebar */
.woocommerce-MyAccount-navigation {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
    border: 1px solid var(--color-neutral-100);
}

.woocommerce-MyAccount-navigation ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.woocommerce-MyAccount-navigation li {
    margin-bottom: 0 !important;
}

.woocommerce-MyAccount-navigation a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--color-neutral-600);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    font-weight: 500;
}

.woocommerce-MyAccount-navigation a:hover {
    background-color: var(--color-neutral-50);
    color: var(--color-primary-600);
}

.woocommerce-MyAccount-navigation li.is-active a {
    background-color: var(--color-primary-50);
    color: var(--color-primary-700);
}

/* My Account Content Area */
.woocommerce-MyAccount-content {
    background: #fff;
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-neutral-100);
}

.woocommerce-MyAccount-content p {
    color: var(--color-neutral-600);
}

.woocommerce-Message {
    background: var(--color-success);
    color: #fff;
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
}

/* Account Popup Logic */
.form-row-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}