/* ============================================================
   ios-alert.css
   E-Skripsi — Register & Auth Styles
   Mencakup: layout, form fields, komponen iOS, SweetAlert2
   ============================================================ */

/* ── CSS Variables ── */
:root {
    --ios-blue: #007AFF;
    --ios-blue-dark: #0063CC;
    --ios-bg: #F2F2F7;
    --ios-card: #FFFFFF;
    --ios-label: #3C3C43;
    --ios-secondary: #8E8E93;
    --ios-separator: #C6C6C8;
    --ios-fill: #E5E5EA;
    --ios-green: #34C759;
    --ios-red: #FF3B30;
    --ios-orange: #FF9500;
    --ios-shadow: 0 2px 20px rgba(0, 0, 0, 0.08), 0 1px 4px rgba(0, 0, 0, 0.04);
    --ios-shadow-deep: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* ── Reset ── */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ── Body ── */
body {
    font-family: -apple-system, 'SF Pro Display', BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--ios-bg);
    min-height: 100vh;
    padding: 20px 16px 40px;
}

/* ══════════════════════════════════════════════════════════
   HEADER
══════════════════════════════════════════════════════════ */
.page-header {
    text-align: center;
    padding: 24px 0 20px;
    margin-bottom: 4px;
}

.page-header .logo {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--ios-blue), #5AC8FA);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.3);
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #1C1C1E;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.page-header p {
    font-size: 14px;
    color: var(--ios-secondary);
    margin-top: 4px;
}

/* ══════════════════════════════════════════════════════════
   SEGMENTED CONTROL (Role Picker)
══════════════════════════════════════════════════════════ */
.seg-control {
    display: flex;
    background: var(--ios-fill);
    border-radius: 10px;
    padding: 2px;
    margin-bottom: 20px;
    gap: 2px;
}

.seg-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    background: transparent;
    font-size: 14px;
    font-weight: 500;
    color: var(--ios-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.seg-btn.active {
    background: #fff;
    color: var(--ios-blue);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12), 0 0 1px rgba(0, 0, 0, 0.04);
}

/* ══════════════════════════════════════════════════════════
   CARD
══════════════════════════════════════════════════════════ */
.ios-card {
    background: var(--ios-card);
    border-radius: 16px;
    box-shadow: var(--ios-shadow);
    overflow: hidden;
    margin-bottom: 12px;
}

.ios-card-header {
    padding: 14px 16px 10px;
    border-bottom: 0.5px solid var(--ios-separator);
}

.ios-card-header span {
    font-size: 12px;
    font-weight: 600;
    color: var(--ios-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ══════════════════════════════════════════════════════════
   FORM FIELDS (iOS grouped style)
══════════════════════════════════════════════════════════ */
.ios-field {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 0.5px solid var(--ios-separator);
    gap: 12px;
    position: relative;
}

.ios-field:last-child {
    border-bottom: none;
}

.ios-field-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}

.ios-field-icon.blue {
    background: rgba(0, 122, 255, 0.12);
    color: var(--ios-blue);
}

.ios-field-icon.green {
    background: rgba(52, 199, 89, 0.12);
    color: var(--ios-green);
}

.ios-field-icon.orange {
    background: rgba(255, 149, 0, 0.12);
    color: var(--ios-orange);
}

.ios-field-icon.purple {
    background: rgba(175, 82, 222, 0.12);
    color: #AF52DE;
}

.ios-field-icon.teal {
    background: rgba(90, 200, 250, 0.12);
    color: #5AC8FA;
}

.ios-field-icon.red {
    background: rgba(255, 59, 48, 0.12);
    color: var(--ios-red);
}

.ios-field-body {
    flex: 1;
    min-width: 0;
}

.ios-field-label {
    font-size: 12px;
    color: var(--ios-secondary);
    font-weight: 500;
    margin-bottom: 2px;
    display: block;
}

.ios-field-input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    font-size: 15px;
    font-family: inherit;
    color: #1C1C1E;
    padding: 0;
}

.ios-field-input::placeholder {
    color: #C7C7CC;
}

.ios-field-input:focus {
    outline: none;
}

select.ios-field-input {
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    padding-right: 20px;
}

