/*
 * BSMS Web
 * Copyright © 2026 Jellyfish Jelly
 * SPDX-License-Identifier: AGPL-3.0-only
 */

:root {
    --text-scale: 1;
    --theme-rgb: 187, 0, 30;
    --accent: #BB001E;
    --accent-hover: #d10022;
    --accent-glow: rgba(187, 0, 30, 0.35);

    --bg: #000000;
    --fg: #ffffff;
    --fg2: rgba(255, 255, 255, 0.6);
    --border: rgba(255, 255, 255, 0.15);
    --pill-bg: rgba(255, 255, 255, 0.08);
    --input-bg: rgba(255, 255, 255, 0.1);

    --ctrl-bg: rgba(20, 20, 20, 0.98);
    --ctrl-border: rgba(187, 0, 30, 0.4);
    --section-bg: rgba(255, 255, 255, 0.04);
    --section-border: rgba(255, 255, 255, 0.08);

    --font: 'Patrick Hand', cursive;
    --font-mono: 'JetBrains Mono', monospace;
    --shadow: 0 10px 40px rgba(0,0,0,0.5);
    --shadow-sm: 0 4px 15px rgba(0,0,0,0.3);
}

body.light-mode {
    --bg: #f0f2f5;
    --fg: #1c1e21;
    --fg2: rgba(0, 0, 0, 0.6);
    --border: rgba(0, 0, 0, 0.15);
    --pill-bg: #e4e6eb;
    --input-bg: #ffffff;

    --ctrl-bg: #ffffff;
    --ctrl-border: rgba(0, 0, 0, 0.15);
    --section-bg: rgba(0, 0, 0, 0.05);
    --section-border: rgba(0, 0, 0, 0.1);
    --shadow: 0 10px 40px rgba(0,0,0,0.15);
    --shadow-sm: 0 4px 15px rgba(0,0,0,0.1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0; height: 100dvh; width: 100%;
    font-family: var(--font); font-size: calc(18px * var(--text-scale));
    background: var(--bg); color: var(--fg);
    transition: background 0.3s, color 0.3s;
    overflow-x: hidden;
}
button, input, textarea, select { font-family: var(--font); font-size: inherit; outline: none; border: none; background: transparent; color: inherit; }
svg.ic { width: 24px; height: 24px; min-width: 24px; fill: currentColor; display: block; flex-shrink: 0; }
a { color: var(--accent); text-decoration: none; }

/* General UI Components matching Chat */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.btn {
    display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
    padding: 10px 16px; border-radius: 12px; border: 2px solid var(--accent);
    background: var(--accent); color: #fff; cursor: pointer; transition: 0.15s; font-size: 1.1rem;
}
.btn:hover:not(:disabled) { background: var(--accent-hover); transform: scale(1.02); box-shadow: var(--shadow-sm); }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn.sec { background: transparent; border-color: var(--border); color: var(--fg); }
.btn.sec:hover:not(:disabled) { background: var(--section-bg); border-color: var(--fg2); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.icon-btn {
    color: var(--fg2); padding: 8px; cursor: pointer; border-radius: 12px; transition: 0.2s;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.icon-btn:hover { background: var(--section-bg); color: var(--fg); }
.icon-btn.active { color: var(--accent); background: rgba(187,0,30,0.1); }

.input-field {
    width: 100%; padding: 12px 16px; border-radius: 12px; border: 2px solid var(--border);
    background: var(--input-bg); color: var(--fg); margin-bottom: 12px; transition: 0.2s;
}
.input-field:focus { border-color: var(--accent); box-shadow: 0 0 12px var(--accent-glow); }

.search-box { position: relative; display: flex; align-items: center; width: 100%; margin-bottom: 16px; }
.search-box svg.ic { position: absolute; left: 14px; width: 20px; height: 20px; fill: var(--fg2); pointer-events: none; }
.search-box input { padding-left: 44px; margin-bottom: 0; }

.pill-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.pill { 
    background: var(--pill-bg); border: 2px solid transparent; border-radius: 50px; 
    padding: 6px 16px; cursor: pointer; color: var(--fg2); transition: 0.2s; 
    display: inline-flex; align-items: center; justify-content: center; font-size: 1rem; 
}
.pill:hover { background: var(--section-border); color: var(--fg); }
.pill.active { background: var(--accent); color: #fff; box-shadow: 0 2px 10px rgba(187,0,30,0.3); }

/* App Specific Layout */
#appShell {
    max-width: 1200px; margin: 0 auto; padding: 24px 20px 80px; position: relative;
    display: flex; flex-direction: column; min-height: 100dvh;
}

#controls-btn {
    position: fixed; top: 20px; right: 20px; z-index: 200; background: var(--ctrl-bg); color: var(--fg);
    border: 2px solid var(--ctrl-border); border-radius: 50%; width: 50px; height: 50px;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    transition: 0.2s ease; box-shadow: var(--shadow-sm); overflow: hidden; padding: 0;
}
#controls-btn:hover { border-color: var(--accent); transform: translateY(-2px) scale(1.05); box-shadow: var(--shadow); }
#controls-btn img { width: 100%; height: 100%; object-fit: cover; }
#controls-btn .fallback-initial { font-size: 1.5rem; font-weight: bold; }

.page-header { text-align: center; margin-bottom: 32px; animation: slideUp 0.3s ease; }
.page-header h1 { font-size: 2.8rem; margin: 0 0 8px; line-height: 1.1; }
.page-header h1 span { color: var(--accent); }
.page-header p { color: var(--fg2); font-size: 1.2rem; max-width: 600px; margin: 0 auto; }

/* User Grid & Cards */
.user-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px;
    animation: fadeIn 0.4s ease;
}

.user-card {
    background: var(--section-bg); border: 2px solid var(--border); border-radius: 16px;
    padding: 16px; display: flex; flex-direction: column; gap: 12px; transition: 0.2s;
    cursor: pointer; position: relative; overflow: hidden;
}
.user-card:hover { background: var(--pill-bg); border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow-sm); }
.user-card.wide { grid-column: 1 / -1; flex-direction: row; align-items: center; padding: 20px; border-color: var(--accent); background: rgba(187, 0, 30, 0.05); margin-bottom: 12px;}

