/**
 * Product Page Styles
 * 
 * @package ChildTheme_Clean
 */

/* ============================================
   SINGLE PRODUCT PAGE LAYOUT
   ============================================ */

.product-page {
    padding: 2rem 0;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
}

.product-page-container {
    display: flex;
    gap: 3rem;
    align-items: flex-start;
}

/* ============================================
   PRODUCT GALLERY (LEFT COLUMN)
   ============================================ */

.product-gallery {
    flex: 0 0 60%;
    max-width: 60%;
}

.product-image-main-wrapper {
    width: 100%;
    margin-bottom: 1rem;
    border-radius: 0.5rem;
    overflow: hidden;
    background: #f9fafb;
}

.product-image-main {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    aspect-ratio: 1 / 1;
}

.product-thumbnails {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.product-thumbnail-wrapper {
    border-radius: 0.5rem;
    overflow: hidden;
    cursor: pointer;
    transition: opacity 0.2s ease;
    background: #f9fafb;
    aspect-ratio: 1 / 1;
}

.product-thumbnail-wrapper:hover {
    opacity: 0.8;
}

.product-thumbnail-wrapper.active {
    border: 2px solid #3B82F6;
}

.product-image-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ============================================
   PRODUCT SUMMARY (RIGHT COLUMN)
   ============================================ */

.product-summary {
    flex: 0 0 40%;
    max-width: 40%;
    padding-left: 1rem;
    position: relative;
    overflow: visible;
}

.product-badge {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    background: #FEF3C7;
    color: #92400E;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 0.25rem;
    margin-bottom: 1rem;
    position: relative !important;
    top: auto !important;
    left: auto !important;
    bottom: auto !important;
    right: auto !important;
}

/* Override bestseller badge positioning on product page */
.product-summary .product-badge.bestseller-badge,
.product-page .product-badge.bestseller-badge,
.single-product .product-badge.bestseller-badge {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    bottom: auto !important;
    right: auto !important;
    display: inline-block !important;
    background: #FEF3C7 !important;
    color: #92400E !important;
    padding: 0.375rem 0.75rem !important;
    border-radius: 0.25rem !important;
    margin-bottom: 1rem !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    z-index: auto !important;
    pointer-events: auto !important;
}

.bestseller-badge {
    background: #FEF3C7;
    color: #92400E;
}

.product-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.star-rating {
    display: inline-flex;
    gap: 0.125rem;
    font-size: 1rem;
    line-height: 1;
}

.star {
    color: #D1D5DB;
}

.star-full {
    color: #FBBF24;
}

.star-half {
    color: #FBBF24;
    opacity: 0.5;
}

.review-count {
    font-size: 0.875rem;
    color: #6B7280;
}

.product-title {
    font-size: 2rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.75rem;
    line-height: 1.2;
}

/* Product Description - Under Checkout Form */
.product-description-under-form {
    margin-top: 3rem;
    width: 100%;
    clear: both;
}

.product-description-content {
    color: #6B7280;
    font-size: 1rem;
    line-height: 1.6;
    width: 100%;
}

/* Force all description content to be full width and vertically stacked */
.product-description-content *,
.product-description-content > *,
.product-description-content > div,
.product-description-content > p,
.product-description-content > section,
.product-description-content > article,
.product-description-content > figure,
.product-description-content > img,
.product-description-content > ul,
.product-description-content > ol,
.product-description-content > table,
.product-description-content > h1,
.product-description-content > h2,
.product-description-content > h3,
.product-description-content > h4,
.product-description-content > h5,
.product-description-content > h6 {
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    float: none !important;
    clear: both !important;
    box-sizing: border-box !important;
}

/* Remove any grid or column layouts - target all nested elements */
.product-description-content [class*="grid"],
.product-description-content [class*="column"],
.product-description-content [class*="row"],
.product-description-content [class*="flex"],
.product-description-content [class*="col"],
.product-description-content [class*="wp-block"],
.product-description-content [style*="display: grid"],
.product-description-content [style*="display: flex"],
.product-description-content [style*="display:inline-block"],
.product-description-content [style*="display:inline-flex"] {
    display: block !important;
    flex-direction: column !important;
    grid-template-columns: 1fr !important;
    grid-template-rows: auto !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* Force all direct and nested children to be full width */
.product-description-content div,
.product-description-content div > div,
.product-description-content section,
.product-description-content section > div,
.product-description-content article,
.product-description-content article > div {
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
    float: none !important;
}

/* Ensure images are full width */
.product-description-content img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    display: block !important;
    margin: 1rem 0 !important;
    float: none !important;
}

/* Stack all child elements vertically with proper spacing */
.product-description-content > * + * {
    margin-top: 1.5rem !important;
    margin-bottom: 0 !important;
}

/* Ensure nested elements also stack vertically */
.product-description-content > * > * {
    margin-top: 1rem !important;
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
}

/* Remove any inline or inline-block displays */
.product-description-content *[style*="display:inline"],
.product-description-content *[style*="display:inline-block"],
.product-description-content *[style*="display:inline-flex"] {
    display: block !important;
    width: 100% !important;
}

/* Desktop: Description spans full left column width (60%) - aligns with gallery */
@media (min-width: 769px) {
    .product-description-under-form {
        max-width: 60%;
        width: 60%;
        margin-left: 0;
        margin-right: auto;
        margin-top: 3rem;
        padding: 0;
    }

    .product-description-content {
        padding: 0;
    }
}

/* Mobile: Description spans full screen width with padding */
@media (max-width: 768px) {
    .product-description-under-form {
        max-width: 100%;
        width: 100%;
        padding: 0 1rem;
        margin-top: 2rem;
    }

    .product-description-content {
        padding: 0;
    }
}

.product-price {
    font-size: 1.75rem;
    font-weight: 700;
    color: #10B981;
    margin-bottom: 2rem;
}

.product-price del {
    color: #9CA3AF;
    font-size: 1.25rem;
    margin-right: 0.5rem;
}

/* ============================================
   FAST CHECKOUT FORM - BRAND NEW DESIGN
   ============================================ */

.product-fast-checkout {
    margin-top: 2rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.checkout-form-container {
    background: #fff;
    border-radius: 0.5rem;
    border: 1px solid #E5E7EB;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.product-fast-checkout-form {
    width: 100%;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

/* Form Header */
.checkout-form-header {
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid #F3F4F6;
    background: #FAFBFC;
    text-align: center;
}

.checkout-form-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 0.25rem;
    line-height: 1.3;
    text-align: center;
}

.checkout-form-subtitle {
    font-size: 0.875rem;
    color: #6B7280;
    margin: 0;
    line-height: 1.4;
    text-align: center;
}

/* Form Body */
.checkout-form-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.form-group {
    margin-bottom: 1.25rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-row-split {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

/* Desktop: First and Last name side by side */
@media (min-width: 769px) {
    .form-row-split {
        grid-template-columns: 1fr 1fr;
    }
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
    width: 100%;
}

.form-field label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    display: block;
    line-height: 1.4;
    text-align: left;
    width: 100%;
}

.form-field label .required {
    color: #EF4444;
    margin-left: 0.125rem;
    font-weight: 600;
}

.form-field label .optional {
    color: #6B7280;
    margin-left: 0.125rem;
    font-weight: 400;
    font-size: 0.8125rem;
}

.form-input,
.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid #D1D5DB;
    border-radius: 0.375rem;
    font-size: 0.9375rem;
    line-height: 1.5;
    transition: all 0.2s ease;
    background: #fff;
    color: #111827;
    font-family: inherit;
    box-sizing: border-box;
    margin: 0;
    text-align: left;
}

.form-input::placeholder {
    color: #9CA3AF;
    opacity: 1;
}

.form-input:hover,
.form-select:hover {
    border-color: #9CA3AF;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: #111827;
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.1);
}

.form-select {
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23111827' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

.form-select option {
    padding: 0.5rem;
    background: #fff;
    color: #111827;
}

/* Fixed Value Fields (Tunisia, COD) */
.form-fixed-value {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid #D1D5DB;
    border-radius: 0.375rem;
    background: #F9FAFB;
    color: #374151;
    font-size: 0.9375rem;
    line-height: 1.5;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    cursor: not-allowed;
    text-align: left;
    box-sizing: border-box;
}

.fixed-value-text {
    color: #6B7280;
    font-weight: 500;
    text-align: left;
}

/* Error States */
.form-field.has-error .form-input,
.form-field.has-error .form-select {
    border-color: #EF4444;
    background-color: #FEF2F2;
}

.form-field.has-error .form-input:focus,
.form-field.has-error .form-select:focus {
    border-color: #EF4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.error-message {
    color: #EF4444;
    font-size: 0.8125rem;
    margin-top: 0.25rem;
    display: block;
    font-weight: 500;
    line-height: 1.4;
    text-align: left;
    width: 100%;
}

/* Quantity Controls */
.quantity-group {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
}

.quantity-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    display: block;
    margin-bottom: 0.5rem;
    text-align: left;
    width: 100%;
}

.quantity-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: 1.5px solid #D1D5DB;
    border-radius: 0.375rem;
    padding: 0.25rem;
    background: #fff;
    max-width: 140px;
    margin: 0 auto 0 0;
}

