:root {
    --primary:      #2196b6;
    --primary-dark: #1a7a96;
    --primary-light:#e8f5fa;
    --text-dark:    #2d3748;
    --text-muted:   #718096;
    --border:       #d1e8f0;
    --bg-page:      #f0f6f9;
    --white:        #ffffff;
    --red:          #e53e3e;
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
}

body {
    font-family: 'Open Sans', sans-serif;
    background: url('../images/bg-register.png');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    background-color: var(--bg-page);
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── CONTAINER & CARD ── */
main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem !important;
}

.register-wrapper {
    width: 100%;
    max-width: 700px; /* Menyesuaikan lebar maksimal register-card Anda */
    display: block;
    margin: 0 auto;
}

.register-header-outside {
    text-align: center;
    margin-bottom: 2rem; /* Jarak antara title luar dengan card register */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Style Logo SAMA */
.brand-outside {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 1.2rem;
}

.brand-name-outside {
    font-family: 'Raleway', sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    color: #2d3748; /* Menyesuaikan var(--text-dark) */
    letter-spacing: -0.5px;
}

/* Style Title Utama di Luar Card */
.main-title-outside {
    font-family: 'Raleway', sans-serif;
    font-size: 1.85rem;
    font-weight: 800;
    color: #111827;
    line-height: 1.3;
    max-width: 480px; /* Membatasi lebar agar teks turun rapi di tengah jika panjang */
    margin: 0 auto;
}

/* Responsive adjustment untuk layar hp */
@media (max-width: 520px) {
    .main-title-outside {
        font-size: 1.45rem;
        padding: 0 10px;
    }
    .register-header-outside {
        margin-bottom: 1.5rem;
    }
}

.register-card {
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 4px 32px rgba(33,150,182,.12);
    padding: 2.5rem;
    width: 100%;
    max-width: 850px;
    animation: fadeUp 0.45s ease both;
}

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

/* ── SECTIONS ── */
.card-heading {
    font-family: 'Raleway', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    text-align: center;
    margin-bottom: 2rem;
}

/* Avatar Container */
.avatar-upload-container {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}
.avatar-wrapper {
    position: relative;
    width: 110px;
    height: 110px;
}
.avatar-preview {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: #fafcfd;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: var(--primary);
    font-size: 2rem;
    transition: all 0.2s ease;
}
.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}
.avatar-trigger {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    border: 2px solid var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: background 0.2s;
}
.avatar-trigger:hover {
    background: var(--primary-dark);
}
.avatar-clickable-area {
    cursor: pointer;
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
}

/* ── FORM ELEMENTS ── */
.form-label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: .35rem;
    display: flex;
    align-items: center;
    gap: .35rem;
}
.form-label-custom {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.4rem;
    display: block;
}
.required-star { 
    color: var(--red); 
    font-size: 0.85rem; 
}

.form-control, .form-select {
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 0.65rem 0.9rem;
    font-size: 0.88rem;
    color: var(--text-dark);
    background: #fafcfd;
    transition: border-color .2s, box-shadow .2s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(33,150,182,.12);
    background: var(--white);
    outline: none;
}

