/* ==========================================
   MULTI-STEP FORM (msf) - Modern Stepper Design
   Clean, Responsive, RTL-Ready
   ========================================== */

/* ── Variables ── */
:root {
    --msf-primary: #112d53;
    --msf-secondary: #da7900;
    --msf-success: #28a745;
    --msf-danger: #dc3545;
    --msf-text: #333;
    --msf-text-light: #666;
    --msf-text-muted: #999;
    --msf-border: #d0d0d0;
    --msf-bg: #f8f5f0;
    --msf-white: #fff;
    --msf-radius: 10px;
    --msf-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    --msf-transition: all 0.3s ease;
}

/* ── Hero Section ── */
.msf-hero {
    background: linear-gradient(135deg, var(--msf-primary) 0%, #1a3f6f 100%);
    padding: 100px 0 50px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.msf-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.msf-hero .container {
    position: relative;
    z-index: 1;
}

.msf-hero-title {
    font-size: 2.2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 12px;
}

.msf-hero-subtitle {
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.8);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.7;
}

/* ── Breadcrumb ── */
.msf-breadcrumb {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.msf-breadcrumb a {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    text-decoration: none;
    transition: var(--msf-transition);
}

.msf-breadcrumb a:hover {
    color: #fff;
}

.msf-breadcrumb-sep {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
}

.msf-breadcrumb-current {
    color: var(--msf-secondary);
    font-weight: 600;
    font-size: 0.9rem;
}

/* ── Form Section ── */
.msf-section {
    padding: 50px 0 80px;
    background: var(--msf-bg);
    min-height: 50vh;
}

.msf-wrapper {
    max-width: 780px;
    margin: 0 auto;
}

/* ══════════════════════════════════════════
   STEPPER PROGRESS BAR
   ══════════════════════════════════════════ */
.msf-stepper {
    margin-bottom: 40px;
}

.msf-stepper-track {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    position: relative;
}

.msf-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    flex-shrink: 0;
}

.msf-step-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    border: 3px solid var(--msf-border);
    background: var(--msf-white);
    color: var(--msf-text-muted);
    transition: var(--msf-transition);
    position: relative;
}

.msf-step-label {
    margin-top: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--msf-text-muted);
    white-space: nowrap;
    transition: var(--msf-transition);
}

/* Active step */
.msf-step.active .msf-step-circle {
    border-color: var(--msf-success);
    background: var(--msf-success);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(40, 167, 69, 0.15);
}

.msf-step.active .msf-step-label {
    color: var(--msf-success);
    font-weight: 600;
}

/* Completed step */
.msf-step.completed .msf-step-circle {
    border-color: var(--msf-success);
    background: var(--msf-success);
    color: #fff;
}

.msf-step.completed .msf-step-circle::after {
    content: '✓';
    font-size: 1.1rem;
}

.msf-step.completed .msf-step-circle span,
.msf-step.completed .msf-step-circle {
    font-size: 0;
}

.msf-step.completed .msf-step-circle::after {
    font-size: 1.1rem;
}

.msf-step.completed .msf-step-label {
    color: var(--msf-success);
}

/* Connecting line */
.msf-step-line {
    flex: 1;
    height: 3px;
    background: var(--msf-border);
    min-width: 60px;
    max-width: 140px;
    margin: 0 8px;
    margin-bottom: 26px;
    border-radius: 2px;
    transition: background 0.4s ease;
    z-index: 1;
}

.msf-step-line.completed {
    background: var(--msf-success);
}

/* ══════════════════════════════════════════
   FORM PANELS
   ══════════════════════════════════════════ */
.msf-panel {
    display: none;
    animation: msfFadeIn 0.35s ease;
}

.msf-panel.active {
    display: block;
}

@keyframes msfFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.msf-panel-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--msf-primary);
    margin-bottom: 28px;
    padding-bottom: 14px;
    border-bottom: 2px solid #e8e8e8;
    text-align: center;
}