.ios-field-chevron {
    color: var(--ios-separator);
    font-size: 13px;
    flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════
   PASSWORD TOGGLE & STRENGTH
══════════════════════════════════════════════════════════ */
.pass-toggle {
    background: none;
    border: none;
    padding: 4px;
    color: var(--ios-secondary);
    cursor: pointer;
    font-size: 16px;
    flex-shrink: 0;
}

.pass-strength {
    padding: 10px 16px 12px;
    display: none;
}

.strength-bars {
    display: flex;
    gap: 4px;
    margin-bottom: 4px;
}

.strength-bar {
    height: 3px;
    flex: 1;
    border-radius: 2px;
    background: var(--ios-fill);
    transition: background 0.3s;
}

.strength-bar.weak {
    background: var(--ios-red);
}

.strength-bar.medium {
    background: var(--ios-orange);
}

.strength-bar.strong {
    background: var(--ios-green);
}

.strength-label {
    font-size: 11px;
    color: var(--ios-secondary);
}

/* ══════════════════════════════════════════════════════════
   VALIDATION INDICATOR
══════════════════════════════════════════════════════════ */
.field-valid-icon {
    font-size: 16px;
    flex-shrink: 0;
    transition: all 0.2s;
}

.field-valid-icon.valid {
    color: var(--ios-green);
}

.field-valid-icon.invalid {
    color: var(--ios-red);
}

.field-valid-icon.empty {
    color: transparent;
}

.field-feedback {
    font-size: 11px;
    padding: 4px 16px 8px 60px;
    display: none;
    color: var(--ios-red);
}

.field-feedback.show {
    display: block;
}

.field-feedback.ok {
    color: var(--ios-green);
}

/* ══════════════════════════════════════════════════════════
   iOS TOGGLE (Checkbox)
══════════════════════════════════════════════════════════ */
.ios-toggle-row {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 12px;
}

.ios-toggle {
    position: relative;
    width: 51px;
    height: 31px;
    flex-shrink: 0;
}

.ios-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.ios-toggle-slider {
    position: absolute;
    inset: 0;
    background: #E5E5EA;
    border-radius: 34px;
    cursor: pointer;
    transition: background 0.2s;
}

.ios-toggle-slider:before {
    content: '';
    position: absolute;
    width: 27px;
    height: 27px;
    left: 2px;
    top: 2px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
}

.ios-toggle input:checked+.ios-toggle-slider {
    background: var(--ios-green);
}

.ios-toggle input:checked+.ios-toggle-slider:before {
    transform: translateX(20px);
}

.toggle-label {
    font-size: 14px;
    color: #1C1C1E;
}

.toggle-sub {
    font-size: 12px;
    color: var(--ios-secondary);
}

/* ══════════════════════════════════════════════════════════
   SUBMIT BUTTON
══════════════════════════════════════════════════════════ */
.btn-ios-primary {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--ios-blue), #0A84FF);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: -0.2px;
    margin-top: 8px;
}

.btn-ios-primary:active {
    transform: scale(0.98);
    opacity: 0.9;
}

.btn-ios-primary:disabled {
    background: var(--ios-fill);
    color: var(--ios-secondary);
    box-shadow: none;
    cursor: not-allowed;
}

/* ══════════════════════════════════════════════════════════
   LINK & DIVIDER
══════════════════════════════════════════════════════════ */
.ios-link {
    display: block;
    text-align: center;
    color: var(--ios-blue);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    padding: 16px 0 8px;
}

.ios-link:hover {
    opacity: 0.75;
}

.ios-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0 16px;
}

.ios-divider span {
    font-size: 13px;
    color: var(--ios-secondary);
    white-space: nowrap;
}

.ios-divider::before,
.ios-divider::after {
    content: '';
    flex: 1;
    height: 0.5px;
    background: var(--ios-separator);
}

/* ══════════════════════════════════════════════════════════
   GOOGLE BUTTON
══════════════════════════════════════════════════════════ */
.btn-ios-google {
    width: 100%;
    padding: 14px;
    border: 1.5px solid var(--ios-separator);
    border-radius: 14px;
    background: #fff;
    color: #1C1C1E;
    font-size: 15px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background 0.15s;
    text-decoration: none;
}

.btn-ios-google:hover {
    background: var(--ios-bg);
}

/* ══════════════════════════════════════════════════════════
   INLINE ALERT TOAST (validasi form)
══════════════════════════════════════════════════════════ */
.ios-alert {
    border-radius: 16px;
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    display: none;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.ios-alert.show {
    display: flex;
}

.ios-alert.error {
    background: rgba(255, 59, 48, 0.10);
    color: var(--ios-red);
}

.ios-alert.success {
    background: rgba(52, 199, 89, 0.10);
    color: var(--ios-green);
}

.ios-alert.info {
    background: rgba(0, 122, 255, 0.10);
    color: var(--ios-blue);
}

/* ══════════════════════════════════════════════════════════
   LOADING SPINNER
══════════════════════════════════════════════════════════ */
.ios-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ══════════════════════════════════════════════════════════
   UTILITY
══════════════════════════════════════════════════════════ */
.section-note {
    font-size: 12px;
    color: var(--ios-secondary);
    padding: 8px 16px 4px;
    line-height: 1.5;
}

.step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

.step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ios-fill);
    transition: all 0.3s;
}

