/* ============================================
   Masjid Family Survey Form - Enhanced Design
   ============================================ */

/* Reset & Base */
.mfs-form-wrapper {
    max-width: 920px;
    margin: 20px auto;
    padding: 45px 40px;
    background: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    color: #333;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.10), 0 1px 4px rgba(0,0,0,0.06);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

.mfs-form-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #1a3a5c, #2e6b9e, #1a3a5c);
}

.mfs-form-wrapper * {
    box-sizing: border-box;
}

/* Title */
.mfs-form-title {
    text-align: center;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 2.4em;
    font-weight: 700;
    color: #1a1a1a;
    margin: 10px 0 32px 0;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

/* Progress Bar */
.mfs-progress-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 40px;
    flex-wrap: wrap;
    padding: 16px 10px;
    background: #f8f9fb;
    border-radius: 10px;
    border: 1px solid #e8ecf1;
}

.mfs-step {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: default;
    transition: all 0.3s ease;
}

.mfs-step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #c5cdd8;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.mfs-step.active .mfs-step-number {
    background: #1a3a5c;
    box-shadow: 0 0 0 4px rgba(26, 58, 92, 0.18);
    transform: scale(1.1);
}

.mfs-step.completed .mfs-step-number {
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

.mfs-step-label {
    font-size: 13px;
    color: #8896a7;
    white-space: nowrap;
    font-weight: 500;
    transition: color 0.3s;
}

.mfs-step.active .mfs-step-label {
    color: #1a3a5c;
    font-weight: 700;
}

.mfs-step.completed .mfs-step-label {
    color: #22c55e;
}

/* Section Title */
.mfs-section-title {
    font-size: 1.6em;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 28px 0;
    padding-bottom: 12px;
    border-bottom: 3px solid #1a3a5c;
    text-decoration: underline;
    text-underline-offset: 8px;
    text-decoration-color: #1a3a5c;
}

/* Page */
.mfs-page {
    display: none;
}

.mfs-page.active {
    display: block;
    animation: mfsFadeIn 0.35s ease;
}

@keyframes mfsFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Grid */
.mfs-row {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-bottom: 22px;
}

.mfs-col-3 {
    flex: 1 1 calc(25% - 14px);
    min-width: 140px;
}

.mfs-col-6 {
    flex: 1 1 calc(50% - 9px);
    min-width: 240px;
}

.mfs-col-12 {
    flex: 1 1 100%;
}

/* Labels */
.mfs-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 7px;
    letter-spacing: 0.01em;
}

.mfs-required {
    color: #ef4444;
    font-weight: 700;
}

.mfs-mt-8 {
    margin-top: 8px;
}

/* Inputs */
.mfs-input,
.mfs-select,
.mfs-textarea {
    width: 100%;
    padding: 11px 15px;
    font-size: 14px;
    border: 1.5px solid #d1d9e6;
    border-radius: 8px;
    background: #fff;
    color: #333;
    transition: border-color 0.25s, box-shadow 0.25s;
    -webkit-appearance: none;
    appearance: none;
}

.mfs-input:hover,
.mfs-select:hover,
.mfs-textarea:hover {
    border-color: #9badc2;
}

.mfs-input:focus,
.mfs-select:focus,
.mfs-textarea:focus {
    outline: none;
    border-color: #1a3a5c;
    box-shadow: 0 0 0 4px rgba(26, 58, 92, 0.10);
}

.mfs-input::placeholder {
    color: #a0aec0;
}

.mfs-select {
    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 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
}

.mfs-textarea {
    resize: vertical;
    min-height: 90px;
    line-height: 1.5;
}

.mfs-input.error,
.mfs-select.error {
    border-color: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.08);
    animation: mfsShake 0.4s ease;
}

@keyframes mfsShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* Yes/No Tables & Rating Tables */
.mfs-yn-section,
.mfs-rating-section {
    margin-bottom: 28px;
}

.mfs-yn-table,
.mfs-rating-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