/* ── Form Grid ── */
.msf-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
}

.msf-grid--single {
    grid-template-columns: 1fr;
}

/* ── Field ── */
.msf-field {
    display: flex;
    flex-direction: column;
}

.msf-field--full {
    grid-column: 1 / -1;
}

.msf-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--msf-text);
    margin-bottom: 8px;
}

.msf-label svg {
    flex-shrink: 0;
    color: var(--msf-text-light);
}

.msf-req {
    color: var(--msf-danger);
    font-weight: 700;
}

/* ── Inputs ── */
.msf-input,
.msf-field input[type="text"],
.msf-field input[type="email"],
.msf-field input[type="tel"],
.msf-field input[type="number"],
.msf-field select,
.msf-field textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--msf-border);
    border-radius: var(--msf-radius);
    font-size: 0.95rem;
    color: var(--msf-text);
    background: var(--msf-white);
    transition: var(--msf-transition);
    font-family: 'Poppins', sans-serif;
    box-sizing: border-box;
}

.msf-input:focus,
.msf-field input:focus,
.msf-field select:focus,
.msf-field textarea:focus {
    outline: none;
    border-color: var(--msf-secondary);
    box-shadow: 0 0 0 3px rgba(218, 121, 0, 0.1);
}

.msf-input::placeholder,
.msf-field input::placeholder {
    color: #bbb;
}

/* Select arrow (RTL) */
.msf-field select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 14px center;
    padding-left: 36px;
}

/* Invalid state */
.msf-field.has-error input,
.msf-field.has-error select {
    border-color: var(--msf-danger);
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.08);
}

/* ── Phone Row ── */
.msf-phone-row {
    display: flex;
    gap: 10px;
    direction: ltr;
}

.msf-phone-row select {
    flex: 0 0 140px;
    direction: ltr;
    text-align: left;
}

.msf-phone-row input {
    flex: 1;
}

/* Country code selector override */
.msf-country-code {
    text-align: left !important;
    direction: ltr !important;
}

/* ── File Upload Zone ── */
.msf-upload-zone {
    position: relative;
    cursor: pointer;
}

.msf-upload-zone .msf-file-input,
.msf-upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 3;
    width: 100%;
    height: 100%;
}

.msf-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 36px 20px;
    border: 2px dashed var(--msf-border);
    border-radius: var(--msf-radius);
    background: #fafafa;
    transition: var(--msf-transition);
    text-align: center;
}

.msf-upload-placeholder span {
    font-size: 0.92rem;
    color: var(--msf-text-light);
    font-weight: 500;
}

.msf-upload-placeholder small {
    font-size: 0.78rem;
    color: var(--msf-text-muted);
}

.msf-upload-zone:hover .msf-upload-placeholder,
.msf-upload-zone.dragover .msf-upload-placeholder {
    border-color: var(--msf-secondary);
    background: rgba(218, 121, 0, 0.03);
}

.msf-upload-zone.has-file .msf-upload-placeholder {
    border-color: var(--msf-success);
    border-style: solid;
    background: rgba(40, 167, 69, 0.04);
}

.msf-upload-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(40, 167, 69, 0.06);
    border-radius: var(--msf-radius);
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--msf-success);
    font-weight: 500;
}

.msf-upload-preview svg {
    flex-shrink: 0;
}

/* ── Field Errors ── */
.msf-field-error {
    font-size: 0.8rem;
    color: var(--msf-danger);
    margin-top: 4px;
    font-weight: 500;
}

.msf-field-error ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.msf-errors-banner {
    background: #fff5f5;
    border: 1px solid #fed7d7;
    border-radius: var(--msf-radius);
    padding: 14px 18px;
    margin-bottom: 24px;
    color: var(--msf-danger);
    font-size: 0.88rem;
    text-align: center;
}

.msf-errors-banner ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* ══════════════════════════════════════════
   NAVIGATION BUTTONS
   ══════════════════════════════════════════ */