.qty-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border: none;
    background: #F9FAFB;
    border-radius: 0.25rem;
    cursor: pointer;
    color: #111827;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    flex-shrink: 0;
}

.qty-btn:hover {
    background: #F3F4F6;
    transform: scale(1.05);
}

.qty-btn:active {
    background: #E5E7EB;
    transform: scale(0.95);
}

.qty-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

.quantity-controls input[type="number"],
.quantity-controls input.qty {
    width: 50px !important;
    text-align: center;
    padding: 0.5rem 0.25rem !important;
    border: none !important;
    border-radius: 0 !important;
    font-size: 0.9375rem !important;
    font-weight: 600 !important;
    -moz-appearance: textfield !important;
    background: transparent !important;
    color: #111827 !important;
    outline: none !important;
    margin: 0 !important;
    box-shadow: none !important;
}

.quantity-controls input[type="number"]::-webkit-outer-spin-button,
.quantity-controls input[type="number"]::-webkit-inner-spin-button,
.quantity-controls input.qty::-webkit-outer-spin-button,
.quantity-controls input.qty::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}

/* Form Footer */
.checkout-form-footer {
    padding: 1.5rem;
    background: #FAFBFC;
    border-top: 1px solid #F3F4F6;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.checkout-buttons {
    display: flex;
    flex-direction: row;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    width: 100%;
    justify-content: center;
    align-items: center;
}

