/**
 * Mighty CRM Integration Styles
 * Native, optimized product pages with modern layout
 */

:root {
    --mighty-primary: #0A1E5E;
    --mighty-primary-dark: #061440;
    --mighty-secondary: #0A1E5E;
    --mighty-border: #ddd;
    --mighty-bg: #f5f5f5;
    --mighty-text: #333;
    --mighty-success: #28a745;
    --mighty-error: #dc3545;
    --mighty-radius: 8px;
    --mighty-shadow: 0 1px 3px rgba(0,0,0,0.08);
    --mighty-shadow-hover: 0 4px 16px rgba(0,0,0,0.12);
}

/* Base layout */
.mighty-products-archive,
.mighty-product-single,
.mighty-cart,
.mighty-checkout {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

.mighty-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Breadcrumbs */
.mighty-breadcrumb {
    margin-bottom: 20px;
    font-size: 0.875rem;
    color: #666;
}

.mighty-breadcrumb a {
    color: var(--mighty-primary);
    text-decoration: none;
}

.mighty-breadcrumb a:hover {
    text-decoration: underline;
}

.mighty-breadcrumb-sep {
    margin: 0 6px;
    opacity: 0.6;
}

.mighty-breadcrumb-current {
    color: var(--mighty-text);
}

/* Screen reader utility */
.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* Archive header */
.mighty-archive-header {
    margin-bottom: 32px;
}

.mighty-archive-title {
    margin: 0 0 8px 0;
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 800;
    color: #111827;
    letter-spacing: -0.03em;
}

.mighty-archive-meta {
    margin: 0;
    font-size: 0.9375rem;
    color: #6b7280;
}

/* Search bar */
.mighty-search-bar {
    margin-bottom: 24px;
}
.mighty-search-form {
    position: relative;
    max-width: 440px;
}
.mighty-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
}
.mighty-search-form input[type="search"] {
    width: 100%;
    padding: 14px 16px 14px 46px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 15px;
    background: #f9fafb;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.mighty-search-form input[type="search"]:focus {
    outline: none;
    border-color: #0A1E5E;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(10, 30, 94, 0.08);
}

/* Category pill filters */
.mighty-category-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 32px;
}
.mighty-pill {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    border: 1.5px solid #e5e7eb;
    color: #374151;
    background: #fff;
    transition: all 0.25s ease;
    white-space: nowrap;
}
.mighty-pill:hover {
    border-color: #0A1E5E;
    color: #0A1E5E;
    background: #f0f4ff;
}
.mighty-pill--active {
    background: #0A1E5E;
    color: #fff;
    border-color: #0A1E5E;
    box-shadow: 0 2px 8px rgba(10, 30, 94, 0.2);
}
.mighty-pill--active:hover {
    background: #061440;
    color: #fff;
    border-color: #061440;
}

/* Legacy filter form support */
.mighty-product-filters,
.product-filters {
    margin-bottom: 32px;
    padding: 20px 24px;
    background: #fff;
    border-radius: var(--mighty-radius);
    box-shadow: var(--mighty-shadow);
}
.mighty-filter-form,
.filter-form {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}
.mighty-filter-btn,
.filter-form button {
    padding: 10px 20px;
    background: var(--mighty-primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    transition: background 0.2s;
}
.mighty-filter-btn:hover,
.filter-form button:hover {
    background: var(--mighty-primary-dark);
}

/* Products grid - modern responsive */
.mighty-products-grid,
.products-grid {
    margin-top: 24px;
}

.mighty-product-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
}

/* Product card - modern elevated design */
.mighty-product-card,
.product-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    border: 1px solid #f0f0f0;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 0.3s ease;
}

.mighty-product-card:hover,
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0,0,0,0.08), 0 4px 10px rgba(0,0,0,0.04);
    border-color: transparent;
}

.mighty-product-card-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.mighty-product-card-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    text-decoration: none;
    color: inherit;
}

.mighty-product-card-link:hover .mighty-product-cta {
    background: #0A1E5E;
    color: #fff;
}

/* Product image - clean ratio */
.mighty-product-image,
.product-image {
    position: relative;
    overflow: hidden;
    background: #f8f9fa;
    aspect-ratio: 4/3;
    flex-shrink: 0;
}