.mfs-yn-table th,
.mfs-rating-table th {
    background: linear-gradient(180deg, #f7f9fc 0%, #eef2f7 100%);
    padding: 14px 18px;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    color: #1a3a5c;
    border-bottom: 2px solid #d1d9e6;
}

.mfs-yn-table th:first-child,
.mfs-rating-table th:first-child {
    text-align: left;
    width: 60%;
}

.mfs-yn-table td,
.mfs-rating-table td {
    padding: 15px 18px;
    font-size: 14px;
    border-bottom: 1px solid #f0f4f8;
    text-align: center;
    vertical-align: middle;
    transition: background 0.2s;
}

.mfs-yn-table td:first-child,
.mfs-rating-table td:first-child {
    text-align: left;
    font-weight: 500;
    color: #374151;
    border-left: 4px solid transparent;
}

.mfs-yn-table tr:hover td,
.mfs-rating-table tr:hover td {
    background: #f0f7ff;
}

.mfs-yn-table tr:hover td:first-child,
.mfs-rating-table tr:hover td:first-child {
    border-left-color: #1a3a5c;
}

.mfs-yn-table tr:last-child td,
.mfs-rating-table tr:last-child td {
    border-bottom: none;
}

.mfs-yn-table input[type="radio"],
.mfs-rating-table input[type="radio"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #1a3a5c;
}

/* Family Member Card */
.mfs-family-member {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    position: relative;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.mfs-family-member:hover {
    border-color: #94a3b8;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.mfs-member-heading {
    font-size: 1.15em;
    font-weight: 700;
    color: #1a3a5c;
    margin: 0 0 18px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #d1d9e6;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mfs-member-heading::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #1a3a5c;
}

.mfs-btn-remove-member {
    background: #ef4444;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 12px;
    transition: background 0.2s, transform 0.2s;
}

.mfs-btn-remove-member:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* Buttons */
.mfs-buttons {
    display: flex;
    gap: 14px;
    margin-top: 35px;
    padding-top: 24px;
    border-top: 1.5px solid #e8ecf1;
}

.mfs-btn {
    padding: 13px 32px;
    font-size: 15px;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.02em;
}

.mfs-btn-next,
.mfs-btn-submit {
    background: linear-gradient(135deg, #1a3a5c 0%, #264a6e 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(26, 58, 92, 0.25);
}

.mfs-btn-next:hover,
.mfs-btn-submit:hover {
    background: linear-gradient(135deg, #142d47 0%, #1e3d5e 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(26, 58, 92, 0.35);
}

.mfs-btn-next:active,
.mfs-btn-submit:active {
    transform: translateY(0);
}

.mfs-btn-back {
    background: #fff;
    color: #1a3a5c;
    border: 2px solid #1a3a5c;
}

.mfs-btn-back:hover {
    background: #f0f4f8;
    transform: translateY(-1px);
}

.mfs-btn-add {
    background: #f0f7ff;
    color: #1a3a5c;
    border: 2px dashed #6b8db5;
    width: 100%;
    justify-content: center;
    padding: 16px;
    margin-bottom: 12px;
    font-size: 14px;
    border-radius: 10px;
    transition: all 0.25s;
}

.mfs-btn-add:hover {
    background: #dbeafe;
    border-color: #1a3a5c;
    transform: translateY(-1px);
}

/* Page indicator */
.mfs-page-indicator {
    text-align: right;
    font-size: 14px;
    color: #94a3b8;
    margin-top: 18px;
    font-weight: 500;
}

/* CAPTCHA Section */
.mfs-captcha-section {
    margin-top: 28px;
    margin-bottom: 10px;
}

.mfs-image-captcha {
    background: #f8f9fc;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    padding: 22px;
}

.mfs-captcha-image-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    background: #fff;
    border: 1.5px solid #d1d9e6;
    border-radius: 10px;
    padding: 10px 14px;
}

.mfs-captcha-img {
    max-width: 220px;
    height: 70px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: #f0f0f5;
}

.mfs-btn-refresh-captcha {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 10px;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
}

.mfs-btn-refresh-captcha:hover {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    transform: rotate(180deg);
}

.mfs-image-captcha .mfs-input {
    font-size: 16px;
    letter-spacing: 3px;
    text-transform: uppercase;
    font-weight: 600;
    color: #64748b;
}

.mfs-captcha-hint {
    font-size: 13px;
    color: #94a3b8;
    font-style: italic;
    margin: 10px 0 0 0;
}

.mfs-recaptcha {
    margin-top: 10px;
}

/* Radio Group (custom forms) */
.mfs-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 8px 0;
}

.mfs-radio-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
}

.mfs-radio-label input[type="radio"],
.mfs-radio-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #1a3a5c;
    cursor: pointer;
}

