/**
 * Rig Configurator - Dynamic Gravity Forms Styles
 * 
 * Styles for dynamically populated fields, trailer selection,
 * and enhanced configurator form experience.
 * 
 * @package RigConfigurator
 * @since 1.0.0
 */

/* ==========================================================================
   Dynamic Field Loading States
   ========================================================================== */

/* Loading styles are defined in rig-configurator-form.css to avoid conflicts */

/* ==========================================================================
   Category Filter Styling
   ========================================================================== */

.rig-trailer-category-filter .gchoice {
    display: inline-block;
    margin-right: 15px;
    margin-bottom: 10px;
}

.rig-trailer-category-filter .gchoice input[type="radio"] {
    position: absolute;
    opacity: 0;
    left: -9999px;
}

.rig-trailer-category-filter .gchoice label {
    display: inline-block;
    padding: 8px 16px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 14px;
}

.rig-trailer-category-filter .gchoice:hover label {
    background: #e9ecef;
    border-color: #0073aa;
}

.rig-trailer-category-filter .gchoice input[type="radio"]:checked+label {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
}

/* ==========================================================================
   Proportioner Selection
   ========================================================================== */

.rig-option-PROP_MAKE .gchoice,
.rig-option-CC .gchoice {
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-bottom: 10px;
    padding: 0;
    transition: all 0.2s ease;
}

.rig-option-PROP_MAKE .gchoice:hover,
.rig-option-CC .gchoice:hover {
    border-color: #0073aa;
    box-shadow: 0 2px 4px rgba(0, 115, 170, 0.1);
}

.rig-option-PROP_MAKE .gchoice input[type="radio"]:checked+label,
.rig-option-CC .gchoice input[type="radio"]:checked+label {
    background: #f0f8ff;
    border-color: #0073aa;
    color: #0073aa;
    font-weight: 600;
}

.rig-option-PROP_MAKE .gchoice label,
.rig-option-CC .gchoice label {
    display: block;
    padding: 15px;
    margin: 0;
    cursor: pointer;
    border-radius: 6px;
}

/* ==========================================================================
   Options and Accessories Styling
   ========================================================================== */

.rig-dynamic-field .gchoice {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.rig-dynamic-field .gchoice:hover {
    border-color: #0073aa;
    background: #f9f9f9;
}

.rig-dynamic-field .gchoice input:checked+label {
    background: #e8f4fd;
    border-color: #0073aa;
    color: #0073aa;
}

.rig-dynamic-field .gchoice label {
    display: block;
    padding: 12px 15px;
    margin: 0;
    cursor: pointer;
    border-radius: 6px;
    line-height: 1.4;
}

/* Accessory checkboxes */
.rig-accessory-field .gchoice {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.rig-accessory-field .gchoice input[type="checkbox"]:checked+label {
    background: #e8f4fd;
    border-color: #0073aa;
    color: #0073aa;
}

.rig-accessory-field .gchoice label {
    display: block;
    padding: 12px 15px;
    margin: 0;
    cursor: pointer;
    border-radius: 6px;
    position: relative;
    padding-left: 45px;
}

.rig-accessory-field .gchoice input[type="checkbox"] {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    accent-color: #0073aa;
}

/* ==========================================================================
   Excluded/Disabled Fields
   ========================================================================== */

.rig-excluded {
    opacity: 0.5;
    pointer-events: none;
}

.rig-excluded .gchoice {
    background: #f5f5f5;
    border-color: #ccc;
}

.rig-excluded .gchoice label {
    color: #999;
}

.rig-excluded::before {
    content: "Not available with current selection";
    display: block;
    background: #fff3cd;
    color: #856404;
    padding: 8px 12px;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    margin-bottom: 10px;
    font-size: 12px;
    font-weight: 500;
}

/* ==========================================================================
   Configuration Summary
   ========================================================================== */

.rig-summary-container {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.rig-summary-container h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #495057;
    font-size: 18px;
}

.rig-configuration-items {
    margin-bottom: 20px;
}

.rig-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

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

.rig-item-name {
    font-weight: 500;
    color: #495057;
}

.rig-item-price {
    font-weight: 600;
    color: #0073aa;
}

.rig-pricing-display {
    border-top: 2px solid #dee2e6;
    padding-top: 15px;
}

.rig-pricing-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    font-size: 16px;
}

.rig-pricing-row.rig-total-row {
    border-top: 1px solid #dee2e6;
    padding-top: 10px;
    margin-top: 5px;
    font-size: 18px;
}

.rig-pricing-label {
    color: #6c757d;
}

.rig-list-price,
.rig-cjs-price,
.rig-your-price {
    font-weight: 600;
    color: #28a745;
}

.rig-your-price {
    color: #dc3545;
    font-size: 20px;
}

/* ==========================================================================
   Form Validation and Error States
   ========================================================================== */

.gfield_error {
    background: #fff5f5;
    border-color: #e53e3e !important;
    box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.1);
}

