/**
 * LOTUS Purechoice Plugin Styles
 */

.lotus-purechoice-wizard {
    max-width: 1180px;
    margin: 0 auto;
    background: #fff;
    border: 2px solid var(--e-global-color-accent);
    border-radius: 15px;
    padding: 20px;
}

.wizard-header {
    margin-bottom: 20px;
    text-align: center;
}

/* Segmented Progress Bar */
.wizard-progress-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
    padding: 0 10px;
    flex-wrap: wrap;
    gap: 5px;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: default;
    transition: all 0.2s ease;
}

.progress-step.clickable {
    cursor: pointer;
}

.progress-step.clickable:hover .step-indicator {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.3);
}

.step-indicator {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9em;
    transition: all 0.2s ease;
}

.progress-step.pending .step-indicator {
    background: #e0e0e0;
    color: #999;
    border: 2px solid #ccc;
}

.progress-step.active .step-indicator {
    background: #0073aa;
    color: #fff;
    border: 2px solid #0073aa;
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.4);
}

.progress-step.completed .step-indicator {
    background: #46b450;
    color: #fff;
    border: 2px solid #46b450;
}

.step-label {
    font-size: 0.75em;
    color: #666;
    text-align: center;
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.progress-step.active .step-label {
    color: #0073aa;
    font-weight: 600;
}

.progress-step.completed .step-label {
    color: #46b450;
}

.progress-connector {
    width: 30px;
    height: 2px;
    background: #e0e0e0;
    margin: 0 5px;
    margin-bottom: 20px;
    border-radius: 2px;
}

.progress-step.completed + .progress-connector,
.progress-connector:has(+ .progress-step.completed),
.progress-connector:has(+ .progress-step.active) {
    background: #46b450;
}

@media (max-width: 600px) {
    .wizard-progress-bar {
        gap: 3px;
    }
    
    .step-indicator {
        width: 28px;
        height: 28px;
        font-size: 0.8em;
    }
    
    .step-label {
        display: none;
    }
    
    .progress-connector {
        width: 15px;
        margin-bottom: 0;
    }
}

.wizard-step-container {
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.step-question {
    font-size: 1.5em;
    margin-bottom: 25px;
    color: #333;
}

.step-answers {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.answer-option {
    background: #f9f9f9;
    border: 1px solid var(--e-global-color-secondary);
    border-radius: 5px !important;
    padding: 25px;
    cursor: pointer;
    font-size: 1.1em;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
    max-width: 200px;
    white-space: normal !important; /* Force override global nowrap */
    height: auto !important;
}

.answer-image-wrapper {
    width: 100%;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 5px;
    background: #fff;
}

.answer-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.answer-image[src*=".svg"] {
    padding: 20px;
    box-sizing: border-box;
}

.answer-label {
    text-align: center;
    font-weight: 500;
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}

.answer-option:hover,
.answer-option:hover .answer-label {
    color: var(--e-global-color-accent) !important;
    border-color: var(--e-global-color-accent) !important;
}

#lotus-purechoice-wizard .answer-option.selected {
    border-color: var(--e-global-color-accent) !important;
    border-radius: 5px !important;
}

.answer-option.has-image {
    background: transparent;
}

.answer-option.has-image:hover {
    background: transparent;
}

.answer-option.has-image .answer-image-wrapper {
    transition: transform 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.answer-option:hover {
    transform: scale(1.1);
}

.wizard-controls {
    margin-top: 30px;
    display: flex;
    justify-content: space-between;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.wizard-controls button {
    padding: 10px 20px;
    cursor: pointer;
    border-radius: 5px;
    font-size: 1em;
    border: none;
}

.wizard-controls button.primary {
    background: var(--e-global-color-accent);
    color: #fff;
}

.wizard-controls button.secondary {
    background: #f1f1f1;
    color: #333;
}

.wizard-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#wizard-next {
    margin-left: auto;
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.product-card {
    border: 1px solid #eee;
    border-radius: 5px;
    overflow: hidden;
    transition: transform 0.2s;
    background: #fff;
    display: flex;
    flex-direction: column;
}

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

.product-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.product-info {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-info h4 {
    margin: 0 0 10px;
    font-size: 1.2em;
}

.product-excerpt {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 10px;
    flex-grow: 1;
}

.product-price {
    font-weight: bold;
    color: #0073aa;
    margin-bottom: 15px;
}

.product-info .button {
    text-align: center;
    text-decoration: none;
    display: block;
    background: #0073aa;
    color: white;
    padding: 10px;
    border-radius: 5px;
}

/* Slider Styles */
.lotus-slider-wrapper {
    width: 100%;
    max-width: 500px;
    margin: 20px auto;
    text-align: center;
}

.lotus-slider-value {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 15px;
    color: #0073aa;
}

.lotus-slider {
    width: 100%;
    -webkit-appearance: none;
    height: 10px;
    border-radius: 5px;
    background: #d3d3d3;
    outline: none;
    opacity: 0.7;
    transition: opacity .2s;
}

.lotus-slider:hover {
    opacity: 1;
}

.lotus-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: #0073aa;
    cursor: pointer;
}

.lotus-slider::-moz-range-thumb {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: #0073aa;
    cursor: pointer;
}

.lotus-slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 0.9em;
    color: #666;
}

/* Multi-select styling tweak */
.wizard-step.type-multi .answer-option.selected {
    border: 3px solid var(--e-global-color-accent);
}

/* Loader */
.lotus-loader {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #0073aa;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: lotus-spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.loading-text {
    font-size: 1.2em;
    color: #666;
    margin-top: 10px;
}

/* Results Layout Update */
.lotus-results-container {
    display: block; /* Remove grid from main container */
}

.lotus-perfect-match {
    margin-bottom: 40px;
    text-align: center;
}

.lotus-top-results-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1fr);
    gap: 24px;
    align-items: center;
    margin: 0 auto;
}

.lotus-top-results-row.count-1 .best-card {
    grid-column: 2;
}

.lotus-top-results-row.count-2 .best-card {
    grid-column: 2;
}

.lotus-top-result {
    min-width: 0;
}

.lotus-top-result .product-card {
    height: 100%;
}

.lotus-top-result.best-card {
    align-self: stretch;
}

.lotus-top-result.side-card {
    align-self: center;
}

.lotus-result-heading {
    margin-bottom: 20px;
    font-size: 1.8em;
    color: #333;
    text-align: center;
}

.lotus-perfect-match .product-card.featured-card {
    display: flex;
    flex-direction: column;
    max-width: 100%;
    margin: 0 auto;
    align-items: stretch;
    padding: 0;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    border: 2px solid #0073aa;
}

.featured-card .product-image {
    flex: none;
    margin-right: 0;
}

.featured-card .product-image img {
    height: 260px;
    max-height: none;
    width: 100%;
    object-fit: cover;
}

.featured-card .product-info {
    text-align: center;
    padding: 22px;
}

.featured-card h4 {
    font-size: 1.6em;
    margin-bottom: 15px;
}

.featured-card .product-excerpt {
    font-size: 1.1em;
    margin-bottom: 20px;
}

.lotus-score-summary {
    margin: 0 0 18px;
    padding: 14px;
    border: 1px solid #d7e5ec;
    border-radius: 8px;
    background: #f7fbfd;
}

.lotus-score-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 10px;
}