/* Success Message */
.mfs-success-box {
    text-align: center;
    padding: 70px 20px;
}

.mfs-success-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 40px;
    color: #fff;
    box-shadow: 0 8px 20px rgba(34, 197, 94, 0.3);
    animation: mfsSuccessPop 0.5s ease;
}

@keyframes mfsSuccessPop {
    0% { transform: scale(0); opacity: 0; }
    70% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

.mfs-success-box h2 {
    font-size: 2.2em;
    color: #22c55e;
    margin-bottom: 10px;
}

.mfs-success-box p {
    font-size: 1.15em;
    color: #64748b;
}

/* Loading Overlay */
#mfs-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.88);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    backdrop-filter: blur(2px);
}

.mfs-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #1a3a5c;
    border-radius: 50%;
    animation: mfsSpin 0.7s linear infinite;
}

@keyframes mfsSpin {
    to { transform: rotate(360deg); }
}

/* Error message */
.mfs-error-msg {
    background: linear-gradient(135deg, #fef2f2, #fff1f2);
    color: #dc2626;
    padding: 14px 18px;
    border-radius: 8px;
    border: 1px solid #fca5a5;
    border-left: 4px solid #ef4444;
    margin-bottom: 22px;
    font-size: 14px;
    font-weight: 600;
    animation: mfsFadeIn 0.3s ease;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
    .mfs-form-wrapper {
        padding: 24px 18px;
        margin: 12px;
        border-radius: 10px;
    }

    .mfs-form-title {
        font-size: 1.65em;
        margin-bottom: 20px;
    }

    .mfs-progress-bar {
        gap: 4px;
        padding: 12px 8px;
    }

    .mfs-step-label {
        display: none;
    }

    .mfs-step-number {
        width: 34px;
        height: 34px;
        font-size: 14px;
    }

    .mfs-row {
        gap: 14px;
    }

    .mfs-col-3,
    .mfs-col-6 {
        flex: 1 1 100%;
        min-width: 100%;
    }

    .mfs-section-title {
        font-size: 1.25em;
    }

    .mfs-buttons {
        flex-direction: column;
    }

    .mfs-btn {
        width: 100%;
        justify-content: center;
        padding: 14px 20px;
    }

    .mfs-yn-table th:first-child,
    .mfs-rating-table th:first-child {
        width: auto;
    }

    .mfs-yn-table,
    .mfs-rating-table {
        font-size: 13px;
    }

    .mfs-yn-table td,
    .mfs-rating-table td {
        padding: 12px 10px;
    }

    .mfs-yn-table th,
    .mfs-rating-table th {
        padding: 12px 10px;
    }

    .mfs-family-member {
        padding: 16px;
    }

    .mfs-captcha-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .mfs-captcha-input {
        max-width: 100%;
    }

    .mfs-captcha-question {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .mfs-form-wrapper {
        padding: 18px 14px;
        margin: 6px;
        border-radius: 8px;
    }

    .mfs-form-title {
        font-size: 1.35em;
    }

    .mfs-input,
    .mfs-select,
    .mfs-textarea {
        padding: 12px 13px;
        font-size: 16px; /* prevents zoom on iOS */
    }

    .mfs-btn {
        padding: 14px 18px;
        font-size: 15px;
    }

    .mfs-yn-table td:first-child,
    .mfs-rating-table td:first-child {
        font-size: 12px;
        padding-left: 10px;
    }

    .mfs-step-number {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .mfs-progress-bar {
        gap: 3px;
    }

    .mfs-yn-table input[type="radio"],
    .mfs-rating-table input[type="radio"] {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 360px) {
    .mfs-form-wrapper {
        padding: 14px 10px;
        margin: 4px;
    }

    .mfs-form-title {
        font-size: 1.15em;
    }

    .mfs-section-title {
        font-size: 1.1em;
    }
}

/* Print Styles */
@media print {
    .mfs-form-wrapper {
        box-shadow: none;
        padding: 0;
    }

    .mfs-buttons,
    .mfs-progress-bar,
    .mfs-captcha-section {
        display: none;
    }

    .mfs-form-wrapper::before {
        display: none;
    }
}
