/* Generic modal & glassmorphism system support (for pages like room.html that don't load style.css) */
:root {
    --glass-border: rgba(255,255,255,0.35);
    --glass-card: rgba(255,255,255,0.55);
}
[data-theme="dark"] {
    --glass-border: rgba(255,255,255,0.06);
    --glass-card: rgba(30,30,30,0.65);
}

/* Specific style for the dynamic auth overlay, to not conflict with room-native.css .modal-overlay */
#modalOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    display: block !important;
}
#modalOverlay.active {
    opacity: 1 !important;
    visibility: visible !important;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -45%);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    padding: 40px;
}
.modal.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%);
}
.glass-modal {
    background: var(--glass-card);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid var(--glass-border);
}

/* ==================== AUTH MODALS ==================== */

.auth-modal {
    width: 90%;
    max-width: 420px;
    padding: 0;
    overflow: hidden;
}

.auth-modal-inner {
    padding: 32px;
}

/* Tab Switcher */
.auth-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-subtle);
    background: var(--settings-bg);
}

.auth-tab {
    flex: 1;
    padding: 18px;
    text-align: center;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    color: var(--muted);
    border: none;
    background: none;
    transition: all 0.3s;
    position: relative;
}

.auth-tab::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 3px;
    background: var(--red);
    border-radius: 3px;
    transition: all 0.3s;
    transform: translateX(-50%);
}

.auth-tab.active {
    color: var(--text);
}

.auth-tab.active::after {
    width: 60%;
}

.auth-tab:hover {
    color: var(--text);
}

/* Auth Panels */
.auth-panel {
    display: none;
    animation: authFadeIn 0.4s forwards;
}

.auth-panel.active {
    display: block;
}

@keyframes authFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Auth Header */
.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-header h2 {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 6px;
}

.auth-header p {
    color: var(--muted);
    font-size: 14px;
}

/* Form Groups */
.auth-form-group {
    margin-bottom: 16px;
    position: relative;
}

.auth-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
    letter-spacing: 0.3px;
}

.auth-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-input);
    border-radius: 12px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s;
    outline: none;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    box-sizing: border-box;
    color: var(--text);
}

.auth-input:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 4px rgba(227,27,35,0.06);
}

.auth-input.error {
    border-color: #ff4444;
    box-shadow: 0 0 0 4px rgba(255,68,68,0.06);
}

.auth-input.success {
    border-color: #22c55e;
}

/* Input with icon */
.auth-input-wrap {
    position: relative;
}

.auth-input-wrap .auth-input {
    padding-left: 46px;
}

.auth-input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 16px;
    transition: color 0.3s;
}

.auth-input-wrap:focus-within .auth-input-icon {
    color: var(--red);
}

/* Password toggle */
.auth-pw-toggle {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    transition: color 0.3s;
}

.auth-pw-toggle:hover {
    color: var(--text);
}

/* Error text */
.auth-error {
    display: none;
    color: #ff4444;
    font-size: 12px;
    font-weight: 600;
    margin-top: 6px;
    padding-left: 4px;
}

.auth-error.visible {
    display: block;
    animation: authFadeIn 0.3s;
}

/* Global message */
.auth-message {
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 20px;
    display: none;
    animation: authFadeIn 0.3s;
}

.auth-message.visible {
    display: flex;
    align-items: center;
    gap: 10px;
}

.auth-message.error {
    background: rgba(255,68,68,0.08);
    color: #ff4444;
    border: 1px solid rgba(255,68,68,0.15);
}

.auth-message.success {
    background: rgba(34,197,94,0.08);
    color: #22c55e;
    border: 1px solid rgba(34,197,94,0.15);
}

/* Submit button */
.auth-submit {
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: 12px;
    background: var(--red);
    color: white;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Inter', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 6px;
}

.auth-submit:hover {
    background: var(--red-h);
    transform: translateY(-1px);
    box-shadow: var(--shadow-red);
}

.auth-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.auth-submit .spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: authSpin 0.6s linear infinite;
}

@keyframes authSpin {
    to { transform: rotate(360deg); }
}

/* Forgot password link */
.auth-forgot {
    text-align: right;
    margin-bottom: 20px;
}

.auth-forgot a {
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.3s;
}

.auth-forgot a:hover {
    color: var(--red);
}

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 28px 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-input);
}

/* Social buttons (future) */
.auth-social-btns {
    display: flex;
    gap: 12px;
}

.auth-social-btn {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--border-subtle);
    border-radius: 12px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    color: var(--text);
}

