* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
}

body {
    overflow-x: hidden;
    font-family: montserrat, Arial, sans-serif;
}

p {
    color: grey;
    font-size: 14px;
}

#heading {
    text-transform: uppercase;
    color: #16b2e1;
    font-weight: normal;
    font-size: 1.4rem;
    text-align: center;
    margin-bottom: 10px;
}

#msform {
    text-align: center;
    position: relative;
    margin-top: 10px;
    width: 100%;
}

    #msform fieldset {
        background: white;
        border: 0 none;
        border-radius: 0.5rem;
        box-sizing: border-box;
        width: 100%;
        margin: 0;
        padding: 15px;
        position: relative;
    }

.form-card {
    text-align: left;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

#msform fieldset:not(:first-of-type) {
    display: none;
}

/* Form elements - MOBILE FIRST */
#msform input,
#msform textarea,
#msform select {
    padding: 12px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-bottom: 15px;
    margin-top: 5px;
    width: 100%;
    box-sizing: border-box;
    font-family: montserrat;
    color: #2C3E50;
    background-color: #ECEFF1;
    font-size: 16px; /* Prevents zoom on iOS */
    letter-spacing: 0.5px;
    min-height: 48px; /* Better touch targets */
}

#msform2 input,
#msform2 textarea {
    padding: 12px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
    font-family: montserrat;
    color: #2C3E50;
    background-color: #ffffff;
    font-size: 16px;
}

#msform2 Button {
    padding: 12px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
    font-family: montserrat;
    color: #2C3E50;
    background-color: #ffffff;
    font-size: 16px;
}

#msform input:focus,
#msform textarea:focus,
#msform select:focus {
    -moz-box-shadow: none !important;
    -webkit-box-shadow: none !important;
    box-shadow: none !important;
    border: 2px solid #16b2e1;
    outline-width: 0;
}

/* Labels - MOBILE FIRST */
.control-label,
.fieldlabels,
label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #2C3E50;
    font-weight: 500;
    line-height: 1.4;
}

/* Radio buttons and checkboxes - MOBILE FRIENDLY */
input[type="radio"],
input[type="checkbox"] {
    width: 20px !important;
    height: 20px !important;
    margin-right: 8px;
    transform: scale(1.2); /* Larger touch targets */
}

.radio-group,
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin: 10px 0;
}

.radio-label,
.checkbox-label {
    display: flex;
    align-items: center;
    font-size: 14px;
}

/* File uploads - MOBILE FRIENDLY */
input[type="file"] {
    padding: 10px !important;
    background: white !important;
    border: 2px dashed #ccc !important;
    min-height: auto !important;
    font-size: 14px;
}

/* Buttons - MOBILE FRIENDLY */
#msform .action-button {
    width: 100%;
    background: #16b2e1;
    font-weight: bold;
    color: white;
    border: 0 none;
    border-radius: 8px;
    cursor: pointer;
    padding: 15px 20px;
    margin: 10px 0;
    font-size: 16px;
    min-height: 50px;
}

    #msform .action-button:hover,
    #msform .action-button:focus {
        background-color: #311B92;
    }

#msform .action-button-previous {
    width: 100%;
    background: #616161;
    font-weight: bold;
    color: white;
    border: 0 none;
    border-radius: 8px;
    cursor: pointer;
    padding: 15px 20px;
    margin: 10px 0;
    font-size: 16px;
    min-height: 50px;
}

    #msform .action-button-previous:hover,
    #msform .action-button-previous:focus {
        background-color: #000000;
    }

.card {
    z-index: 0;
    border: none;
    position: relative;
    width: 100%;
    padding: 10px;
}

.fs-title {
    font-size: 1.3rem;
    color: #16b2e1;
    margin-bottom: 15px;
    font-weight: 600;
    text-align: left;
}

.purple-text {
    color: #16b2e1;
    font-weight: normal;
}

.steps {
    font-size: 0.9rem;
    color: gray;
    margin-bottom: 15px;
    font-weight: normal;
    text-align: center;
}

/* Progress Bar - MOBILE FRIENDLY */
#progressbar {
    margin-bottom: 20px;
    overflow: hidden;
    color: lightgrey;
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
}

    #progressbar .active {
        color: #16b2e1;
    }

    #progressbar li {
        list-style-type: none;
        font-size: 12px;
        flex: 1;
        position: relative;
        font-weight: 400;
        text-align: center;
        padding: 5px 2px;
        min-width: 60px;
    }

        #progressbar li:before {
            width: 30px;
            height: 30px;
            line-height: 28px;
            display: block;
            font-size: 14px;
            color: #ffffff;
            background: lightgray;
            border-radius: 50%;
            margin: 0 auto 5px auto;
            padding: 0;
        }

        #progressbar li:after {
            content: '';
            width: 100%;
            height: 2px;
            background: lightgray;
            position: absolute;
            left: -50%;
            top: 15px;
            z-index: -1;
        }

        #progressbar li:first-child:after {
            content: none;
        }

        #progressbar li.active:before,
        #progressbar li.active:after {
            background: #16b2e1;
        }

/* Image previews - MOBILE FRIENDLY */
.image-upload-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 15px 0;
}

