/* ===== Design Tokens ===== */
:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --primary-ring: rgba(37, 99, 235, 0.12);
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --text: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --input-bg: #f8fafc;
    --input-hover: #f1f5f9;
    --bg: #f1f5f9;
    --card: #ffffff;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 6px 24px rgba(0,0,0,0.05);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --transition: 0.15s ease;
}

/* ===== Base ===== */
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ===== Header ===== */
.reg-header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 0.65rem 0;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.header-badge {
    background: var(--primary);
    color: #fff;
    font-size: 0.55rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    letter-spacing: 0.08em;
    line-height: 1;
}

.header-contact {
    display: flex;
    align-items: center;
    gap: 0;
}

.header-divider {
    width: 1px;
    height: 28px;
    background: var(--border);
    margin: 0 1rem;
}

.header-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text);
    transition: all var(--transition);
}

.header-link:hover {
    color: var(--primary);
    text-decoration: none;
}

.header-link-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 0.8rem;
    flex-shrink: 0;
    transition: all var(--transition);
}

.header-link:hover .header-link-icon {
    background: var(--primary);
    color: #fff;
}

.header-link-text {
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.3;
}

.header-link-text small {
    display: block;
    font-size: 0.6rem;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0.02em;
}

/* ===== Select2 Override ===== */
.field-group .select2-container--default .select2-selection--single {
    background: var(--input-bg);
    border: 1.5px solid transparent;
    border-radius: var(--radius-sm);
    height: auto;
    padding: 0.35rem 0.5rem 0.35rem 32px;
    transition: all var(--transition);
}

.field-group .select2-container--default .select2-selection--single:hover {
    border-color: var(--border);
}

.field-group .select2-container--default.select2-container--open .select2-selection--single,
.field-group .select2-container--default.select2-container--focus .select2-selection--single {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
    outline: none;
}

.field-group .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--text);
    font-size: 0.82rem;
    padding: 0;
    line-height: 1.5;
}

.field-group .select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--text-muted);
}

.field-group .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 100%;
    right: 8px;
}

.select2-dropdown {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    font-size: 0.82rem;
}

.select2-search--dropdown .select2-search__field {
    border: 1.5px solid var(--border);
    border-radius: 6px;
    padding: 0.35rem 0.6rem;
    font-size: 0.82rem;
    outline: none;
}

.select2-search--dropdown .select2-search__field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-ring);
}

.select2-results__option--highlighted.select2-results__option--selectable {
    background: var(--primary);
}

/* ===== Mobile Header Toggle ===== */
.header-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.3rem 0.5rem;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition);
}

.header-toggle:hover {
    background: var(--input-bg);
}

.header-contact-mobile {
    display: none;
    padding: 0.75rem 0;
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
    flex-direction: column;
    gap: 0.5rem;
}

.header-contact-mobile.show {
    display: flex;
}

@media (max-width: 640px) {
    .header-contact {
        display: none;
    }

    .header-toggle {
        display: block;
    }
}

/* ===== Registration Card ===== */
.reg-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    max-width: 960px;
    margin: 0 auto;
    border-top: 3px solid var(--primary);
    animation: cardEntrance 0.4s ease;
}

@keyframes cardEntrance {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.reg-card-header {
    padding: 1.75rem 2rem 0;
    text-align: center;
}

.reg-card-header h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 0.25rem;
    letter-spacing: -0.01em;
}

.reg-card-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
    font-weight: 400;
}

.reg-card-body {
    padding: 1.5rem 2rem 2rem;
}

/* ===== Two-Column Form ===== */
.form-columns {
    display: flex;
    gap: 0;
}

.form-col {
    flex: 1;
    min-width: 0;
}

.form-col-left {
    padding-right: 1.75rem;
}

.form-col-right {
    padding-left: 1.75rem;
    border-left: 1px solid var(--border);
}

.col-header {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary);
    margin-bottom: 1.1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.col-header i {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* ===== Form Fields ===== */
.field-group {
    margin-bottom: 0.75rem;
}

.field-group label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
    display: block;
    letter-spacing: 0.01em;
}

.field-group label .required {
    color: var(--danger);
    margin-left: 1px;
}

.field-group .input-icon-wrap {
    position: relative;
}

.field-group .input-icon-wrap .field-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.8rem;
    pointer-events: none;
    z-index: 2;
    transition: color var(--transition);
}

.field-group .input-icon-wrap .form-control:focus ~ .field-icon,
.field-group .input-icon-wrap .form-select:focus ~ .field-icon {
    color: var(--primary);
}

/* Inputs — filled style */
.field-group .form-control,
.field-group .form-select {
    background: var(--input-bg);
    border: 1.5px solid transparent;
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    font-size: 0.82rem;
    color: var(--text);
    transition: all var(--transition);
    font-weight: 400;
}

.field-group .input-icon-wrap .form-control,
.field-group .input-icon-wrap .form-select {
    padding-left: 32px;
}

.field-group .form-control::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.field-group .form-control:hover,
.field-group .form-select:hover {
    border-color: var(--border);
}

.field-group .form-control:focus,
.field-group .form-select:focus {
    background: var(--card);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
    outline: none;
}

.field-group .form-control.is-invalid,
.field-group .form-select.is-invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.08);
}

.field-group .form-control.is-valid,
.field-group .form-select.is-valid {
    border-color: var(--success);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.08);
}

.valid-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: var(--success);
    font-size: 0.8rem;
    z-index: 2;
    pointer-events: none;
    animation: checkPop 0.2s ease;
}

