/* static/css/try_on.css - Redesigned for Dark Mode and Modern UI (Corrected Final View) */

/* Main Wrapper */
.tryon-redesign-wrapper {
    background-color: var(--dark-bg);
    padding: 2.5rem 1.5rem;
    min-height: calc(100vh - 120px);
}

.tryon-tab-outer-container {
    max-width: 100%;
    margin: 0 auto;
}

/* Steps Form Container */
#tryon-form {
    display: flex;
    flex-direction: row;
    gap: 1.5rem;
    width: 100%;
    align-items: stretch;
    min-height: 520px;
    overflow-x: auto;
    padding-bottom: 1rem;
}

/* Stepper Cards */
.stepper-step {
    animation: stepFadeInHorizontal 0.5s ease-out;
    display: none;
    flex-direction: column;
    flex-basis: 100%;
    min-width: 280px;
    max-width: 100%;
    transition: flex-basis 0.4s ease-out, max-width 0.4s ease-out;
}
@keyframes stepFadeInHorizontal {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}
.stepper-step.visible { display: flex !important; }

#tryon-form.single-step-mode .stepper-step.visible,
#tryon-form.two-steps-mode .stepper-step.visible[data-step-content="2"] {
    flex-basis: 100%;
    max-width: 450px;
    margin: 0 auto;
}
#tryon-form.two-steps-mode .stepper-step.visible[data-step-content="2"].multi-garment-active {
    max-width: 820px;
}

/* --- START OF CORRECTED MODIFICATION for Final View Sizing --- */
/* Base size for all cards in the final 3-step view */
#tryon-form.three-steps-mode .stepper-step.visible {
    flex-basis: calc(33.333% - 1rem);
    max-width: 350px;
    flex-grow: 0; /* Prevent unwanted growing by default */
    flex-shrink: 1;
}

/* Specific override for the middle card ONLY when it has two garments */
#tryon-form.three-steps-mode .stepper-step.visible[data-step-content="2"].multi-garment-active {
    flex-basis: 50%; /* Ask for more initial space */
    flex-grow: 1; /* Allow it to take up available extra space */
    max-width: 720px; /* Set a reasonable max-width */
}
/* --- END OF CORRECTED MODIFICATION --- */


.stepper-step .tryon-step-card {
    background-color: var(--card-bg);
    color: #111827;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    transition: border-color 0.3s ease, max-width 0.4s ease-in-out;
}

.stepper-step.completed-step .tryon-step-card { border-color: #22c55e; }
.stepper-step.completed-step .tryon-step-card .card-header::before {
    content: '\f00c '; font-family: 'Font Awesome 6 Free'; font-weight: 900;
    color: #22c55e; margin-left: 8px;
}
.stepper-step.active-card .tryon-step-card {
    border-color: var(--primary-accent);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.4);
}

.tryon-step-card .card-header {
    margin: 0;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    font-size: 1.25em;
    font-weight: 700;
    color: #111827;
    background-color: #f9fafb;
    border-radius: 11px 11px 0 0;
    text-align: center;
}
.tryon-step-card .card-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* START OF MODIFIED CODE: Center the result content */
.action-result-card-content {
    justify-content: center;
    align-items: center;
}
/* END OF MODIFIED CODE */

.tryon-step-card .step-actions {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: center;
    gap: 1rem;
    background-color: #f9fafb;
    border-radius: 0 0 11px 11px;
    margin-top: auto;
}

.image-upload-label { cursor: pointer; }
.image-preview-box {
    height: 200px;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    background-color: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.image-preview-box:hover { border-color: var(--primary-accent); }

.image-preview-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.image-preview-text { color: #6b7280; }
.image-preview-box.has-image .image-preview-text {
    font-size: 0.8em;
    color: #333;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 2px 5px;
    border-radius: 3px;
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    max-width: calc(100% - 20px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.image-upload-input-hidden { display: none !important; }

.tryon-step-card .form-field-group { margin-bottom: 1rem; }
.tryon-step-card label:not(.image-upload-label):not(.inline-label) {
    font-size: 0.9em; font-weight: 600; color: #374151;
}
.tryon-step-card select, .tryon-step-card input[type="number"] {
    background-color: #f9fafb; border: 1px solid #d1d5db; border-radius: 6px;
    padding: 10px; font-size: 1rem;
}
.tryon-step-card select:focus, .tryon-step-card input[type="number"]:focus {
    border-color: var(--primary-accent);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2);
    outline: none;
}
hr.section-divider { border-top: 1px solid #e5e7eb; }

/* Action Buttons */
.step-actions .action-button-primary,
.step-actions .action-button-secondary {
    padding: 0.75rem 1.5rem; font-size: 1rem; font-weight: 700; border-radius: 50px;
    display: inline-flex; align-items: center; gap: 0.5rem; border: none;
}
.step-actions .action-button-primary { background: linear-gradient(90deg, var(--primary-accent), var(--secondary-accent)); color:white; }
.step-actions .action-button-secondary { background: #4b5563; color: white; }
.step-actions .action-button-secondary:hover { background: #374151; }

/* Final CTA Button */
.tryon-cta-button {
    font-size: 1.2rem;
    padding: 1rem 2rem;
    background: linear-gradient(90deg, var(--primary-accent), var(--secondary-accent));
}
.tryon-cta-button:disabled { background: #4b5563; }

/* Result Card Styles */
.tryon-step-card.action-result-card #tryon-result-image {
    max-height: 350px; border: 1px solid #e5e7eb; border-radius: 8px;
    background-color: #f9fafb;
}
.tryon-step-card.action-result-card .card-processing-indicator {
    font-size: 1.25em; color: var(--primary-accent); font-weight: 600;
}
.tryon-secondary-button {
    background-color: #4b5563; color: white; border-radius: 50px;
}
.tryon-secondary-button:hover { background-color: #374151; }

.result-actions .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}


@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.garment-selection-container {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    align-items: stretch;
    margin-bottom: 1.5rem;
}
.garment-input-card {
    flex: 1;
    min-width: 250px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    background: #fdfdfd;
    display: flex;
    flex-direction: column;
    position: relative;
    animation: fadeIn 0.3s ease-in-out;
}
.garment-input-card h4 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 1rem;
    color: #333;
}
.garment-input-card .image-upload-label {
    flex-grow: 1;
}

.add-garment-btn {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    border: 2px dashed #d1d5db;
    cursor: pointer;
    background-color: #f9fafb;
    color: #4b5563;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.add-garment-btn:hover {
    border-color: var(--primary-accent);
    color: var(--primary-accent);
    background-color: #f3e8ff;
}
.remove-garment-btn {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background-color: #fee2e2;
    color: #ef4444;
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}
.remove-garment-btn:hover {
    background-color: #ef4444;
    color: white;
    transform: scale(1.1);
}

/* Status messages area */
.tryon-status-messages-area {
    margin: 2rem auto 0 auto; padding: 0 1rem; width: 100%; max-width: 800px;
}

/* Responsive */
@media (max-width: 991px) {
    #tryon-form { flex-direction: column; gap: 2rem; min-height: auto; }
    #tryon-form .stepper-step.visible,
    #tryon-form .stepper-step.visible.multi-garment-active {
        max-width: 600px;
    }
    .tryon-redesign-wrapper {
        min-height: auto;
    }
}

@media (max-width: 768px) {
    /* --- START OF MODIFICATION --- */
    .garment-selection-container {
        flex-direction: column;
    }
    .garment-input-card {
        min-width: unset;
    }
    /* --- END OF MODIFICATION --- */
}