.btn {
    flex: 1;
    padding: 0.875rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: #111827;
    color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover:not(:disabled) {
    background: #1F2937;
    color: #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
    background: #374151;
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    background: #fff;
    color: #111827;
    border: 2px solid #111827;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover:not(:disabled) {
    background: #F9FAFB;
    color: #111827;
    border-color: #1F2937;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.btn-secondary:active:not(:disabled) {
    background: #F3F4F6;
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Trust Badges */
.trust-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid #E5E7EB;
    width: 100%;
}

.trust-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: #6B7280;
    font-weight: 500;
}

.trust-badge svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: #10B981;
    stroke: currentColor;
}

.trust-badge span {
    line-height: 1.4;
    white-space: nowrap;
}

/* Remove any WooCommerce default form styles that might interfere */
.product-fast-checkout-form .woocommerce-input-wrapper,
.product-fast-checkout-form .input-text-wrapper {
    width: 100%;
    margin: 0;
    padding: 0;
}

.product-fast-checkout-form .quantity input[type="number"],
.product-fast-checkout-form input.qty {
    width: 50px !important;
    text-align: center;
    padding: 0.5rem 0.25rem !important;
    border: none !important;
    border-radius: 0 !important;
    font-size: 0.9375rem !important;
    font-weight: 600 !important;
    -moz-appearance: textfield !important;
    background: transparent !important;
    color: #111827 !important;
    outline: none !important;
    margin: 0 !important;
    box-shadow: none !important;
}

.product-fast-checkout-form .quantity input[type="number"]::-webkit-outer-spin-button,
.product-fast-checkout-form .quantity input[type="number"]::-webkit-inner-spin-button,
.product-fast-checkout-form input.qty::-webkit-outer-spin-button,
.product-fast-checkout-form input.qty::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}