.auth-social-btn:hover {
    border-color: var(--muted);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.06);
}

.auth-social-btn span {
    font-size: 13px;
}

/* Switch link */
.auth-switch {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--muted);
}

.auth-switch a {
    color: var(--red);
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* ==================== OTP VERIFICATION MODAL ==================== */

.otp-modal {
    width: 90%;
    max-width: 380px;
    text-align: center;
}

.otp-icon {
    width: 80px;
    height: 80px;
    background: rgba(227,27,35,0.08);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    font-size: 36px;
    color: var(--red);
}

.otp-title {
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.otp-subtitle {
    color: var(--muted);
    font-size: 15px;
    margin-bottom: 32px;
    line-height: 1.5;
}

.otp-subtitle strong {
    color: var(--text);
}

/* OTP Input Boxes */
.otp-inputs {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 32px;
}

.otp-digit {
    width: 52px;
    height: 60px;
    text-align: center;
    font-size: 24px;
    font-weight: 800;
    border: 2px solid rgba(0,0,0,0.1);
    border-radius: 14px;
    outline: none;
    transition: all 0.3s;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    font-family: 'Inter', sans-serif;
}

.otp-digit:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 4px rgba(227,27,35,0.08);
}

.otp-resend {
    color: var(--muted);
    font-size: 14px;
    margin-top: 20px;
}

.otp-resend a {
    color: var(--red);
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.otp-resend a:hover {
    text-decoration: underline;
}

/* ==================== FORGOT PASSWORD MODAL ==================== */

.forgot-modal {
    width: 90%;
    max-width: 400px;
}

/* ==================== SETTINGS MODAL ==================== */

.settings-modal {
    width: 90%;
    max-width: 800px;
    height: 600px;
    max-height: 85vh;
    overflow: hidden;
    padding: 0;
}

.settings-modal-inner {
    padding: 0;
    height: 100%;
    display: flex;
    flex-direction: row;
}

.settings-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}

.settings-header-icon {
    width: 48px;
    height: 48px;
    background: rgba(227,27,35,0.08);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--red);
}

.settings-header h2 {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.settings-section {
    margin-bottom: 24px;
}

.settings-section h3 {
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 14px;
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-radius: 14px;
    background: var(--settings-bg);
    margin-bottom: 8px;
    transition: background 0.2s;
}

.settings-item:hover {
    background: var(--bg-hover);
}

.settings-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-item-left i {
    font-size: 16px;
    color: var(--muted);
    width: 20px;
    text-align: center;
}

.settings-item-left span {
    font-size: 14px;
    font-weight: 600;
}

.settings-item-right {
    font-size: 13px;
    color: var(--muted);
}

.settings-avatar-section {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
    padding: 20px;
    border-radius: 16px;
    background: var(--settings-bg);
}

.settings-avatar-preview {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    color: white;
    overflow: hidden;
    flex-shrink: 0;
}

.settings-avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.settings-avatar-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-avatar-actions .btn {
    font-size: 13px;
    padding: 8px 16px;
}

.settings-avatar-actions span {
    font-size: 12px;
    color: var(--muted);
}

/* ==================== PROFILE DROPDOWN ==================== */

.profile-area {
    display: none;
    align-items: center;
    gap: 12px;
    position: relative;
    cursor: pointer;
}

.profile-area.visible {
    display: flex;
}

.profile-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 800;
    color: white;
    overflow: hidden;
    border: 2px solid rgba(0,0,0,0.06);
    transition: border-color 0.3s;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-chevron {
    font-size: 12px;
    color: var(--muted);
    transition: transform 0.3s;
}

.profile-area:hover .profile-avatar {
    border-color: var(--red);
}

.profile-area.open .profile-chevron {
    transform: rotate(180deg);
}

/* Dropdown Menu */
.profile-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 260px;
    background: var(--dropdown-bg);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.3s cubic-bezier(.175,.885,.32,1.275);
    z-index: 200;
    overflow: hidden;
}

.profile-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 12px;
}

.dropdown-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
    color: white;
    overflow: hidden;
    flex-shrink: 0;
}

.dropdown-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dropdown-user-info {
    flex: 1;
    min-width: 0;
}