@keyframes checkPop {
    0% { opacity: 0; transform: translateY(-50%) scale(0.5); }
    100% { opacity: 1; transform: translateY(-50%) scale(1); }
}

.field-group .form-text,
.field-group small {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
    display: block;
    line-height: 1.4;
}

.field-group .error-message {
    font-size: 0.68rem;
    color: var(--danger);
    margin-top: 0.15rem;
    font-weight: 500;
}

/* ===== Timezone Chip ===== */
.timezone-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary-light);
    border: 1px solid rgba(37, 99, 235, 0.15);
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.75rem;
    margin-bottom: 0.75rem;
    animation: chipSlideIn 0.25s ease;
}

.timezone-chip > i {
    color: var(--primary);
    font-size: 0.85rem;
    flex-shrink: 0;
}

.timezone-chip .timezone-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.timezone-chip .timezone-select {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0;
    font-size: 0.75rem;
    color: var(--text);
    font-weight: 600;
    pointer-events: none;
    outline: none;
    min-width: 0;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.timezone-chip .timezone-select.editable {
    pointer-events: auto;
    -webkit-appearance: auto;
    -moz-appearance: auto;
    appearance: auto;
    cursor: pointer;
    color: var(--primary);
}

.timezone-chip .timezone-change {
    font-size: 0.68rem;
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.timezone-chip .timezone-change:hover {
    text-decoration: underline;
}

.timezone-chip .timezone-change.hidden {
    display: none;
}

.timezone-chip .timezone-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-ring);
}

@keyframes chipSlideIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Password Strength ===== */
.password-strength {
    margin-top: 0.3rem;
}

.strength-bar-track {
    height: 3px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.strength-bar-fill {
    height: 100%;
    width: 0%;
    border-radius: 3px;
    transition: width 0.3s, background 0.3s;
}

.strength-bar-fill.weak { width: 25%; background: var(--danger); }
.strength-bar-fill.fair { width: 50%; background: var(--warning); }
.strength-bar-fill.good { width: 75%; background: #0ea5e9; }
.strength-bar-fill.strong { width: 100%; background: var(--success); }

.strength-text {
    font-size: 0.6rem;
    font-weight: 600;
    margin-top: 0.1rem;
    text-align: right;
}

.strength-text.weak { color: var(--danger); }
.strength-text.fair { color: var(--warning); }
.strength-text.good { color: #0ea5e9; }
.strength-text.strong { color: var(--success); }

/* ===== Password Toggle ===== */
.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    font-size: 0.85rem;
    z-index: 2;
    transition: color var(--transition);
}

.password-toggle:hover {
    color: var(--text-secondary);
}

/* ===== Submit Button ===== */
.btn-submit {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0.6rem 2rem;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    width: 100%;
    transition: all var(--transition);
    cursor: pointer;
    letter-spacing: 0.02em;
}

.btn-submit:hover:not(:disabled) {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
    transform: translateY(-1px);
}

.btn-submit:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: none;
}

.btn-submit:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-submit .spinner-border {
    width: 0.85rem;
    height: 0.85rem;
    border-width: 2px;
    vertical-align: middle;
    margin-right: 0.4rem;
}

/* ===== Security Badge ===== */
.security-note {
    text-align: center;
    margin-top: 0.6rem;
    font-size: 0.62rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
}

.security-note i {
    font-size: 0.7rem;
    color: var(--success);
}

/* ===== Progress Indicator ===== */
.progress-hint {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0.2rem 0.65rem;
    font-size: 0.62rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 0.6rem;
}

.progress-hint i {
    font-size: 0.65rem;
}

/* ===== Terms ===== */
.terms-wrap {
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.85rem;
}

.terms-wrap .form-check-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.terms-wrap .form-check-input {
    margin-top: 0.2rem;
    border-color: var(--border);
}

.terms-wrap .form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.terms-wrap a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.terms-wrap a:hover {
    text-decoration: underline;
}

/* ===== Footer ===== */
.reg-footer {
    padding: 2rem 0 1.5rem;
    text-align: center;
}

.reg-footer h5 {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.75rem;
}

.app-badges {
    margin-bottom: 1.25rem;
}

.app-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.9rem;
    color: var(--text);
    text-decoration: none;
    font-size: 0.75rem;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}

.app-badge:hover {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
    transform: translateY(-1px);
    text-decoration: none;
}

.app-badge i {
    font-size: 1.1rem;
}

.app-badge .badge-text small {
    display: block;
    font-size: 0.55rem;
    color: var(--text-muted);
    line-height: 1;
}

.app-badge .badge-text span {
    display: block;
    font-weight: 600;
    line-height: 1.2;
    font-size: 0.75rem;
}

.reg-footer .copyright {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ===== Loading Overlay ===== */
#ajax_loading_msg {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    z-index: 99999;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.loading-spinner .spinner-border {
    width: 2rem;
    height: 2rem;
    color: var(--primary);
    border-width: 2.5px;
}

.loading-spinner span {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ===== Responsive ===== */
@media (max-width: 820px) {
    .form-columns {
        flex-direction: column;
    }

    .form-col-left {
        padding-right: 0;
        padding-bottom: 1.25rem;
        margin-bottom: 1.25rem;
        border-bottom: 1px solid var(--border);
    }

    .form-col-right {
        padding-left: 0;
        border-left: none;
    }

    .reg-card-body {
        padding: 1.25rem;
    }

    .reg-card-header {
        padding: 1.25rem 1.25rem 0;
    }
}

@media (max-width: 576px) {
    .app-badges {
        flex-direction: column;
        align-items: center;
    }

    .reg-card-header h1 {
        font-size: 1.15rem;
    }
}
