/* ====== SCOPED RESET ====== */
#mdph-form-root *,
#mdph-form-root *::before,
#mdph-form-root *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ====== ROOT CONTAINER ====== */
#mdph-form-root {
    max-width: 1200px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: transparent;
    padding: 1rem;
    -webkit-text-size-adjust: 100%;
    line-height: normal;
    font-size: 1rem;
    color: #1f2937;
}

#mdph-form-root .mdph-container {
    max-width: 700px;
    margin: 0 auto;
}

#mdph-form-root .mdph-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

#mdph-form-root .mdph-header h1 {
    font-size: 1.75rem;
    font-weight: 300;
    color: #1f2937;
    margin-bottom: 0.25rem;
}

#mdph-form-root .mdph-header p {
    color: #6b7280;
    font-size: 0.938rem;
}

#mdph-form-root .mdph-test-button {
    display: none;
}

/* ====== WELCOME PAGE ====== */
#mdph-form-root .mdph-welcome {
    text-align: center;
}

#mdph-form-root .mdph-welcome .mdph-logo {
    width: 10rem;
    margin-bottom: 1.5rem;
}

#mdph-form-root .mdph-welcome-card {
    background: white;
    border-radius: 1.25rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.06);
    padding: 2rem 1.5rem;
    text-align: center;
}

#mdph-form-root .mdph-welcome-title {
    font-size: 1.75rem;
    font-weight: 300;
    color: #1f2937;
    margin-bottom: 0.75rem;
}

#mdph-form-root .mdph-welcome-subtitle {
    font-size: 0.938rem;
    color: #6b7280;
    margin-bottom: 1.75rem;
    line-height: 1.6;
    max-width: 28rem;
    margin-left: auto;
    margin-right: auto;
}

/* Badges / Vignettes */
#mdph-form-root .mdph-welcome-badges {
    display: flex;
    justify-content: center;
    gap: 0.625rem;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
}

#mdph-form-root .mdph-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    list-style: none;
}

#mdph-form-root .mdph-badge-icon {
    font-size: 1rem;
    line-height: 1;
}

#mdph-form-root .mdph-badge-green {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

#mdph-form-root .mdph-badge-blue {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

#mdph-form-root .mdph-badge-purple {
    background: #f5f3ff;
    color: #5b21b6;
    border: 1px solid #ddd6fe;
}

/* Tip block */
#mdph-form-root .mdph-welcome-tips {
    margin-bottom: 1.5rem;
}

#mdph-form-root .mdph-welcome-tip {
    display: flex;
    gap: 0.875rem;
    align-items: flex-start;
    text-align: left;
    background: linear-gradient(135deg, #fefce8 0%, #fff7ed 100%);
    border: 1px solid #fde68a;
    border-radius: 0.875rem;
    padding: 1rem 1.125rem;
}

#mdph-form-root .mdph-tip-icon {
    font-size: 1.375rem;
    flex-shrink: 0;
    margin-top: 0.05rem;
}

#mdph-form-root .mdph-welcome-tip strong {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #92400e;
    margin-bottom: 0.25rem;
}

#mdph-form-root .mdph-welcome-tip p {
    font-size: 0.813rem;
    color: #78716c;
    line-height: 1.55;
    margin: 0;
}

#mdph-form-root .mdph-welcome-encourage {
    font-size: 0.938rem;
    color: #4b5563;
    text-align: center;
    line-height: 1.6;
    padding: 1.25rem 0.5rem;
    margin-bottom: 1.5rem;
    border-top: 1px solid #f3f4f6;
    font-style: italic;
}

#mdph-form-root .mdph-button-start {
    display: block;
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-size: 1.125rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}

#mdph-form-root .mdph-button-start:hover {
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

#mdph-form-root .mdph-button-start:active {
    transform: scale(0.98);
}

/* ====== LOGO SMALL (in-form header) ====== */
#mdph-form-root .mdph-logo-small {
    width: 6rem;
}

/* ====== LOGO & BRANDING ====== */
#mdph-form-root .mdph-logo {
    display: block;
    width: 9rem;
    height: auto;
    margin: 0 auto 1rem;
    opacity: 0.9;
}

#mdph-form-root .mdph-icon-result {
    width: 2rem;
    height: auto;
    margin-bottom: 0.75rem;
    opacity: 0.7;
}

#mdph-form-root .mdph-powered-by {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #f3f4f6;
}

#mdph-form-root .mdph-powered-icon {
    width: 1rem;
    height: auto;
}

#mdph-form-root .mdph-powered-by span {
    font-size: 0.688rem;
    color: #6b7280;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* ====== SECTION PROGRESS BAR ====== */
#mdph-form-root .mdph-section-progress {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    padding: 0 0.25rem;
    position: relative;
    gap: 0.125rem;
}

/* Connecting line behind dots */
#mdph-form-root .mdph-section-progress::before {
    content: '';
    position: absolute;
    top: 1.125rem;
    left: 1.5rem;
    right: 1.5rem;
    height: 2px;
    background: #e5e7eb;
    z-index: 0;
}

#mdph-form-root .mdph-section-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
    z-index: 1;
}

