/* ===================================
   Reusable Components
=================================== */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Inter:wght@400;500;600&display=swap');

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; max-width: 100%; }
body {
    font-family: var(--font-body);
    background-color: var(--white);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    max-width: 100%;
    -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

/* Prevent any element from causing horizontal scroll */
.container, section, header, footer, main, nav, aside { max-width: 100%; }

.container {
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.4rem;
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition-base);
    white-space: nowrap;
    line-height: 1.4;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; }

.btn-primary {
    background: var(--purple);
    color: var(--white);
    box-shadow: 0 2px 12px rgba(140,60,220,0.25);
}
.btn-primary:hover:not(:disabled) {
    background: var(--purple-dark);
    box-shadow: var(--shadow-purple);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1.5px solid var(--border);
}
.btn-ghost:hover:not(:disabled) {
    border-color: var(--purple);
    color: var(--purple);
}

.btn-outline {
    background: transparent;
    color: var(--purple);
    border: 1.5px solid var(--purple);
}
.btn-outline:hover:not(:disabled) {
    background: var(--purple);
    color: var(--white);
}

.btn-danger {
    background: var(--error);
    color: var(--white);
}
.btn-danger:hover:not(:disabled) {
    background: #b91c1c;
    transform: translateY(-1px);
}

.btn-sm { padding: 0.5rem 1rem; font-size: 0.82rem; }
.btn-lg { padding: 0.85rem 2rem; font-size: 1rem; }
.btn-full { width: 100%; }

.btn .spinner {
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Forms --- */
.form-group { margin-bottom: 1.1rem; }

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 1rem; /* min 16px — prevents iOS keyboard zoom */
    color: var(--text-primary);
    background: var(--white);
    transition: var(--transition-fast);
    outline: none;
    appearance: none;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgba(140,60,220,0.1);
}
.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-muted); }
.form-input.error,
.form-select.error,
.form-textarea.error {
    border-color: var(--error);
    box-shadow: 0 0 0 3px rgba(220,38,38,0.08);
}
.form-textarea { resize: vertical; min-height: 110px; }

.form-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.3rem; }
.form-error { font-size: 0.78rem; color: var(--error); margin-top: 0.3rem; display: none; }
.form-error.visible { display: block; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* Password wrapper */
.password-wrapper { position: relative; }
.password-wrapper .form-input { padding-right: 3rem; }
.password-toggle {
    position: absolute;
    right: 0.9rem; top: 50%;
    transform: translateY(-50%);
    background: none; border: none;
    cursor: pointer;
    color: var(--text-muted);
    display: flex; align-items: center;
    transition: var(--transition-fast);
}
.password-toggle:hover { color: var(--purple); }

/* Checkbox */
.form-check { display: flex; align-items: flex-start; gap: 0.65rem; cursor: pointer; }
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 18px; height: 18px;
    accent-color: var(--purple);
    cursor: pointer;
    margin-top: 2px;
    flex-shrink: 0;
}
.form-check-label { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.5; }
.form-check-label a { color: var(--purple); font-weight: 600; }
.form-check-label a:hover { text-decoration: underline; }

/* Divider */
.divider {
    display: flex; align-items: center; gap: 1rem;
    margin: 1.25rem 0;
    color: var(--text-muted);
    font-size: 0.82rem;
}
.divider::before, .divider::after {
    content: ''; flex: 1;
    height: 1px; background: var(--border);
}

/* Social button */
.social-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--white);
    font-family: var(--font-body);
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 0.75rem;
    transition: var(--transition-base);
}
.social-btn:hover {
    border-color: var(--gray-400);
    box-shadow: var(--shadow-xs);
}

/* Alert */
.alert {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    display: none;
    align-items: flex-start;
    gap: 0.65rem;
    margin-bottom: 1rem;
    animation: slideDown 0.25s ease;
}
.alert.visible { display: flex; }
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid #bbf7d0; }
.alert-error { background: var(--error-light); color: var(--error); border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-light); color: var(--warning); border: 1px solid #fde68a; }
.alert-info { background: var(--info-light); color: var(--info); border: 1px solid #bae6fd; }
.alert-icon { flex-shrink: 0; }
.alert-message { flex: 1; line-height: 1.5; }

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Toast */
.toast-container {
    position: fixed;
    top: 1.25rem; right: 1.25rem;
    z-index: 10000;
    display: flex; flex-direction: column; gap: 0.6rem;
}
.toast {
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    background: var(--white);
    box-shadow: var(--shadow-lg);
    display: flex; align-items: center; gap: 0.65rem;
    min-width: 280px; max-width: 400px;
    animation: toastIn 0.35s ease;
    border-left: 3px solid var(--purple);
    font-size: 0.88rem;
}
.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error { border-left-color: var(--error); }
.toast.toast-warning { border-left-color: var(--warning); }
.toast.removing { animation: toastOut 0.25s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(100%); } }
.toast-close {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); font-size: 1.1rem;
    padding: 0.2rem; margin-left: auto;
    transition: var(--transition-fast);
}
.toast-close:hover { color: var(--text-primary); }

/* Badge */
.badge {
    display: inline-flex; align-items: center;
    padding: 0.2rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 0.72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.04em;
}
.badge-primary { background: var(--purple-tint); color: var(--purple); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-error { background: var(--error-light); color: var(--error); }
.badge-warning { background: var(--warning-light); color: var(--warning); }

/* Loading overlay */
.loading-overlay {
    position: fixed; inset: 0;
    background: rgba(255,255,255,0.88);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
    opacity: 0; pointer-events: none;
    transition: var(--transition-base);
}
.loading-overlay.visible { opacity: 1; pointer-events: all; }
.loading-spinner {
    width: 40px; height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--purple);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Qualification tags */
.qualifications-list { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
.qualification-tag {
    padding: 0.35rem 0.8rem;
    border-radius: var(--radius-full);
    background: var(--gray-100);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: var(--transition-fast);
}
.qualification-tag:hover { border-color: var(--purple); color: var(--purple); }
.qualification-tag.selected { background: var(--purple-tint); color: var(--purple); border-color: var(--purple); }

/* Step indicator */
.step-indicator { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 1.75rem; }
.step-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--border);
    transition: var(--transition-base);
}
.step-dot.active { background: var(--purple); width: 28px; border-radius: 4px; }
.step-dot.completed { background: var(--success); }

/* Responsive */
@media (max-width: 768px) {
    .container { padding: 0 1.25rem; }
    .form-row { grid-template-columns: 1fr; }
    .toast-container { right: 0.75rem; left: 0.75rem; }
    .toast { min-width: auto; }
}
