/* RehabGPT — Login/Register Modal */

#rg-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999999;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: rgFadeIn .18s ease;
}
#rg-modal-overlay[aria-hidden="true"] {
    display: none !important;
}

@keyframes rgFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

#rg-modal-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 48px rgba(0,0,0,.18);
    width: 100%;
    max-width: 440px;
    position: relative;
    overflow: hidden;
    animation: rgSlideUp .22s ease;
    font-family: "Roboto Condensed", sans-serif;
}

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

#rg-modal-bar {
    height: 5px;
    background: linear-gradient(90deg, #2563eb 0%, #f7c04d 100%);
}

#rg-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    font-size: 18px;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
    padding: 4px 6px;
    border-radius: 6px;
    transition: color .15s, background .15s;
    z-index: 2;
}
#rg-modal-close:hover {
    color: #1e293b;
    background: #f1f5f9;
}

/* Tabs */
#rg-modal-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #f1f5f9;
    padding: 18px 24px 0;
}
.rg-tab {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    padding: 8px 16px 10px;
    font-family: "Roboto Condensed", sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: color .15s, border-color .15s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.rg-tab:hover {
    color: #2563eb;
}
.rg-tab.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

.rg-free-badge {
    background: #dcfce7;
    color: #16a34a;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 999px;
    letter-spacing: .3px;
}

/* Panels */
.rg-panel {
    padding: 24px 24px 28px;
}

/* Form groups */
.rg-mfg {
    margin-bottom: 14px;
}
.rg-mfg label {
    display: block;
    font-family: "Roboto Condensed", sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 5px;
    letter-spacing: .2px;
}
.rg-mfg input {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-family: "Roboto Condensed", sans-serif;
    font-size: 14.5px;
    color: #1e293b;
    background: #f8fafc;
    transition: border-color .15s, box-shadow .15s;
    box-sizing: border-box;
    outline: none;
}
.rg-mfg input:focus {
    border-color: #2563eb;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.rg-mfg input::placeholder {
    color: #cbd5e1;
}
.rg-mfg select {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-family: "Roboto Condensed", sans-serif;
    font-size: 14.5px;
    color: #1e293b;
    background: #f8fafc;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
    box-sizing: border-box;
    outline: none;
}
.rg-mfg select:focus {
    border-color: #2563eb;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

/* Two-column row */
.rg-mrow2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Submit button */
.rg-mbtn {
    width: 100%;
    height: 46px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: "Roboto Condensed", sans-serif;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .4px;
    cursor: pointer;
    margin-top: 6px;
    transition: background .15s, box-shadow .15s, transform .1s;
}
.rg-mbtn:hover {
    background: #1d4ed8;
    box-shadow: 0 4px 16px rgba(37,99,235,.28);
}
.rg-mbtn:active {
    transform: scale(.98);
}
.rg-mbtn:disabled {
    background: #93c5fd;
    cursor: not-allowed;
}

/* Error / success messages */
.rg-msg-err {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    border-radius: 7px;
    padding: 9px 12px;
    font-size: 13.5px;
    margin-bottom: 14px;
    font-family: "Roboto Condensed", sans-serif;
}

/* Responsive */
@media (max-width: 480px) {
    #rg-modal-card { border-radius: 12px; }
    .rg-panel { padding: 18px 16px 22px; }
    #rg-modal-tabs { padding: 14px 16px 0; }
    .rg-mrow2 { grid-template-columns: 1fr; gap: 0; }
}

/* ── Header "Нэвтрэх" chip (non-logged-in) ─────────── */
#rg-login-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 11px 5px 5px;
    border-radius: 999px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    user-select: none;
    font-family: "Roboto Condensed", sans-serif;
    font-size: 13.5px;
    font-weight: 500;
    color: #1e293b;
    transition: background .15s;
    outline: none;
    margin-left: 8px;
    vertical-align: middle;
}
#rg-login-chip:hover,
#rg-login-chip:focus {
    background: #e2eaf7;
    border-color: #c7d7f0;
}

/* ── Header User Dropdown ──────────────────────────── */
#rg-user-chip-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
}

#rg-user-chip {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 11px 5px 5px;
    border-radius: 999px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    user-select: none;
    font-family: "Roboto Condensed", sans-serif;
    font-size: 13.5px;
    font-weight: 500;
    color: #1e293b;
    transition: background .15s;
    outline: none;
}
#rg-user-chip:hover,
#rg-user-chip:focus {
    background: #e2eaf7;
    border-color: #c7d7f0;
}

.rgu-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #2563eb;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-family: "Roboto Condensed", sans-serif;
    overflow: hidden;
}

.rgu-name {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rgu-chevron {
    font-size: 10px;
    color: #94a3b8;
    transition: transform .15s;
}
#rg-user-chip[aria-expanded="true"] .rgu-chevron {
    transform: rotate(180deg);
}

/* Dropdown panel */
#rg-user-drop {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 220px;
    background: #fff;
    border: 0.5px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(0,0,0,.10);
    overflow: hidden;
    z-index: 99999;
    font-family: "Roboto Condensed", sans-serif;
    animation: rguFadeIn .15s ease;
}
#rg-user-drop.rgu-open {
    display: block;
}

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

.rgu-dd-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 15px 11px;
    border-bottom: 0.5px solid #f1f5f9;
}

.rgu-dd-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #2563eb;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-family: "Roboto Condensed", sans-serif;
    overflow: hidden;
}

.rgu-dd-name {
    font-size: 13.5px;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.rgu-dd-role {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 1px;
}

.rgu-dd-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 11px 15px;
    font-size: 13.5px;
    color: #374151;
    text-decoration: none;
    transition: background .12s;
    cursor: pointer;
}
.rgu-dd-item:hover {
    background: #f8fafc;
    color: #1e293b;
    text-decoration: none;
}
.rgu-dd-item svg {
    flex-shrink: 0;
    opacity: .6;
}

.rgu-danger {
    color: #dc2626;
}
.rgu-danger:hover {
    background: #fef2f2;
    color: #dc2626;
}
.rgu-danger svg {
    opacity: .75;
}

.rgu-dd-sep {
    height: 0.5px;
    background: #f1f5f9;
    margin: 2px 0;
}
