/* Allied Mobile Imaging Form Styles */
.amif-form-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Open Sans', sans-serif;
    font-size: 14px;
    color: #333;
    background: #fff;
    border-radius: 8px;
}

/* Prevent horizontal scroll on all devices */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

/* Header Row */
.amif-header-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #eee;
}

.amif-logo {
    max-width: 200px;
    height: auto;
}

.amif-contact-info {
    text-align: right;
    color: #156388;
    font-weight: 600;
}

.amif-contact-info p {
    margin: 5px 0;
}

/* Two Column Layout */
.amif-two-columns {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    margin-bottom: 30px;
}

.amif-column {
    flex: 1;
    min-width: 250px;
}

.amif-column-title {
    background: #156388;
    color: #fff;
    padding: 10px 15px;
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 15px;
}

/* Form Fields */
.amif-field {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.amif-field label {
    width: 180px;
    font-weight: 600;
    font-size: 13px;
}

.amif-field input[type="text"],
.amif-field input[type="tel"],
.amif-field input[type="email"] {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Checkbox and Radio Groups */
.amif-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 15px 0;
}

.amif-checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

/* Insurance Section */
.amif-field {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    width: 100%;
}

.amif-field label {
    min-width: 220px;
    font-weight: 500;
    font-size: 0.95rem;
    font-family: 'Open Sans', sans-serif;
    color: #1B1B18;
    margin-right: 15px;
}

.amif-field input {
    flex: 1;
    padding: 10px 12px;
    font-size: 15px;
    font-family: 'Open Sans', sans-serif;
    color: #000;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.amif-field input:focus {
    border-color: #156388;
    box-shadow: 0 0 0 2px rgba(21, 99, 136, 0.1);
}

/* For longer labels */
.amif-field label[for="responsible-info"],
.amif-field label[for="exam-reason"],
.amif-field label[for="icd-code"] {
    min-width: 220px;
}

/* Radio buttons styling */
.amif-form-checkbox-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.amif-visually-hidden {
    position: absolute !important;
    clip: rect(1px 1px 1px 1px);
    clip: rect(1px, 1px, 1px, 1px);
    width: 1px !important;
    height: 1px !important;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
}

.amif-check-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: 'Open Sans', sans-serif;
}

.amif-check-label::before {
    content: "";
    border: 2px solid #5a5a5a;
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin-right: 8px;
    transition: background 250ms cubic-bezier(0.4, 0, 0.2, 1), border-color 250ms cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
}

.amif-custom-checkbox:checked + .amif-check-label::before {
    content: "\2714";
    border-color: #09587c;
    background: #09587c;
    color: white;
    font-size: 13px;
    font-weight: bold;
}

/* Column title */
.amif-column-title {
    background: #156388;
    color: #fff;
    width: 100%;
    text-transform: uppercase;
    font-weight: 600;
    text-align: center;
    font-size: 28px;
    padding: 0 4px;
    line-height: 1.3;
    margin-bottom: 10px;
}

/* ============================================
   PROCEDURES ORDERED SECTION - FIXED CHECKBOXES
   ============================================ */

.amif-procedures-container {
    margin-top: 20px;
    width: 100%;
}

.amif-procedures-grid {
    display: flex;
    width: 100%;
    border: 1px solid #000;
    background: #fff;
}

.amif-procedures-col {
    flex: 0 0 25%;
    border-left: 1px solid #000;
    border-right: 1px solid #000;
    background: #fff;
}

.amif-col-header {
    width: 100%;
    background: #41B1BD;
    color: #fff;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    border-bottom: 1px solid #000;
    padding: 8px 4px;
}

/* Procedure Row - Desktop - FIXED CHECKBOX VISIBILITY */
.amif-procedure-row {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border-bottom: 1px solid #eee;
    gap: 8px;
}

/* Make checkboxes visible and clickable */
.amif-procedure-row input[type="checkbox"] {
    display: inline-block !important;
    width: 16px !important;
    height: 16px !important;
    margin: 0 !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
    cursor: pointer !important;
    opacity: 1 !important;
    visibility: visible !important;
    position: relative !important;
    accent-color: #09587c;
}

