/* Assets Appraise Form - WordPress Compatible Styling */

/* Reset and Base Styles */
.assets-appraise-form * {
    box-sizing: border-box;
}

.assets-appraise-form {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    line-height: 1.6;
}

/* Main Form Container */
.assets-appraise-form {
    max-width: 650px;
    margin: 20px auto;
    padding: 35px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafb 100%);
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08), 0 5px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid #e1e8ed;
    position: relative;
    overflow: hidden;
}

/* Remove container conflicts */
.assets-appraise-form.container {
    padding-left: 35px !important;
    padding-right: 35px !important;
}

.assets-appraise-form::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #DA3021 0%, #ff6b5b 50%, #DA3021 100%);
    border-radius: 20px 20px 0 0;
}

.assets-appraise-form::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(218, 48, 33, 0.03) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.assets-appraise-form > * {
    position: relative;
    z-index: 1;
}

/* Form Title */
.assets-appraise-form h2 {
    text-align: center;
    margin: 0 0 35px 0;
    color: #1a202c;
    font-size: 32px;
    font-weight: 700;
    position: relative;
    line-height: 1.2;
}

.assets-appraise-form h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #DA3021, #ff6b5b);
    border-radius: 3px;
}

.assets-appraise-form h3 {
    color: #2d3748;
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 25px;
    text-align: center;
}

/* Form Groups */
.form-group {
    margin-bottom: 28px;
    position: relative;
    transition: all 0.3s ease;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #2d3748;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    position: relative;
}

.form-group label::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 100%;
    background: #DA3021;
    border-radius: 2px;
}

/* Native Select Styling */
.form-group select {
    width: 100%;
    height: 55px;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    background: #ffffff;
    color: #2d3748;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24'%3E%3Cpath stroke='%23718096' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 20px;
    cursor: pointer;
}

.form-group select:focus {
    outline: none;
    border-color: #DA3021;
    box-shadow: 0 0 0 3px rgba(218, 48, 33, 0.1);
}

.form-group select:hover {
    border-color: #cbd5e0;
}

/* Select2 Styling */
.select2-container--default .select2-selection--single {
    height: 55px !important;
    padding: 8px 16px;
    border: 2px solid #e2e8f0 !important;
    border-radius: 14px !important;
    background: #ffffff;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    min-width: 100% !important;
}

.select2-container--default .select2-selection--single:focus,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: #DA3021 !important;
    box-shadow: 0 0 0 3px rgba(218, 48, 33, 0.1), 0 4px 12px rgba(218, 48, 33, 0.15) !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 53px;
    right: 12px;
    top: 1px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: #718096 transparent transparent transparent;
    border-width: 6px 6px 0 6px;
    margin-left: -6px;
    margin-top: -3px;
}

.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-color: transparent transparent #718096 transparent;
    border-width: 0 6px 6px 6px;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 39px;
    padding-left: 8px;
    padding-right: 40px;
    color: #2d3748;
    font-weight: 500;
    font-size: 16px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #a0aec0;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Select2 Dropdown */
.select2-dropdown {
    border: 2px solid #e2e8f0 !important;
    border-radius: 14px !important;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12), 0 5px 15px rgba(0, 0, 0, 0.08) !important;
    border-top: none !important;
    margin-top: -2px;
    overflow: hidden;
    min-width: 100% !important;
    width: auto !important;
}

.select2-container--default .select2-search--dropdown {
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    width: 100%;
    font-size: 16px;
    box-sizing: border-box;
}

.select2-results {
    max-height: 300px;
    overflow-y: auto;
}

.select2-results__option {
    padding: 16px 20px !important;
    border-bottom: 1px solid #f7fafc;
    transition: all 0.2s ease;
    font-size: 16px;
    color: #2d3748;
    word-wrap: break-word;
    white-space: normal;
    line-height: 1.4;
}

.select2-results__option--highlighted {
    background-color: #DA3021 !important;
    color: white !important;
}

.select2-results__option:last-child {
    border-bottom: none;
}