.gfield_error .gchoice {
    border-color: #e53e3e;
}

.gfield_error::after {
    content: "This field is required";
    display: block;
    color: #e53e3e;
    font-size: 12px;
    font-weight: 500;
    margin-top: 8px;
    padding: 5px 10px;
    background: rgba(229, 62, 62, 0.1);
    border-radius: 4px;
}

.rig-error-message,
.rig-success-message {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-weight: 500;
}

.rig-error-message {
    background: #fff5f5;
    color: #e53e3e;
    border: 1px solid #fed7d7;
}

.rig-success-message {
    background: #f0fff4;
    color: #38a169;
    border: 1px solid #9ae6b4;
}

/* ==========================================================================
   Step Navigation Enhancements
   ========================================================================== */

.rig-step-page {
    min-height: 400px;
}

.gform_page_footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-top: 1px solid #e9ecef;
    margin-top: 30px;
}

.gform_next_button,
.gform_previous_button {
    padding: 12px 24px;
    border-radius: 6px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.gform_next_button {
    background: #0073aa;
    color: white;
}

.gform_next_button:hover {
    background: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 115, 170, 0.3);
}

.gform_previous_button {
    background: #6c757d;
    color: white;
}

.gform_previous_button:hover {
    background: #545b62;
}

/* ==========================================================================
   Progress Indicator
   ========================================================================== */

.rig-progress-container {
    background: var(--rig-bg-light);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.rig-progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.rig-progress-bar::before {
    content: '';
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #0073aa 0%, #005a87 100%);
    width: 25%;
    /* Updated by JavaScript */
    transition: width 0.3s ease;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .rig-trailer-choice {
        flex-direction: column;
        gap: 15px;
    }

    .rig-trailer-image {
        width: 100%;
        height: 120px;
    }

    .rig-trailer-category-filter .gchoice {
        display: block;
        margin-right: 0;
        margin-bottom: 10px;
    }

    .rig-trailer-category-filter .gchoice label {
        display: block;
        text-align: center;
    }

    .rig-pricing-row {
        font-size: 14px;
    }

    .rig-pricing-row.rig-total-row {
        font-size: 16px;
    }

    .rig-summary-container {
        padding: 15px;
    }

    .gform_page_footer {
        flex-direction: column;
        gap: 10px;
    }

    .gform_next_button,
    .gform_previous_button {
        width: 100%;
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .rig-trailer-selection .gchoice label {
        padding: 15px;
    }

    .rig-trailer-name {
        font-size: 14px;
    }

    .rig-trailer-category {
        font-size: 11px;
        padding: 3px 10px;
    }

    .rig-summary-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .rig-item-price {
        align-self: flex-end;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {

    .rig-trailer-category-filter,
    .gform_page_footer,
    .rig-error-message,
    .rig-success-message {
        display: none;
    }

    .rig-summary-container {
        border: 2px solid #000;
        page-break-inside: avoid;
    }

    .rig-trailer-selection .gchoice {
        border: 1px solid #000;
        margin-bottom: 10px;
        page-break-inside: avoid;
    }

    .rig-trailer-selection .gchoice input[type="radio"]:checked+label {
        background: #f0f0f0;
        color: #000;
    }
}

/* ==========================================================================
   Accessibility Enhancements
   ========================================================================== */

.rig-trailer-selection .gchoice input[type="radio"]:focus+label,
.rig-dynamic-field .gchoice input:focus+label,
.rig-accessory-field .gchoice input:focus+label {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .rig-trailer-selection .gchoice {
        border-width: 3px;
    }

    .rig-trailer-selection .gchoice input[type="radio"]:checked+label {
        border-color: #000;
        background: #fff;
        color: #000;
    }

    .rig-trailer-category {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {

    .rig-trailer-selection .gchoice,
    .rig-dynamic-field .gchoice,
    .gform_next_button,
    .gform_previous_button,
    .rig-progress-bar::before {
        transition: none;
    }

    @keyframes rig-spin {
        0% {
            transform: rotate(0deg);
        }

        100% {
            transform: rotate(0deg);
        }
    }
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .rig-summary-container {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }

    .rig-summary-container h3 {
        color: #e2e8f0;
    }

    .rig-item-name {
        color: #cbd5e0;
    }

    .rig-summary-item {
        border-color: #4a5568;
    }

    .rig-pricing-display {
        border-color: #4a5568;
    }

    .rig-trailer-selection .gchoice {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }

    .rig-dynamic-field .gchoice,
    .rig-accessory-field .gchoice {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
}