.mighty-product-image img,
.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.mighty-product-card:hover .mighty-product-image img,
.product-card:hover .product-image img {
    transform: scale(1.06);
}

.mighty-product-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 4/3;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.mighty-placeholder-text {
    font-size: 0.75rem;
    color: #adb5bd;
    font-weight: 500;
}

/* Product info - clean spacing */
.mighty-product-info,
.product-info {
    padding: 16px 18px 18px;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    text-align: left;
}

.mighty-product-category {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #0A1E5E;
    background: #eef2ff;
    padding: 3px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
    width: fit-content;
}

h2.mighty-product-title,
.mighty-product-title,
.product-info h3 {
    margin: 0 0 10px 0 !important;
    font-size: 0.9375rem !important;
    font-weight: 600 !important;
    line-height: 1.35 !important;
    letter-spacing: -0.01em;
    display: block !important;
    overflow: hidden;
    max-height: 2.7em;
}

.mighty-product-title a,
.product-info h3 a {
    color: #1a1a2e !important;
    font-size: 0.9375rem !important;
    text-decoration: none;
    transition: color 0.2s;
}

.mighty-product-title a:hover,
.product-info h3 a:hover {
    color: #0A1E5E !important;
}

/* Excerpt - hidden for compact cards */
.mighty-product-excerpt,
.product-description {
    display: none;
}

/* Price block - modern layout */
.mighty-product-price-wrap,
.mighty-product-price-block {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #f3f4f6;
}

.mighty-product-price-original {
    font-size: 0.8rem;
    font-weight: 500;
    color: #9ca3af;
    text-decoration: line-through;
}

.mighty-product-price,
.product-price {
    display: inline !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
    color: #111827 !important;
}

.mighty-product-price-suffix,
.mighty-product-price-note {
    display: inline;
    font-size: 0.7rem;
    font-weight: 500;
    color: #6b7280;
    margin-left: 4px;
}

.mighty-product-cta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #0A1E5E;
    margin-top: 12px;
    padding: 8px 16px;
    border: 1.5px solid #0A1E5E;
    border-radius: 6px;
    transition: all 0.25s ease;
    text-align: center;
    justify-content: center;
}

/* Empty state */
.mighty-empty-state {
    padding: 40px 24px;
    text-align: center;
    background: #fff;
    border-radius: var(--mighty-radius);
    border: 1px dashed var(--mighty-border);
}

.mighty-empty-title {
    margin: 0 0 8px 0;
    font-size: 1.125rem;
    font-weight: 600;
}

/* Legacy compatibility */
.view-product-button,
.add-to-cart-button {
    width: 100%;
    padding: 12px 20px;
    background: var(--mighty-primary);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    text-align: center;
    transition: all 0.2s;
    margin-top: auto;
}

.view-product-button:hover,
.add-to-cart-button:hover {
    background: var(--mighty-primary-dark);
    transform: translateY(-1px);
}

/* Single Product - Now uses modal design */
.mighty-product-single {
    padding: 20px;
}

/* Legacy styles for backwards compatibility */
.product-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    margin-top: 30px;
}

.product-images {
    position: sticky;
    top: 20px;
    height: fit-content;
}

.product-images img {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.product-info h1 {
    font-size: 2em;
    margin: 0 0 15px 0;
    font-weight: 700;
    color: var(--mighty-text);
}

.product-description {
    font-size: 1em;
    line-height: 1.6;
    color: #666;
    margin: 20px 0;
}

.product-price {
    font-size: 1.8em;
    font-weight: 700;
    color: #111827;
    margin: 20px 0;
}

.cart-success-message {
    padding: 15px;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 6px;
    margin: 15px 0;
    color: #155724;
}

.cart-success-message a {
    color: #155724;
    text-decoration: underline;
    font-weight: 600;
}

/* Mini Cart Widget */
.mighty-mini-cart {
    position: relative;
    display: inline-block;
}

.mighty-mini-cart-icon {
    position: relative;
    cursor: pointer;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--mighty-text);
    text-decoration: none;
    transition: color 0.3s;
}

.mighty-mini-cart-icon:hover {
    color: #111827;
}