.amif-procedure-label {
    flex: 2;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    color: #1B1B18;
    margin: 0;
    padding: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.amif-laterality {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.amif-laterality label {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.amif-laterality label input {
    width: 12px !important;
    height: 12px !important;
    margin: 0 !important;
    accent-color: #09587c;
}

.amif-procedure-code {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 700;
    color: #156388;
    min-width: 40px;
    text-align: right;
    white-space: nowrap;
}

.amif-empty-row {
    opacity: 0.3;
    pointer-events: none;
}

/* Other exam input */
.amif-other-exam-input {
    flex: 1;
    border: none;
    border-bottom: 1px solid #ddd;
    font-size: 11px;
    padding: 4px 0;
    background: transparent;
    outline: none;
}

/* ============================================
   TABLET: 2 columns
   ============================================ */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .amif-procedures-grid {
        flex-wrap: wrap;
    }
    
    .amif-procedures-col {
        flex: 0 0 50%;
        border-bottom: 1px solid #000;
    }
    
    .amif-procedures-col:nth-child(odd) {
        border-right: 1px solid #000;
    }
    
    .amif-procedures-col:nth-child(even) {
        border-right: none;
    }
    
    .amif-procedures-col:nth-last-child(-n+2) {
        border-bottom: none;
    }
}

/* ============================================
   MOBILE: 1 column - ALL CONTENT ON ONE LINE
   ============================================ */
@media screen and (max-width: 768px) {
    /* Prevent horizontal scroll */
    html, body {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .amif-form-container {
        overflow-x: hidden;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Stack columns vertically */
    .amif-procedures-grid {
        flex-direction: column;
        width: 100%;
    }
    
    .amif-procedures-col {
        flex: 0 0 100%;
        width: 100%;
        border-left: none;
        border-right: none;
        border-bottom: 1px solid #ddd;
    }
    
    /* Allow horizontal scroll only for the row content */
    .amif-procedure-row {
        overflow-x: auto;
        overflow-y: hidden;
        cursor: grab;
        scrollbar-width: thin;
    }
    
    .amif-procedure-row::-webkit-scrollbar {
        height: 4px;
    }
    
    .amif-procedure-row::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 2px;
    }
    
    .amif-procedure-row::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 2px;
    }
    
    /* Adjust font sizes for mobile */
    .amif-procedure-row input[type="checkbox"] {
        width: 18px !important;
        height: 18px !important;
    }
    
    .amif-procedure-label {
        font-size: 12px;
        white-space: nowrap;
    }
    
    .amif-laterality label {
        font-size: 11px;
    }
    
    .amif-laterality label input {
        width: 15px !important;
        height: 15px !important;
    }
    
    .amif-procedure-code {
        font-size: 10px;
    }
    
    /* Column headers */
    .amif-col-header {
        font-size: 14px;
        padding: 10px;
        position: sticky;
        top: 0;
        z-index: 10;
    }
}

/* ============================================
   SMALL MOBILE (max-width: 480px)
   ============================================ */
@media screen and (max-width: 480px) {
    .amif-procedure-label {
        font-size: 11px;
    }
    
    .amif-procedure-code {
        font-size: 9px;
        min-width: 35px;
    }
    
    .amif-laterality label {
        font-size: 10px;
    }
}

/* ============================================
   RESPONSIVE: Patient & Client sections
   ============================================ */
@media screen and (max-width: 767px) {
    .amif-two-columns {
        flex-direction: column;
        gap: 20px;
    }
    
    .amif-column {
        width: 100%;
    }
    
    .amif-column-title {
        font-size: 22px;
    }
    
    .amif-field {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .amif-field label {
        margin-bottom: 5px;
        min-width: auto;
        width: auto;
    }
    
    .amif-field input {
        width: 100%;
    }
    
    .amif-header-row {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .amif-order-info {
        margin: 10px 0;
        width: 100%;
    }
    
    .amif-contact-info {
        text-align: center;
    }
    
    .amif-checkbox-group {
        justify-content: center;
    }
    
    .amif-form-checkbox-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ============================================
   SUBMIT BUTTON & STATUS
   ============================================ */
.amif-submit-btn {
    cursor: pointer;
    box-sizing: border-box;
    font-size: 1.1em;
    padding: 12px 30px;
    background: #09587c;
    color: #ffffff;
    border: 1px solid #09587c;
    border-radius: 4px;
    font-weight: 600;
    transition: all 0.2s;
}

.amif-submit-btn:hover {
    background: white;
    color: #00577e;
    border: 1px solid #09587c;
}

.amif-status {
    display: inline-block;
    margin-left: 20px;
    font-weight: 500;
    font-size: 1rem;
}

.amif-status.success {
    color: #2c6e2c;
}

.amif-status.error {
    color: #d9534f;
}

/* Validation */
.amif-error-border {
    border-bottom: 2px solid #d32f2f !important;
}

.amif-error-message {
    color: #d32f2f;
    font-size: 12px;
    width: 100%;
    margin-top: 2px;
}

/* ============================================
   FILE ATTACHMENT STYLES
   ============================================ */

.amif-upload-area {
    width: 100%;
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 20px;
    background: #fafafa;
    transition: all 0.3s;
}

.amif-upload-area.drag-over {
    border-color: #156388;
    background: #f0f8ff;
}

.amif-upload-btn-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

/* Make Choose Files button match Send Order button exactly */
.amif-upload-btn {
    cursor: pointer;
    box-sizing: border-box;
    font-size: 1.1em;
    padding: 12px 30px;
    background: #09587c;
    color: #ffffff;
    border: 1px solid #09587c;
    border-radius: 4px;
    font-weight: 600;
    transition: all 0.2s;
    display: inline-block;
    text-align: center;
}

.amif-upload-btn:hover {
    background: white;
    color: #00577e;
    border: 1px solid #09587c;
}

.amif-upload-info {
    font-size: 12px;
    color: #666;
}

.amif-file-list {
    margin-top: 10px;
}

.amif-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 4px;
    margin-bottom: 8px;
}

.amif-file-item:last-child {
    margin-bottom: 0;
}

.amif-file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.amif-file-icon {
    font-size: 16px;
}

.amif-file-name {
    font-size: 13px;
    font-weight: 500;
    color: #333;
}

.amif-file-size {
    font-size: 11px;
    color: #999;
}

.amif-file-remove {
    background: none;
    border: none;
    color: #d9534f;
    cursor: pointer;
    font-size: 18px;
    padding: 5px 10px;
    transition: color 0.3s;
    border-radius: 4px;
}

.amif-file-remove:hover {
    color: #c9302c;
    background: #f9f9f9;
}

.amif-upload-progress {
    width: 100%;
    height: 2px;
    background: #eee;
    border-radius: 1px;
    overflow: hidden;
    margin-top: 10px;
}

.amif-upload-progress-bar {
    width: 0%;
    height: 100%;
    background: #156388;
    transition: width 0.3s;
}

/* Responsive */
@media screen and (max-width: 768px) {
    .amif-upload-area {
        padding: 15px;
    }
    
    .amif-upload-btn-wrapper {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .amif-file-item {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .amif-file-info {
        flex-wrap: wrap;
    }
}