.msf-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 36px;
    padding-top: 28px;
    border-top: 2px solid #e8e8e8;
}

.msf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 36px;
    border: none;
    border-radius: var(--msf-radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--msf-transition);
    font-family: 'Poppins', sans-serif;
    min-width: 140px;
}

/* Next button - Green */
.msf-btn--next {
    background: var(--msf-success);
    color: #fff;
    box-shadow: 0 4px 14px rgba(40, 167, 69, 0.3);
}

.msf-btn--next:hover {
    background: #218838;
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
    transform: translateY(-2px);
}

/* Back button */
.msf-btn--back {
    background: transparent;
    color: var(--msf-text-light);
    border: 1.5px solid var(--msf-border);
}

.msf-btn--back:hover {
    background: #f5f5f5;
    color: var(--msf-text);
    border-color: #aaa;
}

/* Submit button */
.msf-btn--submit {
    background: var(--msf-secondary);
    color: #fff;
    box-shadow: 0 4px 18px rgba(218, 121, 0, 0.3);
    min-width: 200px;
    padding: 14px 40px;
}

.msf-btn--submit:hover {
    background: #c26d00;
    box-shadow: 0 6px 24px rgba(218, 121, 0, 0.4);
    transform: translateY(-2px);
}

.msf-btn:active {
    transform: translateY(0);
}

/* ══════════════════════════════════════════
   SUCCESS STATE
   ══════════════════════════════════════════ */
.msf-success {
    text-align: center;
    padding: 60px 30px;
    background: var(--msf-white);
    border-radius: 16px;
    box-shadow: var(--msf-shadow);
}

.msf-success-icon {
    margin: 0 auto 24px;
    animation: msfCheckmark 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes msfCheckmark {
    0%   { transform: scale(0) rotate(-10deg); opacity: 0; }
    50%  { transform: scale(1.15) rotate(5deg); }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

.msf-success h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--msf-primary);
    margin-bottom: 16px;
    line-height: 1.5;
}

.msf-success h3 span {
    color: var(--msf-secondary);
}

.msf-success p {
    font-size: 1rem;
    color: var(--msf-text-light);
    line-height: 1.8;
    margin-bottom: 28px;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

.msf-success p strong {
    color: var(--msf-primary);
}

.msf-success-actions {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ══════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════ */
@media (max-width: 768px) {
    .msf-hero {
        padding: 85px 0 40px;
    }

    .msf-hero-title {
        font-size: 1.5rem;
    }

    .msf-hero-subtitle {
        font-size: 0.95rem;
    }

    .msf-section {
        padding: 36px 0 60px;
    }

    .msf-wrapper {
        padding: 0 4px;
    }

    /* Stepper responsive */
    .msf-stepper-track {
        gap: 0;
    }

    .msf-step-circle {
        width: 36px;
        height: 36px;
        font-size: 0.85rem;
    }

    .msf-step-label {
        font-size: 0.7rem;
        max-width: 80px;
        text-align: center;
        white-space: normal;
        line-height: 1.3;
    }

    .msf-step-line {
        min-width: 30px;
        max-width: 60px;
    }

    /* Grid single column */
    .msf-grid {
        grid-template-columns: 1fr;
    }

    .msf-panel-title {
        font-size: 1.1rem;
    }

    /* Phone row stack */
    .msf-phone-row {
        flex-direction: column;
    }

    .msf-phone-row select {
        flex: 1;
    }

    /* Actions */
    .msf-actions {
        flex-direction: column-reverse;
        gap: 10px;
    }

    .msf-btn {
        width: 100%;
    }

    /* Success */
    .msf-success {
        padding: 40px 20px;
    }

    .msf-success h3 {
        font-size: 1.2rem;
    }

    .msf-success-actions {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .msf-hero-title {
        font-size: 1.3rem;
    }

    .msf-step-label {
        font-size: 0.65rem;
    }

    .msf-step-circle {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
        border-width: 2px;
    }
}