.mighty-mini-cart-icon svg {
    width: 26px;
    height: 26px;
}

/* Hide the "Cart" text label */
.mighty-cart-text {
    display: none;
}

.mighty-cart-count {
    position: absolute;
    top: 2px;
    right: -2px;
    background: #059669;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}

.mighty-cart-count:empty {
    display: none;
}

/* Sidebar Cart */
.mighty-sidebar-cart {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    z-index: 9999;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.mighty-sidebar-cart.open {
    right: 0;
}

.mighty-sidebar-cart-header {
    padding: 20px;
    border-bottom: 2px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    color: #111827;
}

.mighty-sidebar-cart-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.mighty-sidebar-cart-header h3 {
    margin: 0;
    font-size: 1.2em;
    font-weight: 600;
}

.mighty-sidebar-cart-close {
    background: none;
    border: none;
    color: #6b7280;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.3s, color 0.3s;
}

.mighty-sidebar-cart-close:hover {
    background: #f3f4f6;
    color: #111827;
}

.mighty-sidebar-cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.mighty-sidebar-cart-item {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}

.mighty-sidebar-cart-item-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
}

.mighty-sidebar-cart-item-info {
    flex: 1;
}

.mighty-sidebar-cart-item-name {
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 14px;
}

.mighty-sidebar-cart-item-attributes {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.mighty-sidebar-cart-item-price {
    font-weight: 700;
    color: #111827;
    font-size: 14px;
}

.mighty-sidebar-cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.mighty-sidebar-cart-item-quantity input {
    width: 60px;
    padding: 5px;
    border: 1px solid var(--mighty-border);
    border-radius: 4px;
    text-align: center;
}

.mighty-sidebar-cart-item-remove {
    background: none;
    border: none;
    color: var(--mighty-error);
    cursor: pointer;
    padding: 5px;
    font-size: 18px;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.mighty-sidebar-cart-item-remove:hover {
    opacity: 1;
}

.mighty-sidebar-cart-footer {
    padding: 20px;
    border-top: 2px solid var(--mighty-border);
    background: #f9f9f9;
}

.mighty-sidebar-cart-subtotal {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-weight: 600;
}

.mighty-sidebar-cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.2em;
    font-weight: 700;
    color: #111827;
    padding-top: 10px;
    border-top: 1px solid var(--mighty-border);
    margin-top: 10px;
}

.mighty-sidebar-cart-actions {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mighty-sidebar-cart-actions .button {
    width: 100%;
    text-align: center;
}

.mighty-sidebar-cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.mighty-sidebar-cart-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* Cart Page */
.cart-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.cart-table th {
    background: var(--mighty-bg);
    padding: 15px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--mighty-border);
}

.cart-table td {
    padding: 15px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.cart-item-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 15px;
}

.cart-quantity {
    width: 80px;
    padding: 8px;
    border: 1px solid var(--mighty-border);
    border-radius: 4px;
    text-align: center;
}

.cart-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
}

/* Checkout */
.checkout-columns {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 50px;
    margin-top: 30px;
}

.checkout-form h2 {
    margin-top: 30px;
    margin-bottom: 20px;
    font-size: 1.5em;
    font-weight: 600;
    color: var(--mighty-text);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.payment-methods {
    margin-top: 20px;
}

.payment-methods label {
    display: block;
    margin-bottom: 15px;
    padding: 15px;
    border: 2px solid var(--mighty-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
}

.payment-methods label:hover {
    border-color: var(--mighty-primary);
    background: #f9f9f9;
}

.payment-methods input[type="radio"]:checked + strong,
.payment-methods label:has(input[type="radio"]:checked) {
    border-color: var(--mighty-primary);
    background: #f0f7ff;
}

.payment-methods input[type="radio"] {
    margin-right: 10px;
}

.payment-methods strong {
    display: block;
    margin-bottom: 5px;
}

.payment-methods small {
    display: block;
    color: #666;
    font-size: 0.9em;
    margin-top: 5px;
}

.order-items {
    margin-bottom: 25px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--mighty-border);
}

.order-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.order-item:last-child {
    border-bottom: none;
}

.order-totals {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 2px solid var(--mighty-border);
}

.total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 1em;
}

.total-row.total {
    font-size: 1.4em;
    font-weight: 700;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid var(--mighty-border);
    color: #111827;
}

.button {
    display: inline-block;
    padding: 12px 24px;
    background: var(--mighty-primary);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s;
}

.button:hover {
    background: var(--mighty-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.button-primary {
    background: var(--mighty-secondary);
}

.button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Checkout — Place Order full-width at bottom */
.checkout-place-order {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 2px solid var(--mighty-border);
    text-align: center;
}
.checkout-place-order-btn {
    width: 100%;
    max-width: 480px;
    padding: 16px 32px !important;
    font-size: 1.1rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.02em;
}
.checkout-terms-note {
    margin-top: 12px;
    font-size: 0.8125rem;
    color: #6b7280;
}
.checkout-terms-note a {
    color: var(--mighty-primary);
    text-decoration: underline;
}

/* Checkout — Order summary sticky */
.order-summary-sticky {
    position: sticky;
    top: 100px;
}

/* Checkout — Delivery/Collection card */
.delivery-collection-card {
    border: 1px solid var(--mighty-border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}
.delivery-method-choice {
    margin-bottom: 16px;
}
.delivery-method-option {
    display: block;
    padding: 12px 14px;
    margin-bottom: 8px;
    border: 2px solid var(--mighty-border);
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.delivery-method-option:hover {
    border-color: #9ca3af;
}
.delivery-method-option:has(input:checked) {
    border-color: var(--mighty-primary);
    background: #f0f7ff;
}
.delivery-method-option small {
    display: block;
    color: #666;
    margin-top: 4px;
    font-size: 0.85em;
}
.delivery-calculator-hidden { display: none; }
.delivery-postcode-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}
.delivery-postcode-group { flex: 1; }
.delivery-btn-group { display: flex; align-items: flex-end; }
.delivery-result-hidden { display: none; }
.delivery-result-box {
    margin-top: 12px;
    padding: 12px;
    background: #e8f5e9;
    border-radius: 6px;
    border: 1px solid #a5d6a7;
}
.delivery-result-text { margin: 0; font-weight: 600; }
.delivery-result-details { margin: 4px 0 0 0; font-size: 14px; color: #2e7d32; }
.delivery-error-box {
    margin-top: 12px;
    padding: 12px;
    background: #ffebee;
    border-radius: 6px;
    border: 1px solid #ef9a9a;
    color: #c62828;
}
.delivery-error-box p { margin: 0; }
.delivery-loading { margin-top: 12px; color: #666; }

/* Checkout — Payment method options */
.payment-method-option {
    display: block;
    padding: 12px 14px;
    margin-bottom: 10px;
    border: 2px solid var(--mighty-border);
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.payment-method-option:hover {
    border-color: #9ca3af;
}
.payment-method-option:has(input:checked) {
    border-color: var(--mighty-primary);
    background: #f0f7ff;
}
.payment-method-option small {
    display: block;
    color: #666;
    margin-top: 4px;
    font-size: 0.85em;
}
.shipping-fields-hidden { display: none; }
.stripe-element-hidden { display: none; }
.checkout-checkbox-label { cursor: pointer; }

/* Responsive - mobile first enhancements */
@media (max-width: 768px) {
    .mighty-products-archive,
    .mighty-product-single {
        padding: 16px;
    }

    .mighty-product-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .mighty-product-info,
    .product-info {
        padding: 12px 14px 14px;
    }

    .mighty-product-title,
    .product-info h3,
    .mighty-product-title a,
    .product-info h3 a {
        font-size: 0.8125rem !important;
    }

    .mighty-product-cta {
        font-size: 0.7rem;
        padding: 6px 12px;
    }

    .mighty-category-pills {
        gap: 6px;
    }

    .mighty-pill {
        padding: 8px 14px;
        font-size: 0.8rem;
    }
    
    .mighty-filter-form,
    .filter-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .mighty-filter-form input,
    .mighty-filter-form select,
    .filter-form input,
    .filter-form select {
        min-width: 100%;
    }
    
    .product-details,
    .checkout-columns {
        grid-template-columns: 1fr;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .mighty-sidebar-cart {
        width: 100%;
        right: -100%;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}