.dropdown-username {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-email {
    font-size: 12px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-menu {
    padding: 8px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    border: none;
    background: none;
    width: 100%;
    font-family: 'Inter', sans-serif;
}

.dropdown-item:hover {
    background: var(--bg-hover);
}

.dropdown-item i {
    width: 20px;
    text-align: center;
    color: var(--muted);
    font-size: 15px;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 4px 8px;
}

.dropdown-item.danger {
    color: var(--red);
}

.dropdown-item.danger i {
    color: var(--red);
}

.dropdown-item.danger:hover {
    background: rgba(227,27,35,0.06);
}

/* ==================== FRIENDS SYSTEM ==================== */

.friends-icon-btn {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 18px;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    transition: all 0.3s;
}

.friends-icon-btn:hover {
    color: var(--red);
    background: rgba(227,27,35,0.06);
}

.friends-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--red);
    color: white;
    font-size: 11px;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg);
    pointer-events: none;
    line-height: 1;
}

/* Friends Modal */
#friendsModal {
    width: 90%;
    max-width: 460px;
    padding: 0;
    overflow: hidden;
}

#friendsModal.active {
    display: block;
}

.friends-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px 18px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.friends-modal-header h3 {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.friends-modal-header h3 i {
    color: var(--red);
}

.close-friends-modal {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--muted);
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-friends-modal:hover {
    background: rgba(0,0,0,0.05);
    color: var(--red);
}

/* Friend Tabs */
.friends-tabs {
    display: flex;
    padding: 0 28px;
    border-bottom: 2px solid rgba(0,0,0,0.04);
    background: rgba(0,0,0,0.02);
}

.friend-tab {
    flex: 1;
    padding: 14px 8px;
    text-align: center;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    color: var(--muted);
    border: none;
    background: none;
    transition: all 0.3s;
    position: relative;
    font-family: 'Inter', sans-serif;
}

.friend-tab::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 3px;
    background: var(--red);
    border-radius: 3px;
    transition: all 0.3s;
    transform: translateX(-50%);
}

.friend-tab.active {
    color: var(--text);
}

.friend-tab.active::after {
    width: 60%;
}

.friend-tab:hover {
    color: var(--text);
}

.friend-tab .tab-badge {
    background: var(--red);
    color: white;
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 800;
    margin-left: 6px;
}

/* Friend Panels */
.friends-modal-inner {
    padding: 20px 28px 28px;
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
}

.friend-panel {
    display: none;
    animation: authFadeIn 0.4s forwards;
}

.friend-panel.active {
    display: block;
}

/* Friend Row */
.friend-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(0,0,0,0.02);
    margin-bottom: 8px;
    transition: background 0.2s;
}

.friend-row:hover {
    background: rgba(0,0,0,0.04);
}

.friend-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.friend-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
    color: white;
    overflow: hidden;
    flex-shrink: 0;
}

.friend-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.friend-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

/* Action Buttons */
.friend-actions {
    display: flex;
    gap: 6px;
}

.friend-btn {
    border: none;
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Inter', sans-serif;
}

.friend-btn-accept {
    background: rgba(34,197,94,0.1);
    color: #22c55e;
}

.friend-btn-accept:hover {
    background: #22c55e;
    color: white;
    transform: translateY(-1px);
}

.friend-btn-reject {
    background: rgba(239,68,68,0.08);
    color: #ef4444;
}

.friend-btn-reject:hover {
    background: #ef4444;
    color: white;
    transform: translateY(-1px);
}

.friend-btn-remove {
    background: rgba(239,68,68,0.06);
    color: #ef4444;
}

.friend-btn-remove:hover {
    background: #ef4444;
    color: white;
    transform: translateY(-1px);
}

.friend-btn-add {
    background: var(--red);
    color: white;
    box-shadow: 0 4px 12px rgba(227,27,35,0.2);
}

.friend-btn-add:hover {
    background: var(--red-h);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(227,27,35,0.3);
}

.friend-btn-sent {
    background: rgba(0,0,0,0.04);
    color: var(--muted);
    cursor: default;
}

/* Search Input */
.friend-search-wrap {
    position: relative;
    margin-bottom: 16px;
}

.friend-search-wrap i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 14px;
    transition: color 0.3s;
}

.friend-search-wrap:focus-within i {
    color: var(--red);
}

.friend-search-input {
    width: 100%;
    padding: 12px 16px 12px 42px;
    border: 2px solid rgba(0,0,0,0.08);
    border-radius: 12px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s;
    outline: none;
    background: rgba(255,255,255,0.6);
    backdrop-filter: blur(10px);
    box-sizing: border-box;
    color: var(--text);
}

.friend-search-input:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 4px rgba(227,27,35,0.06);
}