.c-av {
    width: 60px; height: 60px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    position: relative; flex-shrink: 0; background: var(--pill-bg); border: 2px solid var(--border);
    font-size: 1.8rem; font-weight: bold; color: var(--fg); overflow: hidden;
}
.c-av img { width: 100%; height: 100%; object-fit: cover; }
.user-card.wide .c-av { width: 80px; height: 80px; font-size: 2.5rem; border-color: var(--accent); }

.status-dot {
    position: absolute; bottom: -2px; right: -2px; width: 16px; height: 16px;
    border-radius: 50%; border: 3px solid var(--bg); background: var(--fg2); z-index: 2;
}
.status-dot.online { background: #22c55e; box-shadow: 0 0 8px rgba(34, 197, 94, 0.6); }

.u-info { flex: 1; min-width: 0; }
.u-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 2px; }
.u-name { font-size: 1.3rem; color: var(--fg); font-weight: bold; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
.u-username { font-size: 1rem; color: var(--fg2); font-family: var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card.wide .u-name { font-size: 1.8rem; }
.user-card.wide .u-username { font-size: 1.1rem; }

/* Badges */
.owner-badge { background: #9333ea; color: #ffffff; padding: 2px 6px; border-radius: 6px; font-weight: bold; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; display:inline-block; vertical-align:middle; cursor: pointer; transition: transform 0.15s; box-shadow: 0 0 10px rgba(147, 51, 234, 0.4); }
.owner-badge:hover { transform: scale(1.05); }

.admin-badge { background: #dc2626; color: #ffffff; padding: 2px 6px; border-radius: 6px; font-weight: bold; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; display:inline-block; vertical-align:middle; cursor: pointer; transition: transform 0.15s; }
.admin-badge:hover { transform: scale(1.05); }

.mod-badge { background: rgba(234, 179, 8, 0.2); color: #facc15; border: 1px solid #eab308; padding: 2px 6px; border-radius: 6px; font-weight: bold; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; display:inline-block; vertical-align:middle; cursor: pointer; transition: transform 0.15s; }
.mod-badge:hover { transform: scale(1.05); }

.dev-badge {
    width: 18px; height: 18px; background: #3f3f46; border: 1px solid #71717a;
    transform: rotate(45deg); display: inline-flex; align-items: center; justify-content: center;
    vertical-align: middle; cursor: pointer; flex-shrink: 0; transition: transform 0.15s; border-radius: 3px;
}
.dev-badge:hover { transform: rotate(45deg) scale(1.1); }
.dev-badge svg { transform: rotate(-45deg); width: 11px; height: 11px; fill: #ffffff; }

.dev-badge-large {
    width: 54px; height: 54px; background: #3f3f46; border: 2px solid #71717a;
    transform: rotate(45deg); display: flex; align-items: center; justify-content: center;
    border-radius: 8px; margin-bottom: 20px; box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}
.dev-badge-large svg { transform: rotate(-45deg); width: 28px; height: 28px; fill: #ffffff; }

.verified-icon { width: 18px; height: 18px; fill: #3b82f6; cursor: pointer; display: inline-block; vertical-align: middle; transition: transform 0.15s;}
.verified-icon:hover { transform: scale(1.1); }

/* Full Screen Profile View */
#profileView {
    position: fixed; inset: 0; background: var(--bg); z-index: 1000;
    display: none; flex-direction: column; overflow-y: auto; overflow-x: hidden;
    animation: fadeIn 0.3s ease;
}

#profileView.show { display: flex; }

.pv-header {
    position: sticky; top: 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border); padding: 12px 20px; display: flex;
    align-items: center; justify-content: space-between; z-index: 10;
}
.pv-header-title { font-size: 1.4rem; font-weight: bold; }

.pv-content {
    max-width: 600px; width: 100%; margin: 0 auto; padding: 32px 20px;
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: 16px;
}
.pv-avatar {
    width: 120px; height: 120px; border-radius: 50%; background: var(--pill-bg);
    border: 4px solid var(--accent); font-size: 3.5rem; font-weight: bold; color: var(--fg);
    display: flex; align-items: center; justify-content: center; overflow: hidden;
    box-shadow: 0 8px 24px var(--accent-glow); margin-bottom: 8px; position: relative;
}
.pv-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pv-name-row { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.pv-name { font-size: 2.2rem; font-weight: bold; line-height: 1.1; }
.pv-username { font-size: 1.2rem; color: var(--fg2); font-family: var(--font-mono); margin-bottom: 12px; }

.pv-actions { display: flex; gap: 12px; width: 100%; max-width: 400px; margin: 12px 0; }

.pv-tabs {
    display: flex; width: 100%; border-bottom: 2px solid var(--border); margin-top: 16px;
}
.pv-tab {
    flex: 1; background: none; border: none; padding: 14px 10px; color: var(--fg2);
    font-size: 1.2rem; font-weight: bold; cursor: pointer; transition: 0.2s;
    border-bottom: 3px solid transparent; margin-bottom: -2px; font-family: var(--font);
}
.pv-tab:hover { color: var(--fg); background: var(--section-bg); }
.pv-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.pv-tab span { display: block; font-size: 1.5rem; color: var(--fg); line-height: 1; margin-bottom: 4px; }

.pv-tab-content { width: 100%; padding: 24px 0; text-align: left; }
.pv-pane { display: none; animation: fadeIn 0.3s ease; }
.pv-pane.active { display: block; }

.pv-bio { font-size: 1.1rem; color: var(--fg2); line-height: 1.6; text-align: center; white-space: pre-wrap; }
.pv-bio strong { color: var(--fg); }

/* List inside profile (Followers/Following) */
.user-list-item {
    display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--section-bg);
    border: 1px solid var(--section-border); border-radius: 12px; margin-bottom: 10px;
    cursor: pointer; transition: 0.2s;
}
.user-list-item:hover { border-color: var(--accent); transform: translateX(4px); }
.uli-av { width: 44px; height: 44px; font-size: 1.2rem; border-width: 1px; }

/* Modals matching Chat */
.overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(4px);
    display: none; align-items: center; justify-content: center; z-index: 5000;
    animation: fadeIn 0.2s ease;
}
.overlay.show { display: flex; }
.modal-card {
    background: var(--bg); border: 2px solid var(--accent); border-radius: 20px;
    padding: 24px; width: min(440px, 92vw); max-height: 90vh; overflow-y: auto;
    box-shadow: var(--shadow); animation: slideUp 0.25s cubic-bezier(0.2,0.8,0.2,1);
    display: flex; flex-direction: column;
}
.modal-card h2 { font-size: 1.6rem; margin: 0 0 12px; color: var(--fg); line-height: 1.2; }
.modal-card p { font-size: 1.1rem; color: var(--fg2); margin: 0 0 20px; line-height: 1.5; }

/* Toast */
#toastContainer {
    position: fixed; top: 20px; right: 20px; 
    background: var(--accent); color: #fff; padding: 12px 24px; border-radius: 12px;
    box-shadow: var(--shadow); display: flex; align-items: center; gap: 12px;
    font-size: 1.1rem; z-index: 9500; 
    transform: translateX(150%); opacity: 0; 
    transition: transform 0.4s cubic-bezier(0.2,1,0.2,1), opacity 0.4s, background 0.3s;
    cursor: pointer; pointer-events: none; max-width: 90vw;
}
#toastContainer.show { transform: translateX(0); opacity: 1; pointer-events: auto; }
#toastContainer.error { background: #ef4444; border: 1px solid #dc2626; }
#toastContainer.success { background: #22c55e; border: 1px solid #16a34a; }

.state-container { text-align: center; padding: 60px 20px; color: var(--fg2); font-size: 1.2rem; }
.spinner { width: 40px; height: 40px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 16px; }
@keyframes spin { to { transform: rotate(360deg); } }