.upload-item {
    text-align: center;
}

    .upload-item img {
        width: 100%;
        max-width: 120px;
        height: 100px;
        object-fit: cover;
        border: 2px solid #ddd;
        border-radius: 8px;
        margin-bottom: 8px;
    }

    .upload-item label {
        font-size: 12px;
        margin-bottom: 5px;
    }

    .upload-item input[type="file"] {
        font-size: 12px;
        padding: 5px !important;
    }

/* Document upload sections */
.document-upload {
    margin: 10px 0;
}

.document-item {
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

    .document-item label {
        display: block;
        margin-bottom: 8px;
        font-weight: 500;
    }

/* Form layout - MOBILE FIRST */
.form-section {
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 15px;
}

/* Responsive grid for mobile */
.mobile-form-layout .form-row {
    display: block;
}

.mobile-form-layout .form-col {
    width: 100%;
    margin-bottom: 15px;
}

/* Checkbox and radio groups for mobile */
.mobile-radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mobile-radio-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
}

/* Declaration section */
.declaration-section {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 15px;
    margin: 20px 0;
}

.declaration-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

    .declaration-checkbox input[type="checkbox"] {
        margin-top: 3px;
        flex-shrink: 0;
    }

.declaration-text {
    font-size: 13px;
    color: #856404;
    line-height: 1.4;
}

/* Same address checkbox */
.same-address-section {
    background: #e8f4f8;
    border-radius: 8px;
    padding: 12px;
    margin: 15px 0;
    text-align: center;
}

/* Button container for mobile */
.button-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

/* Media Queries - STARTING WITH MOBILE FIRST */

/* Small phones (up to 375px) */
@media (max-width: 375px) {
    #heading {
        font-size: 1.2rem;
    }

    .fs-title {
        font-size: 1.1rem;
    }

    #msform fieldset {
        padding: 10px;
    }

    .form-card {
        padding: 10px;
    }

    .image-upload-section {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

/* Tablets and larger phones (576px and up) */
@media (min-width: 576px) {
    #heading {
        font-size: 1.6rem;
    }

    .fs-title {
        font-size: 1.4rem;
    }

    .steps {
        font-size: 1rem;
        text-align: right;
    }

    #progressbar li {
        font-size: 13px;
        min-width: 80px;
    }

        #progressbar li:before {
            width: 35px;
            height: 35px;
            line-height: 33px;
        }

    .image-upload-section {
        grid-template-columns: repeat(2, 1fr);
    }

    .button-container {
        flex-direction: row;
        justify-content: space-between;
    }

    #msform .action-button,
    #msform .action-button-previous {
        width: 48%;
        margin: 10px 1%;
    }
}

/* Tablets (768px and up) */
@media (min-width: 768px) {
    #msform fieldset {
        padding: 25px;
    }

    .form-card {
        padding: 20px;
    }

    #progressbar li {
        font-size: 14px;
        min-width: 100px;
    }

        #progressbar li:before {
            width: 40px;
            height: 40px;
            line-height: 38px;
            font-size: 16px;
        }

    .image-upload-section {
        grid-template-columns: repeat(4, 1fr);
    }

    /* Two column layout for tablets */
    .tablet-two-column {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }
}

/* Desktop (992px and up) */
@media (min-width: 992px) {
    #heading {
        font-size: 1.8rem;
    }

    .fs-title {
        font-size: 1.5rem;
    }

    #msform .action-button,
    #msform .action-button-previous {
        max-width: 200px;
    }
}

/* Large desktop (1200px and up) */
@media (min-width: 1200px) {
    .container-fluid {
        max-width: 1140px;
        margin: 0 auto;
    }
}

/* Special mobile fixes */
@media (max-width: 767px) {
    /* Stack all columns */
    .row {
        display: block;
    }

        .row > [class*="col-"] {
            width: 100% !important;
            margin-bottom: 15px;
        }

    /* Make dropdowns full width */
    select {
        width: 100% !important;
    }

    /* Adjust textareas */
    textarea {
        min-height: 100px !important;
    }

    /* Better file input styling */
    input[type="file"] {
        font-size: 14px;
    }

    /* Hide some non-essential elements on mobile */
    .desktop-only {
        display: none;
    }
}

/* Touch device improvements */
@media (hover: none) and (pointer: coarse) {
    /* Better touch targets */
    #msform input,
    #msform select,
    #msform textarea {
        min-height: 44px; /* Apple's recommended minimum */
    }

    #msform .action-button,
    #msform .action-button-previous {
        min-height: 44px;
    }

    /* Larger checkboxes/radios for touch */
    input[type="radio"],
    input[type="checkbox"] {
        transform: scale(1.3);
        margin-right: 12px;
    }
}

/* Print styles */
@media print {
    .action-button,
    .action-button-previous,
    #progressbar {
        display: none !important;
    }

    #msform fieldset {
        display: block !important;
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
}

/* Utility classes for mobile */
.mobile-hidden {
    display: none;
}

.mobile-visible {
    display: block;
}

@media (min-width: 768px) {
    .mobile-hidden {
        display: block;
    }

    .mobile-visible {
        display: none;
    }
}

/* Fix for iOS Safari */
@supports (-webkit-touch-callout: none) {
    #msform input,
    #msform select,
    #msform textarea {
        font-size: 16px; /* Prevents zoom */
    }
}