.friend-empty {
    text-align: center;
    padding: 30px 10px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 500;
}

.friend-empty i {
    display: block;
    font-size: 28px;
    margin-bottom: 10px;
    opacity: 0.4;
}

/* Toast Notification */
.friend-toast {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10000;
    padding: 14px 20px;
    border-radius: 14px;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 12px 32px rgba(0,0,0,0.12);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastSlide 0.4s cubic-bezier(.175,.885,.32,1.275) forwards;
}

.friend-toast i {
    color: var(--red);
    font-size: 16px;
}

@keyframes toastSlide {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(40px); }
}

/* ==================== FRIEND STATUS ==================== */

.friend-status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 6px;
    vertical-align: middle;
}

.friend-status-dot.online {
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}

.friend-status-dot.offline {
    background: rgba(0,0,0,0.15);
}

.friend-row.friend-offline {
    opacity: 0.55;
}

.friend-row.friend-offline:hover {
    opacity: 0.75;
}

.friend-name-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.friend-status-subtext {
    font-size: 11px;
    font-weight: 550;
    color: var(--muted);
    opacity: 0.85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.friend-status-subtext.offline-status {
    opacity: 0.65;
}

.friend-btn-join {
    background: var(--red);
    color: white;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(227,27,35,0.2);
}

.friend-btn-join:hover {
    background: var(--red-h);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(227,27,35,0.3);
}

/* ==================== INVITE TOAST ==================== */

.friend-toast-invite {
    flex-direction: row;
    min-width: 300px;
    padding: 16px 18px;
    gap: 12px;
}

.invite-toast-btn {
    background: var(--red);
    color: white;
    text-decoration: none;
    padding: 8px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
    white-space: nowrap;
}

.invite-toast-btn:hover {
    background: var(--red-h);
    transform: translateY(-1px);
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 768px) {
    /* Profile Dropdown - prevent overflow */
    .profile-dropdown {
        right: -10px;
        width: 240px;
    }
    .profile-name {
        display: none;
    }
    .profile-chevron {
        display: none;
    }

    /* Friends Modal */
    #friendsModal {
        width: 95%;
        max-width: 95%;
        max-height: 88vh;
    }
    .friends-modal-header {
        padding: 18px 20px 14px;
    }
    .friends-modal-header h3 {
        font-size: 17px;
    }
    .friends-tabs {
        padding: 0 16px;
    }
    .friends-modal-inner {
        padding: 16px 16px 20px;
        max-height: 340px;
    }

    /* Settings Modal */
    .settings-modal {
        width: 95%;
        max-width: 95%;
        max-height: 88vh;
    }
    .settings-modal-inner {
        padding: 24px 18px;
    }
    .settings-avatar-section {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }
    .settings-avatar-actions {
        align-items: center;
    }
    .settings-item {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Toast Notifications */
    .friend-toast {
        right: 12px;
        left: 12px;
        top: 70px;
        border-radius: 12px;
    }
    .friend-toast-invite {
        min-width: auto;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Auth Modal buttons */
    .auth-social-btns {
        flex-direction: row;
    }
}

@media (max-width: 480px) {
    /* Profile dropdown */
    .profile-dropdown {
        width: calc(100vw - 24px);
        right: -12px;
    }

    /* Auth form */
    .auth-modal-inner {
        padding: 20px 16px;
    }
    .auth-header h2 {
        font-size: 20px;
    }
    .auth-input {
        font-size: 16px; /* Prevent iOS zoom on focus */
        padding: 13px 16px;
    }
    .auth-input-wrap .auth-input {
        padding-left: 44px;
        font-size: 16px;
    }
    .auth-submit {
        padding: 14px;
        font-size: 15px;
        min-height: 48px;
    }
    .auth-social-btns {
        flex-direction: column;
        gap: 10px;
    }
    .auth-social-btn {
        min-height: 48px;
    }
    .auth-forgot a {
        font-size: 14px;
    }

    /* OTP Modal */
    .otp-modal {
        width: 95%;
    }
    .otp-inputs {
        gap: 6px;
    }
    .otp-digit {
        width: 42px;
        height: 52px;
        font-size: 20px;
        border-radius: 12px;
    }
    .otp-title {
        font-size: 22px;
    }
    .otp-subtitle {
        font-size: 14px;
    }

    /* Friends modal */
    #friendsModal {
        max-height: 86vh;
    }
    .friends-modal-inner {
        max-height: 300px;
        padding: 14px 14px 18px;
    }
    .friend-row {
        padding: 10px;
    }
    .friend-btn {
        padding: 7px 10px;
        font-size: 12px;
    }

    /* Friends icon btn */
    .friends-icon-btn {
        width: 34px;
        height: 34px;
        font-size: 16px;
    }

    /* Toast */
    .friend-toast {
        font-size: 13px;
        padding: 12px 14px;
        top: 60px;
    }

    /* Clean input (wizard) */
    .clean-input {
        font-size: 16px; /* Prevent iOS zoom */
    }
}

/* ==================== SETTINGS MODAL SPLIT LAYOUT ==================== */

.settings-layout {
    display: flex;
    width: 100%;
    height: 100%;
}

.settings-sidebar {
    width: 220px;
    background: var(--bg-hover);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    gap: 8px;
    flex-shrink: 0;
}

.settings-tab-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
}

