/**
 * WooCommerce Custom Styles for JMS Theme
 * Bridges compatibility between old template versions and new WooCommerce 9.x
 */

/* ==========================================================================
   Account Pages - General Fixes
   ========================================================================== */

/* Ensure WooCommerce wrapper has proper styling */
.woocommerce-page .woocommerce,
.woocommerce-account .woocommerce {
    width: 100%;
}

/* My Account Navigation */
.woocommerce-MyAccount-navigation ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.woocommerce-MyAccount-navigation ul li {
    margin-bottom: 0.5em;
}

.woocommerce-MyAccount-navigation ul li a {
    display: block;
    padding: 1em;
    background: #f5f5f5;
    text-decoration: none;
    color: #333;
    border-radius: 4px;
    transition: background 0.3s ease;
}

.woocommerce-MyAccount-navigation ul li.is-active a,
.woocommerce-MyAccount-navigation ul li a:hover {
    background: var(--bs-primary, #d7454d);
    color: #fff;
}

/* My Account Content Area */
.woocommerce-MyAccount-content {
    padding: 0;
}

/* ==========================================================================
   Forms
   ========================================================================== */

/* Form fields */
.woocommerce form .form-row {
    margin: 0 0 1.5em;
}

.woocommerce form .form-row label {
    display: block;
    margin-bottom: 0.5em;
    font-weight: 600;
}

.woocommerce form .form-row input.input-text,
.woocommerce form .form-row textarea,
.woocommerce form .form-row select {
    width: 100%;
    padding: 0.75em;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

.woocommerce form .form-row input.input-text:focus,
.woocommerce form .form-row textarea:focus,
.woocommerce form .form-row select:focus {
    border-color: var(--bs-primary, #d7454d);
    outline: none;
}

/* Buttons */
.woocommerce button.button,
.woocommerce a.button,
.woocommerce input.button {
    background: var(--bs-primary, #d7454d);
    color: #fff;
    padding: 1em 2em;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-weight: 700;
    text-transform: uppercase;
    transition: background 0.3s ease;
}

.woocommerce button.button:hover,
.woocommerce a.button:hover,
.woocommerce input.button:hover {
    background: var(--bs-dark-red, #cf0c2c);
}

/* ==========================================================================
   Tables
   ========================================================================== */

.woocommerce table.my_account_orders,
.woocommerce table.shop_table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2em;
}

.woocommerce table.my_account_orders th,
.woocommerce table.shop_table th {
    background: #f5f5f5;
    padding: 1em;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #ddd;
}

.woocommerce table.my_account_orders td,
.woocommerce table.shop_table td {
    padding: 1em;
    border-bottom: 1px solid #eee;
}

.woocommerce table.my_account_orders tr:hover td,
.woocommerce table.shop_table tr:hover td {
    background: #fafafa;
}

/* Order status badges */
.woocommerce-order-status {
    display: inline-block;
    padding: 0.5em 1em;
    border-radius: 4px;
    font-size: 0.875em;
    font-weight: 600;
    text-transform: uppercase;
}

.woocommerce-order-status.status-completed {
    background: #4caf50;
    color: #fff;
}

.woocommerce-order-status.status-processing {
    background: #ff9800;
    color: #fff;
}

.woocommerce-order-status.status-on-hold {
    background: #ffc107;
    color: #333;
}

.woocommerce-order-status.status-pending {
    background: #999;
    color: #fff;
}

.woocommerce-order-status.status-cancelled,
.woocommerce-order-status.status-refunded,
.woocommerce-order-status.status-failed {
    background: #f44336;
    color: #fff;
}

/* ==========================================================================
   Addresses
   ========================================================================== */

.woocommerce-Address {
    margin-bottom: 2em;
    padding: 1.5em;
    background: #f9f9f9;
    border-radius: 4px;
}

.woocommerce-Address-title h3 {
    margin-top: 0;
}

.woocommerce-Address address {
    font-style: normal;
    margin-bottom: 1em;
}

/* ==========================================================================
   Downloads
   ========================================================================== */

.woocommerce-MyAccount-downloads {
    margin: 2em 0;
}

.woocommerce-MyAccount-downloads table {
    width: 100%;
}

/* ==========================================================================
   Payment Methods
   ========================================================================== */

.woocommerce-PaymentMethods {
    list-style: none;
    padding: 0;
    margin: 0 0 2em;
}

.woocommerce-PaymentMethod {
    padding: 1.5em;
    background: #f9f9f9;
    margin-bottom: 1em;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ==========================================================================
   Messages & Notices
   ========================================================================== */

.woocommerce-message,
.woocommerce-error,
.woocommerce-info {
    padding: 1em 1.5em;
    margin-bottom: 2em;
    border-radius: 4px;
    border-left: 4px solid;
}

.woocommerce-message {
    background: #f0f9ff;
    border-color: #0288d1;
    color: #01579b;
}

.woocommerce-error {
    background: #ffebee;
    border-color: #c62828;
    color: #b71c1c;
}

.woocommerce-info {
    background: #fff9c4;
    border-color: #f57f17;
    color: #f57f17;
}

/* ==========================================================================
   Responsive Fixes
   ========================================================================== */

@media (max-width: 768px) {
    .woocommerce table.my_account_orders,
    .woocommerce table.shop_table {
        font-size: 0.9em;
    }

    .woocommerce table.my_account_orders th,
    .woocommerce table.shop_table th,
    .woocommerce table.my_account_orders td,
    .woocommerce table.shop_table td {
        padding: 0.5em;
    }
}

/* ==========================================================================
   Custom Theme Integration
   ========================================================================== */

/* Ensure theme custom wrappers don't break WooCommerce layout */
.jms-member-portal .woocommerce {
    width: 100%;
}

.jms-section .woocommerce-MyAccount-content {
    width: 100%;
}

/* ==========================================================================
   Login with OTP Plugin - Match .jms-member-login-acc Link Styling
   ========================================================================== */

/* Style the OTP button to look like the register/lost password links */
.xoo-ml-open-lwo-btn.button {
    /* Remove default button styling */
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    text-transform: none !important;

    /* Match link styling */
    color: var(--bs-skyblue, #40b8bb) !important;
    font-weight: 700 !important;
    font-size: 2rem !important;
    font-style: italic !important;
    line-height: inherit !important;
    cursor: pointer !important;
    text-decoration: none !important;
    display: inline-block !important;
    transition: color 0.15s ease, text-decoration 0.15s ease !important;
}

.xoo-ml-open-lwo-btn.button:hover {
    text-decoration: underline !important;
    color: var(--bs-skyblue, #40b8bb) !important;
}

/* Wrap OTP button in .jms-member-login-acc structure if not already wrapped */
.woocommerce-form-login .xoo-ml-open-lwo-btn.button {
    display: block !important;
    width: 100% !important;
    text-align: left !important;
    margin-bottom: 1.5em !important;
}

[dir="rtl"] .woocommerce-form-login .xoo-ml-open-lwo-btn.button {
    text-align: right !important;
}

/* ==========================================================================
   Lost Password Page - Fix Block Theme Wrapper Issues
   ========================================================================== */

/* Hide the page title that block theme adds */
body.woocommerce-lost-password .wp-block-post-title,
body.woocommerce-lost-password .wp-block-spacer {
    display: none !important;
}

/* Remove constrained layout max-width for lost password page */
body.woocommerce-lost-password .wp-block-post-content {
    max-width: none !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Remove margin/padding from main wrapper */
body.woocommerce-lost-password main.wp-block-group {
    padding: 0 !important;
    margin: 0 !important;
}

body.woocommerce-lost-password .wp-block-group {
    padding: 0 !important;
    margin: 0 !important;
}

/* Lost Password Form - WooCommerce Notices Styling */
.jms-member-login-box .woocommerce-message,
.jms-member-login-box .woocommerce-error,
.jms-member-login-box .woocommerce-info {
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
}

.jms-member-login-box .woocommerce-message {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.jms-member-login-box .woocommerce-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.jms-member-login-box .woocommerce-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.jms-member-login-box .woocommerce-message ul,
.jms-member-login-box .woocommerce-error ul,
.jms-member-login-box .woocommerce-info ul {
    margin: 0;
    padding: 0;
    list-style: none;
}