.select2-results__option[aria-selected="true"] {
    background-color: rgba(218, 48, 33, 0.1) !important;
    color: #DA3021 !important;
    font-weight: 600;
}

.select2-results__option[aria-selected="true"]:hover {
    background-color: #DA3021 !important;
    color: white !important;
}

.form-group .select2 {
    width: 100% !important;
}

.select2-container {
    z-index: 99999 !important;
    width: 100% !important;
}

.select2-container .select2-selection {
    display: block;
    width: 100%;
}

/* Fix dropdown width to auto adjust to content */
.select2-dropdown {
    width: auto !important;
    min-width: 100% !important;
    max-width: 400px !important;
}

/* Ensure dropdown appears above other elements */
.select2-container--open .select2-dropdown--below {
    border-top: none;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.select2-container--open .select2-dropdown--above {
    border-bottom: none;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

/* Custom dropdown styling */
.select2-dropdown-custom {
    background: white;
    border-radius: 14px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12), 0 5px 15px rgba(0, 0, 0, 0.08);
    border: 2px solid #e2e8f0;
    overflow: hidden;
}

.select2-dropdown-custom .select2-results {
    padding: 0;
    margin: 0;
}

.select2-dropdown-custom .select2-results__option {
    padding: 16px 20px;
    font-size: 16px;
    line-height: 1.4;
    word-wrap: break-word;
    white-space: normal;
    min-height: auto;
}

.select2-dropdown-custom .select2-results__option--highlighted {
    background-color: #DA3021;
    color: white;
}

.select2-dropdown-custom .select2-search {
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.select2-dropdown-custom .select2-search__field {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 16px;
    box-sizing: border-box;
}

/* Force dropdown to calculate proper width */
.select2-container--default.select2-container--open {
    z-index: 999999 !important;
}

.select2-container--default .select2-dropdown {
    position: absolute !important;
    width: auto !important;
    min-width: 100% !important;
    max-width: none !important;
}

/* Responsive width for dropdown */
@media screen and (max-width: 768px) {
    .select2-dropdown {
        max-width: calc(100vw - 40px) !important;
    }
}

@media screen and (max-width: 480px) {
    .select2-dropdown {
        max-width: calc(100vw - 20px) !important;
    }
}

/* Brand and Model Options with Images */
.select2-brand-option,
.select2-model-option,
.select2-brand-selection {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-logo,
.select2-model-option img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 6px;
    flex-shrink: 0;
}

.select2-brand-option .brand-name {
    flex: 1;
    font-weight: 500;
}

.select2-selection__rendered {
    display: flex !important;
    align-items: center;
    gap: 14px;
}

/* Product Icons */
.product-icon {
    display: inline-block;
    width: 24px;
    height: 24px;
    margin-right: 10px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    vertical-align: middle;
}

/* Error Messages */
.error-message {
    color: #e53e3e;
    font-size: 13px;
    margin-top: 8px;
    padding: 10px 14px;
    background: rgba(229, 62, 62, 0.08);
    border-radius: 10px;
    border-left: 3px solid #e53e3e;
    display: none;
    font-weight: 500;
}

.error-message.show {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Selected Configurations */
#selected-configs {
    margin: 18px 0;
    padding: 18px;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-radius: 14px;
    border: 1px solid #e2e8f0;
}

.selected-tag {
    display: inline-block;
    background: linear-gradient(135deg, #DA3021, #ff6b5b);
    color: white;
    padding: 10px 16px;
    border-radius: 25px;
    margin: 4px 6px 4px 0;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 3px 10px rgba(218, 48, 33, 0.25);
    transition: all 0.2s ease;
}

.selected-tag:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(218, 48, 33, 0.35);
}

.remove-tag {
    margin-left: 8px;
    cursor: pointer;
    color: white;
    font-weight: bold;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.remove-tag:hover {
    opacity: 1;
}

/* Condition Selection */
#accessory-condition-form {
    margin-top: 35px;
    padding-top: 35px;
    border-top: 2px solid #e2e8f0;
}

#conditionFormPrice h3 {
    margin-bottom: 30px;
}

.condition-option {
    margin: 22px 0;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    padding: 24px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.condition-option:hover {
    border-color: #DA3021;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(218, 48, 33, 0.12);
}

.condition-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.condition-option label {
    display: block;
    margin: 0;
    cursor: pointer;
    font-weight: 600;
    color: #2d3748;
    font-size: 17px;
    position: relative;
    padding-left: 40px;
    line-height: 1.3;
}

.condition-option label::before {
    content: '';
    position: absolute;
    left: 0;
    top: 3px;
    width: 22px;
    height: 22px;
    border: 3px solid #cbd5e0;
    border-radius: 50%;
    background: white;
    transition: all 0.3s ease;
}

.condition-option label::after {
    content: '';
    position: absolute;
    left: 7px;
    top: 10px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
    transform: scale(0);
    transition: all 0.3s ease;
}

.condition-option input[type="radio"]:checked + label::before {
    border-color: #DA3021;
    background: #DA3021;
    box-shadow: 0 0 0 4px rgba(218, 48, 33, 0.1);
}

.condition-option input[type="radio"]:checked + label::after {
    transform: scale(1);
}

.condition-option input[type="radio"]:checked + label {
    color: #DA3021;
}

.condition-option:has(input[type="radio"]:checked) {
    border-color: #DA3021;
    background: rgba(218, 48, 33, 0.03);
    box-shadow: 0 8px 25px rgba(218, 48, 33, 0.12);
}

.condition-option ul {
    padding: 15px 0 0 20px;
    margin-top: 15px;
}

.condition-option li {
    color: #718096;
    font-size: 15px;
    font-weight: 400;
    margin-bottom: 8px;
    line-height: 1.5;
    position: relative;
}

.condition-option li::before {
    content: '•';
    color: #DA3021;
    font-weight: bold;
    position: absolute;
    left: -15px;
}

/* Buttons */
.next-button,
.submit-button {
    width: 100%;
    padding: 18px 28px;
    background: linear-gradient(135deg, #DA3021 0%, #ff6b5b 100%);
    color: white;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    font-size: 17px;
    font-weight: 700;
    margin-top: 25px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(218, 48, 33, 0.3);
    position: relative;
    overflow: hidden;
}

.next-button::before,
.submit-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.next-button:hover,
.submit-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(218, 48, 33, 0.4);
}

.next-button:hover::before,
.submit-button:hover::before {
    left: 100%;
}

.next-button:active,
.submit-button:active {
    transform: translateY(-1px);
}

.next-button:focus,
.submit-button:focus {
    outline: none;
    box-shadow: 0 6px 20px rgba(218, 48, 33, 0.3), 0 0 0 3px rgba(218, 48, 33, 0.1);
}

/* Not Assets Price Message */
#not-assets-price {
    padding: 22px;
    background: linear-gradient(135deg, #fef5e7, #fed7aa);
    border-radius: 14px;
    margin: 25px 0;
    border-left: 4px solid #f59e0b;
    color: #92400e;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15);
}

/* Loading States */
.assets-appraise-form.loading {
    pointer-events: none;
    opacity: 0.7;
}

.assets-appraise-form.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #DA3021;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1000;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Result Container */
.result-container {
    display: flex;
    max-width: 1000px;
    margin: 0 auto;
    background-color: #ECF1F4;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.left-column, .right-column {
    padding: 30px;
    width: 50%;
}

.left-column {
    background-color: #ECF1F4;
    text-align: center;
}

.estimated-price {
    font-size: 48px;
    color: #DA2031;
    font-weight: bold;
    margin: 20px 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mascot {
    position: relative;
    width: 330px;
    margin: 0 auto;
}

.mascot img {
    width: 100%;
    height: auto;
}

.pledge-button {
    background: linear-gradient(135deg, #DA3021, #ff6b5b);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(218, 48, 33, 0.3);
}

.pledge-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(218, 48, 33, 0.4);
}

.footnote {
    font-size: 12px;
    color: #7f8c8d;
    margin-top: 15px;
}

.right-column {
    background-color: white;
    border-left: 1px solid #dee2e6;
}

.right-column h3 {
    color: #2c3e50;
    margin-bottom: 20px;
}

.calculator {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.calculator-icon {
    width: 24px;
    height: 24px;
    margin-right: 10px;
}

.dropdown-arrow {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.cost-box {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
    border: 1px solid #e9ecef;
}

.cost {
    font-size: 18px;
    font-weight: bold;
    color: #DA3021;
}

.loan-term, .loan-amount {
    margin: 15px 0;
}

.loan-box {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.term-value, .amount {
    margin: 10px 0;
}

.info-icon {
    width: 16px;
    height: 16px;
    margin-left: 5px;
    cursor: help;
}

.slider {
    width: 100%;
    margin: 15px 0;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #7f8c8d;
}

.amount input, .term-value input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.amount input:focus, .term-value input:focus {
    border-color: #DA3021;
    outline: none;
}

.asset-type-code {
    display: none;
}

#assetSalesFormResult {
    margin-top: 30px;
}

/* WordPress Compatibility */
.wp-admin .assets-appraise-form {
    font-family: inherit;
}

.elementor-widget-assets-appraise .assets-appraise-form {
    margin: 0;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .assets-appraise-form {
        margin: 15px;
        padding: 25px;
        border-radius: 16px;
    }
    
    .assets-appraise-form h2 {
        font-size: 26px;
        margin-bottom: 25px;
    }
    
    .form-group {
        margin-bottom: 22px;
    }
    
    .form-group select,
    .select2-container--default .select2-selection--single {
        height: 50px !important;
        font-size: 15px;
    }
    
    .condition-option {
        padding: 18px;
        margin: 18px 0;
    }
    
    .condition-option label {
        font-size: 15px;
    }
    
    .next-button,
    .submit-button {
        padding: 16px 24px;
        font-size: 16px;
    }
    
    .result-container {
        flex-direction: column;
        margin: 10px;
    }

    .left-column, .right-column {
        width: 100%;
        padding: 20px;
    }

    .estimated-price {
        font-size: 36px;
    }

    .mascot {
        width: 250px;
    }

    .pledge-button {
        padding: 12px 24px;
        font-size: 14px;
    }

    .calculator, .loan-box, .loan-term, .cost-box {
        padding: 15px;
    }

    .amount input, .term-value input {
        padding: 10px;
        font-size: 14px;
    }
}

@media screen and (max-width: 480px) {
    .assets-appraise-form {
        margin: 10px;
        padding: 20px;
    }
    
    .assets-appraise-form h2 {
        font-size: 22px;
    }
    
    .form-group select,
    .select2-container--default .select2-selection--single {
        height: 48px !important;
        font-size: 14px;
    }
    
    .condition-option {
        padding: 15px;
    }
    
    .condition-option label {
        font-size: 14px;
        padding-left: 35px;
    }
    
    .condition-option li {
        font-size: 13px;
    }
    
    .brand-logo,
    .select2-model-option img {
        width: 24px;
        height: 24px;
    }
    
    .select2-results__option {
        padding: 10px 12px !important;
    }
    
    .next-button,
    .submit-button {
        padding: 14px 20px;
        font-size: 15px;
    }
    
    .estimated-price {
        font-size: 28px;
    }

    .mascot {
        width: 200px;
    }

    .pledge-button {
        padding: 10px 20px;
        font-size: 12px;
    }

    .loan-term, .loan-amount {
        margin: 10px 0;
    }

    .term-value, .amount {
        margin: 8px 0;
    }

    .amount input, .term-value input {
        padding: 8px;
        font-size: 14px;
    }

    .slider-labels {
        font-size: 10px;
    }
}

.assets-appraise-form .select2-container .select2-selection--single {
    height: 45px !important;
}

.assets-appraise-form .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 45px !important;
}

.assets-appraise-form .select2-container--default .select2-selection--single .select2-selection__arrow {
    top: 50% !important;
}
