﻿/* ============================================================================
 REGISTER PAGE CSS
 ------------------------------------------------------------------------------
 GOAL:
 - Force scrolling ONLY on register page
 - Do NOT break StartPage/Login

 WHY THIS WORKS:
 - Global startpage.css likely has: html, body { overflow:hidden; height:100%; }
 - We override it here with !important for this page only.
============================================================================ */

/* FORCE SCROLL even if global css blocks it */
html, body {
    height: auto !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

/* Register page wrapper scrollable */
.reg-page {
    min-height: 100vh;
    background: #f3f3f3;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* Center container */
.reg-shell {
    min-height: 100vh;
    display: grid;
    place-items: start center; /* start so it can scroll down */
    padding: 32px 16px;
    box-sizing: border-box;
}

/* Main card */
.reg-panel {
    width: min(980px, 96vw);
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e2e2e2;
    box-shadow: 0 18px 40px rgba(0,0,0,0.08);
    padding: 26px;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 26px;
    margin-bottom: 40px; /* space for scroll end */
}

/* ================= LEFT PREVIEW ================= */
.reg-preview {
    background: #f7f7f7;
    border-radius: 8px;
    padding: 26px 18px;
    box-sizing: border-box;
    text-align: center;
    min-height: 520px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.reg-avatar-wrap {
    position: relative;
    width: 180px;
    height: 180px;
    border-radius: 999px;
    background: #fff;
    display: grid;
    place-items: center;
    margin-top: 10px;
}

.reg-avatar {
    width: 160px;
    height: 160px;
    object-fit: cover;
    border-radius: 999px;
}

/* Pencil button (used for avatar + bio) */
.reg-icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid #cfcfcf;
    background: #fff;
    cursor: pointer;
    display: grid;
    place-items: center;
    text-decoration: none;
    padding: 0;
}

    .reg-icon-btn svg {
        width: 18px;
        height: 18px;
        fill: #444;
    }

    .reg-icon-btn:hover {
        border-color: #4a75a1;
        box-shadow: 0 0 0 3px rgba(74,117,161,0.12);
    }

/* avatar pencil position */
.reg-avatar-edit {
    position: absolute;
    right: 8px;
    bottom: 8px;
}

/* Name + level */
.reg-preview-name {
    margin-top: 18px;
    font-size: 30px;
    font-weight: 800;
    color: #222;
}

.reg-preview-level {
    margin-top: 6px;
    font-size: 18px;
    color: #444;
}

/* Bio under organizational level */
.reg-preview-bio {
    margin-top: 22px;
    font-size: 14px;
    color: #555;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

/* ================= RIGHT FORM ================= */
.reg-form-area {
    padding: 6px 6px 10px;
    box-sizing: border-box;
}

.reg-header {
    margin-bottom: 18px;
}

.reg-title {
    font-size: 22px;
    font-weight: 800;
    margin: 0;
    color: #222;
}

.reg-title-line {
    height: 2px;
    background: #dcdcdc;
    margin-top: 10px;
}

.reg-form {
    margin-top: 6px;
}

.reg-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 18px;
}

.reg-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.reg-label {
    font-size: 13px;
    font-weight: 700;
    color: #222;
}

.reg-input {
    height: 36px;
    border: 1px solid #d8d8d8;
    border-radius: 6px;
    padding: 0 12px;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
    background: #fff;
}

    .reg-input:focus {
        border-color: #4a75a1;
        box-shadow: 0 0 0 3px rgba(74,117,161,0.12);
    }

.reg-hint {
    font-size: 11px;
    color: #999;
}

.reg-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    font-size: 12px;
    color: #666;
}

/* Upload */
.reg-upload-title {
    margin-top: 18px;
    font-size: 13px;
    font-weight: 800;
    color: #222;
}

.reg-upload {
    margin-top: 10px;
    height: 110px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    background: #f4f4f4;
    display: grid;
    place-items: center;
    position: relative;
    cursor: pointer;
    user-select: none;
    overflow: hidden;
}

.reg-upload-icon svg {
    width: 32px;
    height: 32px;
    fill: #666;
    opacity: 0.85;
}

.reg-upload-text {
    margin-top: -6px;
    font-size: 12px;
    color: #777;
}

.reg-upload-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* Buttons */
.reg-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 16px;
    gap: 12px;
}

/* ✅ NEW: actions row (login left + button right) */
.reg-actions-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    gap: 16px;
}

.reg-login-inline {
    font-size: 13px;
    color: #6b6b6b;
    display: flex;
    gap: 8px;
    align-items: center;
    white-space: nowrap;
}

.reg-btn {
    height: 42px;
    padding: 0 18px;
    border-radius: 6px;
    border: none;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    box-sizing: border-box;
    white-space: nowrap;
}