#mdph-form-root .mdph-section-dot {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: #f3f4f6;
    border: 2px solid #d1d5db;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.375rem;
    transition: all 0.3s ease;
    font-size: 0.875rem;
}

#mdph-form-root .mdph-section-icon {
    font-size: 0.938rem;
    line-height: 1;
}

#mdph-form-root .mdph-section-label {
    font-size: 0.625rem;
    color: #9ca3af;
    text-align: center;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    transition: color 0.3s;
    line-height: 1.2;
}

/* Current section */
#mdph-form-root .mdph-section-step.current .mdph-section-dot {
    background: linear-gradient(135deg, #dbeafe 0%, #e9d5ff 100%);
    border-color: #a78bfa;
    box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.2);
}

#mdph-form-root .mdph-section-step.current .mdph-section-label {
    color: #7c3aed;
    font-weight: 600;
}

/* Done section */
#mdph-form-root .mdph-section-step.done .mdph-section-dot {
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    border-color: #a78bfa;
    color: white;
}

#mdph-form-root .mdph-section-step.done .mdph-section-label {
    color: #6b7280;
}

/* ====== SECTION BADGE ====== */
#mdph-form-root .mdph-section-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    background: linear-gradient(135deg, #ede9fe 0%, #dbeafe 100%);
    color: #6d28d9;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 1rem;
}

/* ====== CARD ====== */
#mdph-form-root .mdph-card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
}

#mdph-form-root .mdph-question {
    font-size: 1.25rem;
    font-weight: 400;
    color: #1f2937;
    margin-bottom: 1.25rem;
    line-height: 1.4;
}

/* ====== SELECT HINT for multiple choice ====== */
#mdph-form-root .mdph-select-hint {
    font-size: 0.813rem;
    color: #8b5cf6;
    font-weight: 500;
    margin-bottom: 0.75rem;
    padding-left: 0.125rem;
}

/* ====== OPTIONS ====== */
#mdph-form-root .mdph-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    list-style: none;
}

#mdph-form-root .mdph-option {
    width: 100%;
    text-align: left;
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    border: 2px solid #e5e7eb;
    background: white;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: flex-start;
    font-size: 0.938rem;
    line-height: 1.4;
    list-style: none;
    -webkit-tap-highlight-color: transparent;
}

#mdph-form-root .mdph-option:hover {
    border-color: #d1d5db;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

#mdph-form-root .mdph-option:active {
    transform: scale(0.99);
}

#mdph-form-root .mdph-option.selected {
    background: linear-gradient(135deg, #dbeafe 0%, #e9d5ff 100%);
    border-color: #a78bfa;
    color: #1f2937;
}

#mdph-form-root .mdph-option-text {
    flex: 1;
}

#mdph-form-root .mdph-checkbox {
    width: 1.25rem;
    height: 1.25rem;
    min-width: 1.25rem;
    border-radius: 0.375rem;
    border: 2px solid #d1d5db;
    margin-right: 0.75rem;
    margin-top: 0.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}

#mdph-form-root .mdph-option.selected .mdph-checkbox {
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    border-color: #a78bfa;
}

#mdph-form-root .mdph-checkbox svg {
    width: 0.75rem;
    height: 0.75rem;
    color: white;
}

#mdph-form-root .mdph-radio {
    width: 1.25rem;
    height: 1.25rem;
    min-width: 1.25rem;
    border-radius: 50%;
    border: 2px solid #d1d5db;
    margin-right: 0.75rem;
    margin-top: 0.1rem;
    flex-shrink: 0;
    transition: all 0.15s;
}

#mdph-form-root .mdph-option.selected .mdph-radio {
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    border-color: #a78bfa;
}

/* ====== INPUTS ====== */
#mdph-form-root .mdph-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
    background: white;
    color: #1f2937;
}

#mdph-form-root .mdph-input:focus {
    outline: none;
    border-color: #a78bfa;
}

#mdph-form-root .mdph-textarea {
    resize: vertical;
    min-height: 7rem;
    line-height: 1.5;
}

#mdph-form-root .mdph-other-input {
    margin-top: 0.5rem;
}

/* ====== HINT BLOCK (free text encouragement) ====== */
#mdph-form-root .mdph-hint-block {
    font-size: 0.875rem;
    color: #92400e;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 0.625rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* ====== BUTTONS ====== */
#mdph-form-root .mdph-buttons {
    display: flex;
    gap: 0.625rem;
    margin-top: 1.5rem;
}

#mdph-form-root .mdph-button {
    padding: 0.875rem 1.5rem;
    border-radius: 0.75rem;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}

#mdph-form-root .mdph-button-prev {
    background: #f3f4f6;
    color: #374151;
    padding: 0.875rem 1.25rem;
    font-size: 1.125rem;
}

#mdph-form-root .mdph-button-prev:hover {
    background: #e5e7eb;
}

#mdph-form-root .mdph-button-next {
    flex: 1;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#mdph-form-root .mdph-button-next:hover {
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
}

#mdph-form-root .mdph-button-next:active {
    transform: scale(0.98);
}

#mdph-form-root .mdph-button-next:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    box-shadow: none;
}