.settings-tab-btn:hover {
    background: var(--settings-bg);
    color: var(--red);
}

.settings-tab-btn.active {
    background: var(--red);
    color: white;
}

.settings-tab-btn.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.settings-tab-btn.danger.active {
    background: #ef4444;
    color: white;
}

.settings-content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.settings-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.settings-form-group label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}

.settings-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    outline: none;
    transition: border-color 0.2s;
}

.settings-input:focus {
    border-color: var(--red);
}

.settings-textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    outline: none;
    min-height: 80px;
    resize: none;
    transition: border-color 0.2s;
}

.settings-textarea:focus {
    border-color: var(--red);
}

.settings-submit-btn {
    background: var(--red);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.settings-submit-btn:hover {
    background: #c1151b;
}

.settings-submit-btn:disabled {
    background: var(--border-light);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* Emoji config list */
.reaction-config-list {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

.reaction-config-slot {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: var(--bg-input);
    border: 2px dashed var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s;
}

.reaction-config-slot:hover, .reaction-config-slot.active {
    border-color: var(--red);
    background: rgba(227, 27, 35, 0.05);
}

.config-emoji-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 12px;
    margin-top: 12px;
    max-height: 120px;
    overflow-y: auto;
}

.picker-emoji-btn {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    transition: transform 0.1s;
    padding: 4px;
}

.picker-emoji-btn:hover {
    transform: scale(1.2);
}

/* Sessions list */
.sessions-list-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.session-card {
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.session-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.session-device {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.session-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.session-current-badge {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    display: inline-block;
    width: fit-content;
}

.session-revoke-btn {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: none;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.session-revoke-btn:hover {
    background: #ef4444;
    color: white;
}

/* Mobile responsive settings layout */
@media (max-width: 680px) {
    .settings-modal-inner {
        flex-direction: column !important;
    }
    .settings-layout {
        flex-direction: column;
    }
    .settings-sidebar {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        padding: 12px;
        border-right: none;
        border-bottom: 1px solid var(--border-light);
        gap: 6px;
        white-space: nowrap;
    }
    .settings-tab-btn {
        padding: 8px 12px;
        font-size: 13px;
        width: auto;
    }
    .settings-content {
        padding: 20px;
    }
}

/* Mobile Navigation Profile styles */
.mobile-nav-profile {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 20px;
    margin-top: 16px;
    border-top: 1px solid var(--profile-card-border, rgba(0, 0, 0, 0.08));
    width: 85%;
    max-width: 320px;
}

.mobile-profile-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 800;
    color: white;
    overflow: hidden;
    border: 2px solid rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}

.mobile-profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mobile-profile-name {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-primary, #1a1a1a);
}

.mobile-profile-email {
    font-size: 12px;
    color: var(--text-muted, #666);
}

.mobile-status-area {
    background: var(--profile-card-subcard, rgba(0, 0, 0, 0.02));
    border: 1px solid var(--profile-card-border, rgba(0, 0, 0, 0.08));
    padding: 10px 14px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    width: 100%;
    justify-content: center;
    box-sizing: border-box;
}

.mobile-status-text {
    font-size: 13px;
    color: var(--text-muted, #666);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

[data-theme="dark"] .mobile-nav-profile {
    border-top-color: var(--profile-card-border, rgba(255, 255, 255, 0.08));
}
[data-theme="dark"] .mobile-profile-name {
    color: var(--text-primary, #fff);
}
[data-theme="dark"] .mobile-profile-email {
    color: var(--text-muted, #999);
}
[data-theme="dark"] .mobile-status-text {
    color: var(--text-muted, #999);
}