.lotus-score-total-label {
    font-size: 0.82em;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #55717d;
}

.lotus-score-total-value {
    font-size: 1.3em;
    color: #0073aa;
}

.featured-card .lotus-score-total-value {
    font-size: 1.7em;
}

.lotus-score-details {
    border-top: 1px solid #d7e5ec;
    padding-top: 10px;
}

.lotus-score-details summary {
    cursor: pointer;
    font-weight: 600;
    color: #22313a;
}

.lotus-score-details[open] summary {
    margin-bottom: 12px;
}

.lotus-score-details-body {
    padding-top: 8px;
}

.lotus-score-breakdown-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 280px;
    overflow-y: auto;
}

.lotus-score-breakdown-item {
    border: 1px solid #e5edf2;
    border-radius: 6px;
    padding: 12px;
    background: #fff;
}

.lotus-score-breakdown-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 6px;
}

.lotus-score-step-title {
    font-weight: 600;
    color: #22313a;
}

.lotus-score-step-answer {
    color: #0073aa;
}

.lotus-score-step-separator {
    margin-right: 6px;
}

.lotus-score-step-value {
    font-weight: 700;
    color: #0073aa;
    white-space: nowrap;
}

.lotus-score-step-meta {
    font-size: 0.9em;
    color: #5f6f78;
    margin-bottom: 8px;
}

.lotus-score-step-formula {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.85em;
    color: #43545d;
}

.lotus-score-step-formula span {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    background: #f2f7fa;
}

.lotus-score-empty {
    margin: 0;
    font-size: 0.9em;
    color: #5f6f78;
}

.lotus-score-product-adjustment {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed #d7e5ec;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9em;
    color: #43545d;
}

.lotus-score-product-adjustment strong {
    color: #22313a;
}

.lotus-score-product-adjustment span {
    font-weight: 700;
    color: #0073aa;
}

.featured-card .button {
    display: inline-block;
    padding: 12px 30px;
    font-size: 1.1em;
}

.lotus-more-matches {
    margin-top: 40px;
    border-top: 1px solid #eee;
    padding-top: 30px;
}

details.lotus-more-matches {
    border: 1px solid #e6edf2;
    border-radius: 8px;
    padding: 0;
    background: #f9fbfc;
    overflow: hidden;
}

details.lotus-more-matches > summary.lotus-more-matches-header {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 22px;
    cursor: pointer;
    outline: none;
}

details.lotus-more-matches > summary.lotus-more-matches-header::-webkit-details-marker {
    display: none;
}

details.lotus-more-matches > summary.lotus-more-matches-header::after {
    content: '▼';
    font-size: 0.8em;
    color: #666;
    transition: transform 0.2s ease;
}

