/* =========================================================
   ADMIN LAYOUT (Backend)
   ========================================================= */

.pba-addon-row {
    background: #fff;
    padding: 10px;
    margin-bottom: 8px;
    border: 1px solid #ccd0d4;
    border-radius: 3px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.pba-addon-row input[type="text"], 
.pba-addon-row select {
    margin: 0 !important;
    padding: 5px !important;
    height: auto !important;
}

.pba-addon-row input[name*="[name]"] { flex: 2; }
.pba-addon-row select { flex: 1.5; }
.pba-addon-row input[name*="[price]"] { flex: 1; }

/* =========================================================
   FRONTEND LAYOUT (Modern & Consistent)
   ========================================================= */

.wc-pba-dimension-inputs {
    background: transparent;
    padding: 0;
    margin-bottom: 30px;
    font-family: inherit;
}

.wc-pba-dimension-inputs h4 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.3em;
    font-weight: 700;
    border-bottom: 2px solid #eee;
    padding-bottom: 8px;
}

/* Form Groups (Stacked Layout) */
.pba-input-group,
.pba-addon-group,
.pba-artwork-upload {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

.wc-pba-dimension-inputs label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #374151;
    font-size: 0.95em;
}

/* Universal Input Styling (Numbers & Selects) */
.wc-pba-dimension-inputs input[type="number"],
.wc-pba-dimension-inputs select {
    width: 100%;
    max-width: 400px;
    padding: 12px 16px !important;
    border: 1px solid #d1d5db !important;
    border-radius: 6px !important;
    background-color: #f9fafb;
    color: #1f2937;
    font-size: 1em;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease-in-out;
}

/* Focus States for Modern Feel */
.wc-pba-dimension-inputs input[type="number"]:focus,
.wc-pba-dimension-inputs select:focus {
    outline: none !important;
    border-color: #3b82f6 !important;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15) !important;
}

/* Checkboxes & Radios */
.wc-pba-dimension-inputs input[type="checkbox"],
.wc-pba-dimension-inputs input[type="radio"] {
    margin-right: 10px;
    transform: scale(1.2);
    accent-color: #3b82f6; /* Modern blue checkmark */
    cursor: pointer;
}

.wc-pba-dimension-inputs .pba-addon-group label {
    display: flex;
    align-items: center;
    font-weight: 400;
    cursor: pointer;
    margin-bottom: 10px;
}

/* Modern File Uploader Styling */
.pba-artwork-upload input[type="file"] {
    width: 100%;
    max-width: 400px;
    padding: 10px;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    background-color: #fcfcfc;
    color: #4b5563;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.pba-artwork-upload input[type="file"]:hover {
    border-color: #9ca3af;
}

.pba-artwork-upload input[type="file"]::file-selector-button {
    padding: 8px 16px;
    margin-right: 15px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background-color: #ffffff;
    color: #374151;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    transition: background-color 0.2s;
}

.pba-artwork-upload input[type="file"]::file-selector-button:hover {
    background-color: #f3f4f6;
}

.pba-artwork-upload small {
    font-size: 0.85em;
    color: #6b7280;
    margin-top: 6px;
}

/* Dynamic Price Display */
.pba-dynamic-price-wrapper {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px dashed #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
    padding: 15px 20px;
    border-radius: 8px;
}

.pba-price-label {
    font-weight: 700;
    font-size: 1.1em;
    color: #374151;
}

#pba_live_price {
    font-size: 1.6em;
    font-weight: 800;
    color: #111827;
}

/* =========================================================
   SELECT2 & VARIATIONS UI ENHANCEMENTS
   ========================================================= */

/* 1. Make Select2 match our modern, padded input boxes */
.select2-container--default .select2-selection--single {
    height: auto !important;
    min-height: 46px !important;
    padding: 10px 14px !important;
    border: 1px solid #d1d5db !important;
    border-radius: 6px !important;
    background-color: #f9fafb !important;
    display: flex !important;
    align-items: center !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

/* 2. Fix the rendered text alignment inside Select2 */
.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 1.5 !important;
    padding-left: 0 !important;
    color: #1f2937 !important;
    font-size: 1em !important;
    width: 100%;
}

/* 3. Center the dropdown arrow vertically */
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 100% !important;
    right: 12px !important;
}

/* 4. Focus state for Select2 */
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: #3b82f6 !important;
    background-color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15) !important;
    outline: none !important;
}

/* 5. Modernize & Stack the native WooCommerce Variations Table */
table.variations {
    width: 100%;
    max-width: 400px;
    margin-bottom: 25px;
    border: none;
}

table.variations tbody, 
table.variations tr, 
table.variations th, 
table.variations td {
    display: block;
    width: 100%;
    padding: 0;
    border: none;
    text-align: left;
}

table.variations th {
    padding-bottom: 8px;
    font-weight: 600;
    color: #374151;
    font-size: 0.95em;
}

table.variations td {
    margin-bottom: 15px;
}

table.variations td.value {
    margin-bottom: 15px;
}

/* Push the "Clear" link nicely to the right */
table.variations .reset_variations {
    display: inline-block;
    margin-top: 5px;
    font-size: 0.85em;
    color: #ef4444;
    text-decoration: none;
    float: right;
}

table.variations .reset_variations:hover {
    text-decoration: underline;
}

/* =========================================================
   FIX DIVI THEME DUPLICATE ARROWS ON VARIATIONS
   ========================================================= */

/* Nuke the custom CSS triangle injected by the Divi builder */
.et_pb_wc_add_to_cart form.cart .variations td.value span::after,
.et_pb_wc_add_to_cart form.cart .variations td.value span:after {
    display: none !important;
    border: none !important;
    content: none !important;
}

/* Ensure the Select2 container resets any inherited theme padding */
.select2-container--default .select2-selection--single {
    background-image: none !important;
}