.reg-btn-primary {
    background: #4a75a1;
    color: #fff;
}

    .reg-btn-primary:hover {
        background: #3b5d81;
    }

.reg-btn-secondary {
    background: #4a75a1;
    color: #fff;
}

    .reg-btn-secondary:hover {
        background: #3b5d81;
    }

.reg-arrow {
    font-size: 16px;
}

/* Errors */
.reg-error {
    background: #ffecec;
    border: 1px solid #ffb7b7;
    color: #8a1f1f;
    padding: 10px;
    border-radius: 6px;
    font-size: 12px;
    margin-bottom: 12px;
}

.reg-field-error {
    color: #c0392b;
    font-size: 12px;
}

/* ==========================================================
   BIO INLINE EDIT STYLES
========================================================== */

.reg-bio-display {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

    .reg-bio-display span {
        max-width: 220px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

.reg-bio-edit {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.reg-bio-input {
    height: 36px;
    border: 1px solid #d8d8d8;
    border-radius: 6px;
    padding: 0 12px;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
}

    .reg-bio-input:focus {
        border-color: #4a75a1;
        box-shadow: 0 0 0 3px rgba(74,117,161,0.12);
    }

.reg-bio-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.reg-bio-save,
.reg-bio-cancel {
    height: 32px;
    padding: 0 12px;
    border-radius: 6px;
    border: 1px solid #cfcfcf;
    background: #fff;
    font-weight: 700;
    cursor: pointer;
}

.reg-bio-save {
    background: #4a75a1;
    color: #fff;
    border: none;
}

    .reg-bio-save:hover {
        background: #3b5d81;
    }

/* ==========================================================
   UPLOAD FILE NAME + REMOVE X
========================================================== */

.reg-filebar {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    height: 36px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    box-sizing: border-box;
    gap: 10px;
}

.reg-filename {
    font-size: 12px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reg-file-remove {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid #cfcfcf;
    background: #fff;
    cursor: pointer;
    font-weight: 900;
    line-height: 1;
}

    .reg-file-remove:hover {
        border-color: #4a75a1;
        box-shadow: 0 0 0 3px rgba(74,117,161,0.12);
    }

/* ==========================================================
   AVATAR PICKER MODAL (NEW)
========================================================== */

.reg-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.reg-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.35);
}

.reg-modal-card {
    position: relative;
    width: min(760px, 92vw);
    max-height: 80vh;
    margin: 8vh auto 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 22px 60px rgba(0,0,0,0.25);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.reg-modal-header {
    padding: 14px 16px;
    border-bottom: 1px solid #e6e6e6;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.reg-modal-title {
    font-weight: 800;
    font-size: 16px;
    color: #222;
}

.reg-modal-close {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid #d5d5d5;
    background: #fff;
    cursor: pointer;
    font-weight: 900;
    line-height: 1;
}

    .reg-modal-close:hover {
        border-color: #4a75a1;
        box-shadow: 0 0 0 3px rgba(74,117,161,0.12);
    }

.reg-modal-body {
    padding: 16px;
    overflow: auto;
}

/* Avatar heads grid */
.reg-avatar-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
}

@media (max-width: 700px) {
    .reg-avatar-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.reg-avatar-item {
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    background: #fafafa;
    padding: 10px;
    cursor: pointer;
    display: grid;
    place-items: center;
}

    .reg-avatar-item:hover {
        border-color: #4a75a1;
        box-shadow: 0 0 0 3px rgba(74,117,161,0.12);
    }

    .reg-avatar-item img {
        width: 72px;
        height: 72px;
        object-fit: cover;
        border-radius: 999px;
        background: #fff;
    }

.reg-modal-footer {
    padding: 12px 16px;
    border-top: 1px solid #e6e6e6;
    display: flex;
    justify-content: flex-end;
}

.reg-modal-btn {
    height: 36px;
    padding: 0 14px;
    border-radius: 8px;
    border: 1px solid #cfcfcf;
    background: #fff;
    font-weight: 800;
    cursor: pointer;
}

    .reg-modal-btn:hover {
        border-color: #4a75a1;
        box-shadow: 0 0 0 3px rgba(74,117,161,0.12);
    }

/* Login anchor style (used in reg-login-inline) */
.reg-login-anchor {
    color: #4a75a1;
    font-weight: 700;
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

    .reg-login-anchor:hover {
        border-bottom-color: #4a75a1;
    }

/* Responsive */
@media (max-width: 900px) {
    .reg-panel {
        grid-template-columns: 1fr;
    }

    .reg-preview {
        min-height: 320px;
    }

    /* Stack login + button on mobile */
    .reg-actions-row {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .reg-login-inline {
        justify-content: center;
    }

    .reg-btn {
        justify-content: center;
        width: 100%;
    }
}

/* ✅ SAFE ADD-ON: make dropdown items always visible */
.reg-input,
.reg-input option {
    color: #111;
}
