/* ====================================================================
   FORM STYLE - Card-based sections (teal theme matching medical form)
   ==================================================================== */

/* Each section = its own card */
.frm-section {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid #e9ecef;
    margin-bottom: 24px;
    overflow: hidden;
}
.frm-section-header {
    padding: 20px 24px;
    border-bottom: 2px solid rgba(6, 195, 200, 0.08);
}
.frm-section-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}
.frm-section-header h3::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 20px;
    background: #06c3c8;
    border-radius: 2px;
    flex-shrink: 0;
}
.frm-section-header p {
    margin: 5px 0 0 14px;
    font-size: 13px;
    color: #666;
}
.frm-section-body {
    padding: 24px;
}
.frm-field-wrapper {
    margin-bottom: 18px;
}
/* Group wrapper — visual container for grouped fields */
.frm-group-wrapper {
    margin-bottom: 18px;
}
.frm-group-header {
    font-weight: 600;
    font-size: 14px;
    color: #555;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e9ecef;
}
.frm-label {
    display: block;
    font-weight: 600;
    font-size: 15px;
    color: #333;
    margin-bottom: 6px;
}
.frm-label-block { display: block; margin-bottom: 8px; }
.frm-req { color: #c0392b; font-weight: 700; margin-right: 2px; }
.frm-input {
    display: block;
    width: 100%;
    padding: 10px 14px;
    font-size: 15px;
    font-family: inherit;
    color: #333;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
.frm-input:focus {
    border-color: #06c3c8;
    box-shadow: 0 0 0 3px rgba(6, 195, 200, 0.12);
}
.frm-input::placeholder { color: #999; }
.frm-input.is-invalid {
    border-color: #c0392b;
    box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.08);
}
.frm-textarea { resize: vertical; min-height: 100px; }
.frm-select { cursor: pointer; }
.frm-radio-group, .frm-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}
.frm-radio-item, .frm-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: 2px solid #ddd;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    color: #333;
    background: #fff;
}
.frm-radio-item:hover, .frm-checkbox-item:hover {
    border-color: #06c3c8;
}
.frm-radio-item input[type="radio"],
.frm-checkbox-item input[type="checkbox"] { display: none; }
.frm-radio-item:has(input:checked),
.frm-checkbox-item:has(input:checked) {
    background: #e5fdff;
    border-color: #2ccfd8;
}
.frm-radio-dot {
    width: 18px; height: 18px; border-radius: 50%; border: 2px solid #ccc;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all 0.2s;
}
.frm-radio-dot::after {
    content: ''; width: 8px; height: 8px; background: #fff; border-radius: 50%; opacity: 0; transition: opacity 0.2s;
}
.frm-radio-item input:checked + .frm-radio-dot {
    border-color: #06c3c8; background: #06c3c8;
}
.frm-radio-item input:checked + .frm-radio-dot::after { opacity: 1; }
.frm-check-box {
    width: 18px; height: 18px; border-radius: 4px; border: 2px solid #ccc;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all 0.2s;
}
.frm-checkbox-item input:checked + .frm-check-box {
    background: #06c3c8; border-color: #06c3c8;
}
.frm-checkbox-item input:checked + .frm-check-box::after {
    content: '\f00c'; font-family: 'Font Awesome 5 Free'; font-weight: 900; font-size: 10px; color: #fff;
}
.frm-radio-card {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 16px 24px; border: 2px solid #ddd; border-radius: 17px;
    cursor: pointer; transition: all 0.2s; text-align: center; background: #fff; min-width: 160px; flex: 1; max-width: 220px;
}
.frm-radio-card:hover { border-color: #06c3c8; transform: translateY(-2px); }
.frm-radio-card input[type="radio"], .frm-radio-card input[type="checkbox"] { display: none; }
.frm-radio-card:has(input:checked) {
    background: #e5fdff; border-color: #2ccfd8; box-shadow: 0 4px 12px rgba(6, 195, 200, 0.15);
}
.frm-radio-card img { max-width: 100%; max-height: 80px; object-fit: contain; border-radius: 8px; }
.frm-radio-card span { font-size: 14px; font-weight: 600; color: #333; }
/* Toggle card — single button: check icon hidden by default, shown when active */
.frm-toggle-card { position: relative; }
.frm-toggle-check { display: none; position: absolute; top: 8px; left: 8px; color: #2ccfd8; font-size: 18px; }
.frm-toggle-card:has(input:checked) .frm-toggle-check { display: block; }
.frm-file-upload { position: relative; }
.frm-file-dropzone {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
    padding: 28px 20px; border: 2px dashed #84d0d9; border-radius: 10px; background: #fafeff;
    cursor: pointer; transition: all 0.2s; text-align: center; position: relative;
}
.frm-file-dropzone:hover { border-color: #06c3c8; background: #e5fdff; }
.frm-file-dropzone i { font-size: 32px; color: #84d0d9; }
.frm-file-text { font-size: 14px; font-weight: 600; color: #333; }
.frm-file-hint { font-size: 12px; color: #999; }
.frm-file-input { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.frm-file-name { margin-top: 8px; font-size: 13px; color: #06c3c8; font-weight: 600; }
.frm-repeater { margin-top: 5px; }
.frm-repeater-group {
    background: #f8fafb; border: 1px solid #e0eef1; border-radius: 10px;
    padding: 18px; margin-bottom: 14px; position: relative;
}
.frm-btn-remove-group {
    background: none; border: none; color: #c0392b; font-size: 13px; cursor: pointer;
    padding: 0; position: absolute; top: 12px; left: 12px; font-weight: 600; transition: color 0.2s;
}
.frm-btn-remove-group:hover { color: #e74c3c; }
.frm-btn-add-group {
    background: none; border: none; color: #06c3c8; font-size: 14px; font-weight: 700;
    cursor: pointer; padding: 8px 0; transition: color 0.2s; display: inline-flex; align-items: center; gap: 6px;
}
.frm-btn-add-group:hover { color: #0aa; }
.frm-field-desc { font-size: 12px; color: #999; margin-top: 5px; }
.frm-error-msg {
    display: none; font-size: 12px; color: #c0392b; margin-top: 4px;
    background: #ffe4e4; padding: 4px 10px; border-radius: 4px;
}
.frm-field-wrapper.has-error .frm-error-msg { display: block; }
.frm-field-wrapper.has-error .frm-input { border-color: #c0392b; }
.frm-divider { border: 0; border-top: 1px solid #e9ecef; margin: 20px 0; }

/* Submit & Draft Buttons */
.frm-submit-wrapper {
    text-align: center; padding: 30px 0 10px;
    display: flex; justify-content: center; align-items: center; gap: 16px; flex-wrap: wrap;
}
.frm-submit-btn {
    display: inline-flex; align-items: center; gap: 10px;
    background: #ffb606; color: #000; border: none; padding: 14px 50px;
    font-size: 18px; font-weight: 700; border-radius: 8px; cursor: pointer;
    transition: all 0.3s; letter-spacing: 0.5px; font-family: inherit;
}
.frm-submit-btn:hover {
    background: #06c3c8; color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(6, 195, 200, 0.3);
}
.frm-submit-btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }
.frm-draft-btn {
    display: inline-flex; align-items: center; gap: 8px;
    background: #fff; color: #06c3c8; border: 2px solid #06c3c8; padding: 12px 30px;
    font-size: 16px; font-weight: 600; border-radius: 8px; cursor: pointer;
    transition: all 0.3s; font-family: inherit;
}
.frm-draft-btn:hover {
    background: #e5fdff;
    transform: translateY(-2px);
}
.frm-draft-btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

/* Success */
.frm-success-msg { text-align: center; padding: 60px 20px; }
.frm-success-msg .success-icon {
    width: 90px; height: 90px; border-radius: 50%; background: #e5fdff; color: #06c3c8;
    display: flex; align-items: center; justify-content: center; font-size: 42px; margin: 0 auto 20px;
}
.frm-success-msg h3 { font-size: 22px; font-weight: 700; color: #333; margin-bottom: 10px; }
.frm-success-msg p { color: #666; font-size: 15px; }
/* Info Box */
.frm-info-box {
    background-color: #d7f1f1;
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 15px;
}
.frm-info-box p {
    margin: 0 0 4px;
    font-size: 14px;
    color: #333;
    line-height: 1.8;
}
.frm-info-box p:last-child { margin-bottom: 0; }
/* Google Drive Upload */
.gdrive-progress { margin-top: 10px; }
#gdrive-dropzone.uploading { pointer-events: none; opacity: 0.6; }
#gdrive-dropzone.success { border-color: #28a745; background: #e8f5e9; }
#gdrive-dropzone.success i { color: #28a745; }
.field-hidden-by-condition { display: none !important; }

/* Grid layout — force flex on .row inside form sections & repeaters */
.frm-section-body > .row,
.frm-repeater-group > .row {
    display: flex !important;
    flex-wrap: wrap !important;
}
.frm-section-body > .row > [class*="col-"],
.frm-repeater-group > .row > [class*="col-"] {
    flex-shrink: 0;
    padding-right: 0.75rem;
    padding-left: 0.75rem;
}
@media (min-width: 768px) {
    .frm-repeater-group > .row > .col-md-3,
    .frm-section-body > .row > .col-md-3 { width: 25% !important; }
    .frm-repeater-group > .row > .col-md-4,
    .frm-section-body > .row > .col-md-4 { width: 33.333333% !important; }
    .frm-repeater-group > .row > .col-md-6,
    .frm-section-body > .row > .col-md-6 { width: 50% !important; }
    .frm-repeater-group > .row > .col-md-9,
    .frm-section-body > .row > .col-md-9 { width: 75% !important; }
}

/* Breadcrumb */
.frm-breadcrumb {
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    padding: 14px 0;
    font-size: 14px;
}
.frm-breadcrumb nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
}
.frm-breadcrumb a {
    color: #6c757d;
    text-decoration: none;
    transition: color 0.2s;
}
.frm-breadcrumb a:hover {
    color: #06c3c8;
}
.frm-breadcrumb .separator {
    margin: 0 8px;
    color: #ced4da;
    font-size: 11px;
}
.frm-breadcrumb .current {
    color: #06c3c8;
    font-weight: 500;
}

@media (max-width: 767.98px) {
    .frm-section-body { padding: 16px; }
    .frm-section-header { padding: 16px; }
    .frm-section-header h3 { font-size: 15px; }
    .frm-radio-group, .frm-checkbox-group { flex-direction: column; }
    .frm-radio-card { min-width: auto; max-width: 100%; }
    .frm-submit-wrapper { flex-direction: column; }
    .frm-submit-btn { width: 100%; justify-content: center; padding: 14px 20px; font-size: 16px; }
    .frm-draft-btn { width: 100%; justify-content: center; padding: 12px 20px; }
}