/* ── CUSTOM REUSABLE FILE UPLOAD COMPONENT ── */
.upload-row {
    flex-wrap: wrap; /* SANGAT PENTING: Agar error ditarik ke baris baru secara otomatis */
}
.dropzone-area {
    flex: 1;
    border: 1.5px solid #d1e8f0;
    border-radius: 12px;
    background-color: #fafcfd;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    color: #718096;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    user-select: none;
    display: flex;
    align-items: center;
    min-height: 48px;
}
.dropzone-area.has-file {
    border-style: solid;
    background: var(--white);
    color: var(--text-dark);
}
.dropzone-area:hover, .dropzone-area.dragover {
    background-color: #f0f9ff;
    border-color: #2196b6;
    color: #2196b6;
}
.btn-action-upload {
    height: 48px;
    width: 48px;
    border-radius: 8px;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-initial-upload {
    background: var(--primary);
    color: var(--white);
}
.btn-initial-upload:hover { background: var(--primary-dark); }

.btn-delete-file {
    background-color: #ff3b30;
    color: #ffffff;
}
.btn-delete-file:hover {
    background-color: #e0241b;
}

.btn-replace-file {
    background-color: #17a2b8;
    color: #ffffff;
}
.btn-replace-file:hover {
    background-color: #138496;
}

/* Penempatan Error Khusus di Atas Info Size */
.upload-row .invalid-feedback {
    flex: 0 0 100%;
    width: 100%;
    margin-top: 0.4rem;
    margin-bottom: 0.1rem;
    display: none;
}

.info-container {
    margin-top: 0.35rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.upload-size-text {
    font-size: 0.76rem;
    color: var(--text-muted);
    font-weight: 500;
    display: none;
}
.upload-size-text.text-danger {
    color: var(--red) !important;
}
.upload-limit-text {
    font-size: 0.78rem;
    font-weight: 500;
    color: #60a5fa; /* Info Batas Statis Biru Muda */
}

/* Mengatur Visibilitas State Tombol */
.upload-row .btn-delete-file,
.upload-row .btn-replace-file { display: none; }

.upload-row.has-file .btn-initial-upload { display: none; }
.upload-row.has-file .btn-delete-file,
.upload-row.has-file .btn-replace-file { display: inline-flex; }

/* JQuery Validation Error Rules */
.form-control.is-invalid, .form-select.is-invalid {
    border-color: var(--red) !important;
}
.invalid-feedback {
    font-size: 0.75rem;
    color: var(--red);
    margin-top: 0.3rem;
}

/* Radio inline customized layout */
.radio-container {
    display: flex;
    gap: 1.5rem;
    padding-top: 0.6rem;
}
.form-check-input {
    cursor: pointer;
}
.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}
.form-check-label {
    font-size: 0.88rem;
    color: var(--text-dark);
    cursor: pointer;
}

/* ── BUTTON FOOTER ROW ── */
.btn-row {
    display: flex;
    gap: 1rem;
    margin-top: 2.5rem;
    border-top: 1.5px solid #edf2f7;
    padding-top: 1.5rem;
}
.btn-back {
    flex: 1;
    background: #edf2f7;
    color: var(--text-dark);
    border: none;
    border-radius: 8px;
    padding: 0.75rem;
    font-family: 'Raleway', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-back:hover { background: #e2e8f0; }

.btn-next {
    flex: 1;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 8px;
    padding: 0.75rem;
    font-family: 'Raleway', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-next:hover { background: var(--primary-dark); }
.btn-next:active, .btn-back:active { transform: scale(0.99); }

@media (max-width: 768px) {
    .register-card { padding: 1.5rem; }
    .wizard-progress { margin-bottom: 2rem; }
}

.is-invalid-select2 {
    border-color: #e53e3e !important;
    box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.12) !important;
    background-color: #fffbfa !important;
}

.select2-container--bootstrap-5 .select2-selection {
    border: 1.5px solid var(--border, #d1e8f0);
    border-radius: 8px !important;
    min-height: 41px !important; /* Menyesuaikan dengan tinggi input teks kustom Anda */
    background-color: #fafcfd !important; /* Menyamakan warna background input */
    display: flex !important;
    align-items: center !important;
    transition: border-color .2s, box-shadow .2s;
}

/* ── 2. MENYESUAIKAN TEKS DI DALAM SELECT2 ── */
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    font-family: 'Open Sans', sans-serif;
    font-size: 0.88rem !important;
    color: var(--text-dark, #2d3748) !important;
    padding-left: 0.9rem !important; /* Menyamakan padding dalam input */
}

/* Menyesuaikan warna teks placeholder (Cara yang Benar) */
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered .select2-selection__placeholder {
    color: var(--text-muted, #718096) !important;
}

/* ── 3. MENYESUAIKAN IKON PANAH (ARROW) DROPDOWN ── */
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow {
    right: 0.6rem !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
}

/* ── 4. EFEK STATE FOCUS (SAAT DIKLIK) ── */
.select2-container--bootstrap-5.select2-container--focus .select2-selection {
    border-color: var(--primary, #2196b6) !important;
    box-shadow: 0 0 0 3px rgba(33, 150, 182, 0.12) !important;
    background-color: #ffffff !important; /* Berubah putih saat fokus seperti input lain */
}

.select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: var(--primary, #2196b6) !important;
    background-color: #ffffff !important;
}

/* ── 5. PENYELARASAN DROPDOWN LIST DAN SEARCH BOX ── */
.select2-container--bootstrap-5 .select2-dropdown {
    border: 1.5px solid var(--primary, #2196b6) !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05) !important;
    overflow: hidden;
}

.select2-container--bootstrap-5 .select2-dropdown .select2-search .select2-search__field {
    border: 1.5px solid var(--border, #d1e8f0) !important;
    border-radius: 6px !important;
    font-size: 0.85rem !important;
}

.select2-container--bootstrap-5 .select2-dropdown .select2-search .select2-search__field:focus {
    border-color: var(--primary, #2196b6) !important;
    box-shadow: none !important;
}

/* Menyesuaikan list item di dalam dropdown */
.select2-container--bootstrap-5 .select2-results__option {
    font-size: 0.88rem !important;
    padding: 0.6rem 0.9rem !important;
}

/* Warna saat item dropdown disorot (hover) */
.select2-container--bootstrap-5 .select2-results__option--highlighted[aria-selected] {
    background-color: var(--primary, #2196b6) !important;
    color: #ffffff !important;
}

.phone-group {
    display: flex;
    gap: .5rem;
}
.country-code-btn {
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 8px;
    padding: .62rem .9rem;
    font-size: .88rem;
    font-weight: 600;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: .35rem;
    cursor: pointer;
    min-width: 82px;
    position: relative;
    transition: background .2s;
}
.country-code-btn:hover { background: var(--primary-dark); }
.country-code-btn .caret {
    font-size: .65rem;
    margin-left: .1rem;
}
.phone-group .form-control { flex: 1; }

.phone-group {
    display: flex;
    gap: .5rem;
}
.country-code-btn {
    background: #17a2b8; /* Sesuaikan warna var(--primary) Anda */
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: .62rem .9rem;
    font-size: .88rem;
    font-weight: 600;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: .35rem;
    cursor: pointer;
    min-width: 82px;
    height: 100%;
    transition: background .2s;
}
.country-code-btn:hover { background: #138496; }
.country-code-btn .caret {
    font-size: .65rem;
    margin-left: .1rem;
}
.phone-group .form-control { flex: 1; }

/* --- CSS KUNCI PERBAIKAN DROPDOWN --- */
.cc-dropdown-menu {
    display: none; /* Sembunyikan default */
    position: absolute;
    top: 105%;
    left: 0;
    z-index: 1050; /* Angka tinggi agar berada di atas input lain */
    min-width: 280px;
    background-color: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 0.5rem;
}
.cc-dropdown-menu.show {
    display: block; /* Muncul saat tombol diklik */
}
.cc-search-wrapper {
    margin-bottom: 0.5rem;
}
.cc-search-input {
    width: 100%;
    padding: 0.4rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    outline: none;
}
.cc-search-input:focus {
    border-color: #17a2b8;
}
/* Membatasi tinggi daftar negara dan memunculkan scrollbar */
.cc-options-list {
    max-height: 220px;
    overflow-y: auto; 
}
.cc-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s;
}
.cc-option:hover {
    background: var(--primary-light); color: var(--primary);
}
.cc-option.selected {
    color: var(--primary); font-weight: 600; background: var(--primary-light);
}
.cc-flag { font-size: 1rem; flex-shrink: 0; }
.cc-name {flex: 1;}
.cc-code { color: var(--text-muted); font-size: .78rem; }
.cc-option.selected .cc-code { color: var(--primary); }
.cc-empty {
    padding: 0.5rem;
    font-size: 0.875rem;
    color: #94a3b8;
    text-align: center;
}

/* Bootstrap input-group fix untuk icon $ di depan input angka */
.input-group {
    display: flex;
    align-items: stretch;
    width: 100%;
}
.input-group-text {
    display: flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    border-top-left-radius: 8px !important;
    border-bottom-left-radius: 8px !important;
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}
.input-group .form-control {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    flex: 1 1 auto;
}

/* Kustomisasi tambahan dropzone-area saat file valid terpilih */
.dropzone-area.file-valid {
    border: 1.5px solid #28a745;
    background-color: #f8fff9;
    color: #155724;
}

.divider-container {
    display: flex;
    align-items: center;
    text-align: center;
    color: #006db0;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin: 1rem 0;
}
.divider-container::before,
.divider-container::after {
    content: '';
    flex: 1;
    border-bottom: 1px dashed #006db0; /* Garis Putus-putus */
}
.divider-container:not(:empty)::before { margin-right: 1rem; }
.divider-container:not(:empty)::after { margin-left: 1rem; }

/* Container Utama untuk Input Checkbox Tersembunyi */
.form-switch-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
    margin-bottom: 0;
    vertical-align: middle;
}

/* Sembunyikan Checkbox Default */
.form-switch-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* Background Sakelar (Kondisi Mati / Off) */
.slider-switch {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .3s;
    border-radius: 22px; /* Membuat bentuk kapsul bulat penuh */
}

/* Bulatan Putih di Dalam Sakelar */
.slider-switch:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

/* Warna Sakelar saat Kondisi Aktif (On) -> Menggunakan Warna Biru Sesuai Gambar */
.form-switch-toggle input:checked + .slider-switch {
    background-color: var(--primary); /* Warna biru sesuai gambar Anda */
}

/* Posisi Bulatan Geser saat Kondisi Aktif (On) */
.form-switch-toggle input:checked + .slider-switch:before {
    transform: translateX(22px);
}

/* Gaya Teks di Samping Sakelar */
.switch-label-text {
    font-size: 0.82rem;
    font-weight: 600; /* Semi-bold sesuai gambar */
    color: var(--text-dark);
    user-select: none; /* Mencegah teks ter-highlight saat tidak sengaja ter-double klik */
}

.year-picker-only .flatpickr-days,
.year-picker-only .flatpickr-weekdays {
    display: none !important;
}
/* Sesuaikan lebar container agar pas dan ringkas untuk tahun saja */
.year-picker-only {
    width: 180px !important;
}
.year-picker-only .flatpickr-months .flatpickr-month {
    height: 40px;
}
.year-picker-only .flatpickr-current-month .flatpickr-monthDropdown-months {
    display: none !important; /* Sembunyikan dropdown bulan */
}
.text-justify {
  text-align: justify !important;
}
.text-muted {
    color: var(--text-muted);
}
.custom-calendar-icon {
    transition: right 0.2s ease;
}
.form-control.is-invalid ~ .custom-calendar-icon,
.form-control.error ~ .custom-calendar-icon {
    right: 25px !important; /* Menggeser ke kiri memberikan ruang bagi tanda seru */
}

.repeater-section {
    margin-top: 20px;
    margin-bottom: 20px;
    padding: 15px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    background-color: #f8fafc;
}

.repeater-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
}

.repeater-header h5 {
    margin: 0;
    color: #1e293b;
    font-weight: 600;
}

/* Tombol Aksi */
.btn-add-repeater {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.btn-add-repeater:hover {
    background-color: #138496;
}

.btn-remove-repeater {
    background-color: #ef4444;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.btn-remove-repeater:hover {
    background-color: #dc2626;
}

/* Styling per Item Kotak Anggota Keluarga */
.repeater-item {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    margin-bottom: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.repeater-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background-color: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
    font-weight: bold;
    font-size: 13px;
    color: #475569;
}

.repeater-item-body {
    padding: 15px;
    display: grid;
    gap: 15px;
}

.form-group-sub {
    display: flex;
    flex-direction: column;
}

.form-group-sub label {
    font-size: 13px;
    margin-bottom: 5px;
    color: #334155;
    font-weight: 500;
}

.form-group-sub input[type="text"],
.form-group-sub input[type="file"] {
    padding: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 14px;
}

/* Responsif untuk layar HP (menjadi 1 kolom) */
@media (max-width: 768px) {
    .repeater-item-body {
        grid-template-columns: 1fr;
    }
}

.btn-check-media-id {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 0.55rem 0.9rem;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}
.btn-check-media-id:hover {
    background-color: var(--primary-dark);
    color: white;
}