/* Remove old form styles - using new design above */

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .product-page {
        padding: 1rem;
    }

    .product-page-container {
        flex-direction: column;
        gap: 2rem;
    }

    .product-gallery {
        flex: 1 1 100%;
        max-width: 100%;
    }

    .product-summary {
        flex: 1 1 100%;
        max-width: 100%;
        padding-left: 0;
    }

    .product-title {
        font-size: 1.5rem;
    }

    .product-price {
        font-size: 1.5rem;
    }

    .product-thumbnails {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.5rem;
    }

    .checkout-form-header {
        padding: 1.25rem 1.25rem 0.875rem;
        text-align: center;
    }

    .checkout-form-body {
        padding: 1.25rem;
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    .checkout-form-footer {
        padding: 1.25rem;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .form-row-split {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .checkout-buttons {
        flex-direction: column;
        gap: 0.625rem;
        margin-bottom: 1rem;
        width: 100%;
        justify-content: center;
        align-items: stretch;
    }

    .checkout-buttons .btn {
        width: 100%;
    }

    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.875rem;
    }

    .trust-badges {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }

    .trust-badge {
        font-size: 0.75rem;
    }

    .quantity-controls {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .product-thumbnails {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.375rem;
    }

    .product-image-main {
        aspect-ratio: 1 / 1;
    }

    .product-title {
        font-size: 1.25rem;
    }

    .product-price {
        font-size: 1.25rem;
    }
}

/* ============================================
   EXISTING STYLES (for backward compatibility)
   ============================================ */

.product-section {
    margin: 3rem 0;
}

.section-title {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 2rem;
    color: #111827;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
}

.product-card {
    background: #fff;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.product-link {
    display: block;
}

.product-info {
    padding: 1rem;
}

.product-actions {
    padding: 0 1rem 1rem;
    display: flex;
    gap: 0.5rem;
}

.product-details-tabs {
    margin-top: 2rem;
}

.tabs-nav {
    list-style: none;
    display: flex;
    gap: 1rem;
    border-bottom: 2px solid #E5E7EB;
    margin-bottom: 1rem;
}

.tab-link {
    padding: 0.75rem 1.5rem;
    display: block;
    color: #6B7280;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.tab-link.active {
    color: #3B82F6;
    border-bottom-color: #3B82F6;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* ============================================
   SVG SIZE CONSTRAINTS - PRODUCT PAGE
   ============================================ */

/* Force all SVGs on product page to reasonable sizes */
.product-page svg,
.product-fast-checkout svg,
.product-fast-checkout-form svg,
.checkout-form-actions svg {
    max-width: 32px !important;
    max-height: 32px !important;
    width: auto !important;
    height: auto !important;
}

/* Override any large width/height attributes */
.product-page svg[width],
.product-page svg[height],
.product-fast-checkout svg[width],
.product-fast-checkout svg[height] {
    max-width: 32px !important;
    max-height: 32px !important;
}

/* Security/payment icons should be smaller */
.product-page svg[class*="lock"],
.product-page svg[class*="secure"],
.product-page svg[class*="payment"],
.product-fast-checkout svg[class*="lock"],
.product-fast-checkout svg[class*="secure"],
.product-fast-checkout svg[class*="payment"] {
    max-width: 20px !important;
    max-height: 20px !important;
    width: 20px !important;
    height: 20px !important;
}

/* NUCLEAR OPTION: Force ALL SVGs everywhere to reasonable sizes */
svg {
    max-width: 32px !important;
    max-height: 32px !important;
}

/* Override for SVGs with explicit large dimensions */
svg[width],
svg[height] {
    max-width: 32px !important;
    max-height: 32px !important;
    width: auto !important;
    height: auto !important;
}

/* Override inline styles */
svg[style] {
    max-width: 32px !important;
    max-height: 32px !important;
}

/* Trust badges and security icons - make them even smaller */
svg[viewBox*="lock"],
svg[viewBox*="Lock"],
svg[viewBox*="security"],
svg[viewBox*="Security"],
svg[viewBox*="shield"],
svg[viewBox*="Shield"],
svg[viewBox*="credit"],
svg[viewBox*="Credit"],
svg[viewBox*="card"],
svg[viewBox*="Card"],
svg[viewBox*="bolt"],
svg[viewBox*="Bolt"],
svg[viewBox*="lightning"],
svg[viewBox*="Lightning"] {
    max-width: 18px !important;
    max-height: 18px !important;
    width: 18px !important;
    height: 18px !important;
}

/* Any SVG after checkout buttons or in trust sections */
.checkout-form-actions~* svg,
.checkout-form-actions+* svg,
.product-fast-checkout~* svg,
.product-fast-checkout+* svg,
[class*="trust"] svg,
[class*="Trust"] svg,
[class*="security"] svg,
[class*="Security"] svg,
[class*="badge"] svg,
[class*="Badge"] svg {
    max-width: 18px !important;
    max-height: 18px !important;
    width: 18px !important;
    height: 18px !important;
}