/* =============================================
   MD Hair Preview AI — Frontend Styles
   ============================================= */

#mdhair-app {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: 820px;
    margin: 0 auto;
    padding: 20px 16px 40px;
    color: #1a1a1a;
    box-sizing: border-box;
}

#mdhair-app *,
#mdhair-app *::before,
#mdhair-app *::after {
    box-sizing: inherit;
}

/* ── Drop Zone ── */
#mdhair-drop-zone {
    border: 2px dashed #c8b99a;
    border-radius: 12px;
    padding: 48px 32px;
    text-align: center;
    cursor: pointer;
    background: #faf8f5;
    transition: border-color 0.2s, background 0.2s;
    outline: none;
}

#mdhair-drop-zone:hover,
#mdhair-drop-zone:focus,
#mdhair-drop-zone.mdhair-drag-over {
    border-color: #8b6f47;
    background: #f3ede3;
}

#mdhair-drop-zone svg {
    width: 48px;
    height: 48px;
    color: #8b6f47;
    margin-bottom: 12px;
}

.mdhair-drop-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #3a2c1e;
    margin: 0 0 6px;
}

.mdhair-drop-sub {
    font-size: 0.875rem;
    color: #7a6a58;
    margin: 0;
}

#mdhair-file-input {
    display: none;
}

/* ── Thumbnail after selection ── */
#mdhair-preview-thumb-wrap {
    margin-top: 20px;
    text-align: center;
}

#mdhair-preview-thumb {
    max-width: 240px;
    max-height: 240px;
    width: auto;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    display: block;
    margin: 0 auto 12px;
    object-fit: cover;
}

#mdhair-change-photo {
    background: none;
    border: none;
    color: #8b6f47;
    font-size: 0.875rem;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}

#mdhair-change-photo:hover {
    color: #5c4226;
}

/* ── Generate Button ── */
#mdhair-generate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 24px auto 0;
    background: #8b6f47;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 14px 36px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    min-width: 240px;
}

#mdhair-generate-btn:hover:not(:disabled) {
    background: #6b5035;
    transform: translateY(-1px);
}

#mdhair-generate-btn:disabled {
    background: #c8b99a;
    cursor: not-allowed;
    transform: none;
}

/* Spinner */
.mdhair-btn-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: mdhair-spin 0.75s linear infinite;
    flex-shrink: 0;
}

#mdhair-generate-btn.mdhair-loading .mdhair-btn-spinner {
    display: block;
}

@keyframes mdhair-spin {
    to { transform: rotate(360deg); }
}

/* ── Privacy note ── */
#mdhair-privacy-note {
    text-align: center;
    font-size: 0.8rem;
    color: #9a8878;
    margin-top: 14px;
}

/* ── Error ── */
#mdhair-error {
    background: #fff2f2;
    border: 1px solid #f5c0c0;
    color: #c0392b;
    border-radius: 8px;
    padding: 14px 18px;
    margin-top: 20px;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ── Results ── */
.mdhair-results-heading {
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: #3a2c1e;
    margin: 0 0 28px;
}

.mdhair-comparison {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.mdhair-comparison-card {
    flex: 1;
    min-width: 260px;
    max-width: 380px;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 24px rgba(0,0,0,0.12);
    background: #1a1a1a;
}

.mdhair-comparison-card img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

.mdhair-label {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 4px;
    backdrop-filter: blur(4px);
}

.mdhair-label-after {
    background: rgba(139, 111, 71, 0.85);
}

.mdhair-after-card {
    box-shadow: 0 6px 28px rgba(139, 111, 71, 0.3);
}

/* ── Actions below results ── */
.mdhair-actions {
    text-align: center;
    margin-top: 28px;
}

#mdhair-try-again {
    background: none;
    border: 2px solid #8b6f47;
    color: #8b6f47;
    border-radius: 8px;
    padding: 10px 28px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

#mdhair-try-again:hover {
    background: #8b6f47;
    color: #fff;
}

.mdhair-disclaimer {
    font-size: 0.78rem;
    color: #9a8878;
    margin-top: 14px;
}

/* ── Loading overlay on results ── */
#mdhair-loading-overlay {
    text-align: center;
    padding: 48px 0;
}

.mdhair-large-spinner {
    display: inline-block;
    width: 48px;
    height: 48px;
    border: 4px solid #e8ddd2;
    border-top-color: #8b6f47;
    border-radius: 50%;
    animation: mdhair-spin 0.85s linear infinite;
    margin-bottom: 16px;
}

.mdhair-loading-text {
    font-size: 1rem;
    color: #7a6a58;
    font-weight: 500;
}

/* ── Responsive ── */
@media (max-width: 560px) {
    #mdhair-drop-zone {
        padding: 36px 20px;
    }

    .mdhair-comparison {
        flex-direction: column;
        align-items: center;
    }

    .mdhair-comparison-card {
        max-width: 100%;
    }
}