details.lotus-more-matches[open] > summary.lotus-more-matches-header::after {
    transform: rotate(180deg);
}

details.lotus-more-matches > summary .lotus-result-heading {
    margin: 0;
}

details.lotus-more-matches[open] > summary.lotus-more-matches-header {
    border-bottom: 1px solid #e6edf2;
}

/* Ensure inner grid works */
.lotus-more-matches .results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding: 24px;
    margin-bottom: 0;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .lotus-top-results-row,
    .lotus-top-results-row.count-2,
    .lotus-top-results-row.count-1 {
        grid-template-columns: minmax(0, 1fr);
        max-width: 560px;
    }

    .lotus-top-results-row.count-1 .best-card,
    .lotus-top-results-row.count-2 .best-card {
        grid-column: auto;
    }

    .lotus-top-result.best-card {
        order: -1;
    }
}

@media (max-width: 768px) {
    .lotus-perfect-match .product-card.featured-card {
        flex-direction: column;
    }

    .lotus-score-total,
    .lotus-score-breakdown-top {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .featured-card .product-image {
        margin-right: 0;
        margin-bottom: 20px;
        flex: auto;
        width: 100%;
    }

    .featured-card .product-image img {
        height: 220px;
    }
}

/* Criteria Summary (Collapsible) */
details.lotus-criteria-summary {
    margin: 30px auto;
    max-width: 800px;
    background: #f9f9f9;
    padding: 20px;
    border-radius: 5px;
    border: 1px solid #eee;
    text-align: center;
    cursor: pointer;
}

details.lotus-criteria-summary > summary.lotus-criteria-summary-header {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    outline: none;
}

details.lotus-criteria-summary > summary.lotus-criteria-summary-header::-webkit-details-marker {
    display: none;
}

details.lotus-criteria-summary > summary.lotus-criteria-summary-header::after {
    content: '▼';
    font-size: 0.8em;
    color: #666;
    transition: transform 0.2s ease;
}

details.lotus-criteria-summary[open] > summary.lotus-criteria-summary-header::after {
    transform: rotate(180deg);
}

details.lotus-criteria-summary > summary .lotus-result-heading {
    margin: 0;
    display: inline;
}

details.lotus-criteria-summary[open] .lotus-summary-list {
    margin-top: 20px;
}

.lotus-summary-list {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
    display: inline-block; /* Center the list block */
    width: 100%;
    max-width: 600px;
}

.lotus-summary-list li {
    padding: 10px 0;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
}

.lotus-summary-list li:last-child {
    border-bottom: none;
}

.summary-question {
    font-weight: 600;
    color: #333;
    margin-right: 15px;
}

.summary-answer {
    color: #0073aa;
    font-weight: 500;
    text-align: right;
}

/* Edit Answers Button on Results Page */
.lotus-edit-button-container {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

#wizard-edit-answers {
    padding: 12px 30px;
    font-size: 1em;
}

/* Edit Mode Styles */
.lotus-edit-mode {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.lotus-edit-heading {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 1.5em;
}

.edit-questions-list {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.edit-question-item {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
}

.edit-question-text {
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.edit-answers {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.edit-answer {
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 5px;
    padding: 10px 18px;
    cursor: pointer;
    font-size: 0.95em;
    transition: all 0.2s ease;
    color: #333;
}

.edit-answer:hover {
    border-color: #0073aa;
    background: #f0f7fb;
}

.edit-answer.selected {
    border-color: #0073aa;
    background: #0073aa;
    color: #fff;
}

/* Edit Mode Slider */
.edit-slider-wrapper {
    width: 100%;
    max-width: 400px;
}

.edit-slider-value {
    font-weight: 600;
    color: #0073aa;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.edit-slider {
    width: 100%;
    -webkit-appearance: none;
    height: 8px;
    border-radius: 4px;
    background: #d3d3d3;
    outline: none;
}

.edit-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #0073aa;
    cursor: pointer;
}

.edit-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #0073aa;
    cursor: pointer;
    border: none;
}

.edit-slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.85em;
    color: #666;
}

/* Edit Controls */
.edit-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.edit-controls .button {
    padding: 12px 30px;
    font-size: 1em;
    border-radius: 5px;
    cursor: pointer;
    border: none;
}

.edit-controls .button.primary {
    background: #0073aa;
    color: #fff;
}

.edit-controls .button.primary:hover {
    background: #005a87;
}

.edit-controls .button.secondary {
    background: #f1f1f1;
    color: #333;
}

.edit-controls .button.secondary:hover {
    background: #e0e0e0;
}

/* Responsive Edit Mode */
@media (max-width: 600px) {
    .edit-question-item {
        padding: 15px;
    }
    
    .edit-answers {
        gap: 8px;
    }
    
    .edit-answer {
        padding: 8px 14px;
        font-size: 0.9em;
    }
    
    .edit-controls {
        flex-direction: column;
    }
    
    .edit-controls .button {
        width: 100%;
    }
}