.step-dot.active {
    background: var(--ios-blue);
    width: 24px;
    border-radius: 4px;
}

.form-wrap {
    max-width: 420px;
    margin: 0 auto;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-panel {
    animation: slideUp 0.35s ease forwards;
}

.form-panel.hidden {
    display: none;
}

/* ══════════════════════════════════════════════════════════
   SWEETALERT2 — iOS Alert Style
   Digunakan di: register (berhasil/gagal) & login
══════════════════════════════════════════════════════════ */

/* Backdrop blur */
.swal2-backdrop-show {
    background: rgba(0, 0, 0, 0.35) !important;
    backdrop-filter: blur(6px) !important;
    -webkit-backdrop-filter: blur(6px) !important;
}

/* Container popup */
.ios-alert-popup {
    width: 270px !important;
    border-radius: 14px !important;
    background: rgba(255, 255, 255, 0.96) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    padding: 20px 0 0 0 !important;
    font-family: -apple-system, system-ui, sans-serif !important;
    border: 0.5px solid rgba(0, 0, 0, 0.12) !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(0, 0, 0, 0.08) !important;
    animation: ios-pop 0.26s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    overflow: hidden !important;
}

@keyframes ios-pop {
    from {
        opacity: 0;
        transform: scale(0.78);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Judul */
.ios-alert-title {
    font-size: 17px !important;
    font-weight: 600 !important;
    color: #1C1C1E !important;
    margin-bottom: 4px !important;
    padding: 0 16px !important;
    letter-spacing: -0.3px !important;
    line-height: 1.3 !important;
}

/* Teks isi */
.ios-alert-text {
    font-size: 13px !important;
    font-weight: 400 !important;
    color: #3C3C43 !important;
    margin-bottom: 0 !important;
    padding: 0 16px 20px !important;
    line-height: 1.45 !important;
}

/* Container tombol */
.ios-alert-popup .swal2-actions {
    width: 100% !important;
    flex-direction: column !important;
    gap: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Garis pemisah sebelum tombol */
.ios-alert-popup .swal2-actions::before {
    content: '';
    display: block;
    width: 100%;
    height: 0.5px;
    background: rgba(60, 60, 67, 0.20);
}

/* Tombol BIRU — login berhasil / OK */
.ios-alert-button,
.ios-alert-btn-primary {
    background: transparent !important;
    color: #007AFF !important;
    font-size: 17px !important;
    font-weight: 600 !important;
    width: 100% !important;
    border: none !important;
    border-top: 0.5px solid rgba(60, 60, 67, 0.15) !important;
    border-radius: 0 !important;
    padding: 13px 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    letter-spacing: -0.1px !important;
    transition: background 0.12s ease !important;
}

.ios-alert-button:hover,
.ios-alert-btn-primary:hover {
    background: rgba(0, 122, 255, 0.06) !important;
}

.ios-alert-button:active,
.ios-alert-btn-primary:active {
    background: rgba(60, 60, 67, 0.10) !important;
}

/* Tombol HIJAU — registrasi berhasil */
.ios-alert-btn-success {
    background: transparent !important;
    color: #34C759 !important;
    font-size: 17px !important;
    font-weight: 600 !important;
    width: 100% !important;
    border: none !important;
    border-top: 0.5px solid rgba(60, 60, 67, 0.15) !important;
    border-radius: 0 !important;
    padding: 13px 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    letter-spacing: -0.1px !important;
    transition: background 0.12s ease !important;
}

.ios-alert-btn-success:hover {
    background: rgba(52, 199, 89, 0.06) !important;
}

.ios-alert-btn-success:active {
    background: rgba(60, 60, 67, 0.10) !important;
}

/* Tombol MERAH — error / gagal */
.ios-alert-btn-danger {
    background: transparent !important;
    color: #FF3B30 !important;
    font-size: 17px !important;
    font-weight: 400 !important;
    width: 100% !important;
    border: none !important;
    border-top: 0.5px solid rgba(60, 60, 67, 0.15) !important;
    border-radius: 0 !important;
    padding: 13px 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    transition: background 0.12s ease !important;
}

.ios-alert-btn-danger:hover {
    background: rgba(255, 59, 48, 0.06) !important;
}

.ios-alert-btn-danger:active {
    background: rgba(60, 60, 67, 0.10) !important;
}

/* Sembunyikan elemen default SweetAlert */
.swal2-icon,
.ios-alert-popup .swal2-close {
    display: none !important;
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
    body {
        padding: 16px 12px 32px;
    }

    .page-header h1 {
        font-size: 24px;
    }

    .btn-ios-primary {
        padding: 14px;
        font-size: 15px;
    }

    .ios-alert-popup {
        width: 260px !important;
    }
}