/* ====== RESULT PAGE ====== */
#mdph-form-root .mdph-result {
    max-width: 800px;
    margin: 0 auto;
}

#mdph-form-root .mdph-result-header {
    margin-bottom: 1.5rem;
}

#mdph-form-root .mdph-result-header h2 {
    font-size: 1.75rem;
    font-weight: 300;
    color: #1f2937;
    margin-bottom: 0.25rem;
}

#mdph-form-root .mdph-result-header p {
    color: #6b7280;
}

#mdph-form-root .mdph-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 0;
}

#mdph-form-root .mdph-spinner {
    position: relative;
    width: 4rem;
    height: 4rem;
}

#mdph-form-root .mdph-spinner-circle {
    position: absolute;
    width: 4rem;
    height: 4rem;
    border: 3px solid #e9d5ff;
    border-radius: 50%;
}

#mdph-form-root .mdph-spinner-circle-animated {
    position: absolute;
    width: 4rem;
    height: 4rem;
    border: 3px solid #8b5cf6;
    border-radius: 50%;
    border-top-color: transparent;
    animation: mdph-spin 1s linear infinite;
}

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

#mdph-form-root .mdph-loader-text {
    margin-top: 1.25rem;
    font-size: 1.063rem;
    font-weight: 500;
    color: #374151;
}

#mdph-form-root .mdph-loader-subtext {
    margin-top: 0.375rem;
    font-size: 0.875rem;
    color: #6b7280;
}

#mdph-form-root .mdph-generated {
    margin-bottom: 1.5rem;
}

#mdph-form-root .mdph-text-box {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid #6ee7b7;
    max-height: 28rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#mdph-form-root .mdph-text-content {
    color: #1f2937;
    line-height: 1.75;
    text-align: justify;
    white-space: pre-wrap;
    font-size: 0.938rem;
}

#mdph-form-root .mdph-action-buttons {
    display: flex;
    gap: 0.75rem;
}

#mdph-form-root .mdph-button-copy-main {
    flex: 1;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}

#mdph-form-root .mdph-button-copy-main:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

#mdph-form-root .mdph-button-copy-main:active {
    transform: scale(0.98);
}

#mdph-form-root .mdph-button-restart {
    padding: 0.875rem 1.5rem;
    background: #f3f4f6;
    color: #374151;
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}

#mdph-form-root .mdph-button-restart:hover {
    background: #e5e7eb;
}

/* ====== RESPONSIVE ====== */
@media (min-width: 640px) {
    #mdph-form-root {
        padding: 2rem;
    }

    #mdph-form-root .mdph-header h1 {
        font-size: 2.25rem;
    }

    #mdph-form-root .mdph-card {
        padding: 2rem;
    }

    #mdph-form-root .mdph-question {
        font-size: 1.5rem;
    }

    #mdph-form-root .mdph-section-label {
        font-size: 0.688rem;
    }

    #mdph-form-root .mdph-section-dot {
        width: 2.5rem;
        height: 2.5rem;
    }

    #mdph-form-root .mdph-welcome-card {
        padding: 2.5rem 2.5rem;
    }

    #mdph-form-root .mdph-welcome-title {
        font-size: 2.125rem;
    }

    #mdph-form-root .mdph-welcome .mdph-logo {
        width: 12rem;
    }

    #mdph-form-root .mdph-badge {
        padding: 0.75rem 1.25rem;
        font-size: 0.938rem;
    }
}

@media (max-width: 480px) {
    #mdph-form-root .mdph-section-progress {
        gap: 0;
    }

    #mdph-form-root .mdph-section-dot {
        width: 2rem;
        height: 2rem;
    }

    #mdph-form-root .mdph-section-icon {
        font-size: 0.75rem;
    }

    /* Hide all labels, show only current */
    #mdph-form-root .mdph-section-label {
        display: none;
    }

    #mdph-form-root .mdph-section-step.current .mdph-section-label {
        display: block;
        font-size: 0.625rem;
        letter-spacing: 0;
    }

    #mdph-form-root .mdph-section-progress::before {
        left: 1rem;
        right: 1rem;
        top: 1rem;
    }

    #mdph-form-root .mdph-option {
        padding: 0.75rem 0.875rem;
        font-size: 0.875rem;
    }

    #mdph-form-root .mdph-question {
        font-size: 1.125rem;
    }

    #mdph-form-root .mdph-text-box {
        padding: 1rem;
    }

    #mdph-form-root .mdph-action-buttons {
        flex-direction: column;
    }

    /* Welcome page — left aligned on mobile */
    #mdph-form-root .mdph-welcome {
        text-align: left;
    }

    #mdph-form-root .mdph-welcome .mdph-logo {
        margin-left: 0;
        margin-right: auto;
    }

    #mdph-form-root .mdph-welcome-card {
        text-align: left;
    }

    #mdph-form-root .mdph-welcome-subtitle {
        text-align: left;
        margin-left: 0;
    }

    #mdph-form-root .mdph-welcome-badges {
        justify-content: flex-start;
    }

    #mdph-form-root .mdph-welcome-encourage {
        text-align: left;
    }
}
