@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root { 
    --bg-page: #FAFAFA; 
    --bg-card: #FFFFFF;
    --text-main: #111111; 
    --text-muted: #888888;
    --border: #EAEAEA; 
    --accent: #000000; 
    --hover: #F5F5F5;
    --radius: 6px;
    /* Golden colors */
    --gold-text: #BF9B30;
    --gold-glow: rgba(191, 155, 48, 0.4);
}
body.dark-mode { 
    --bg-page: #000000; 
    --bg-card: #0A0A0A;
    --text-main: #EEEEEE; 
    --text-muted: #666666;
    --border: #222222; 
    --accent: #FFFFFF; 
    --hover: #1A1A1A;
    /* Adjust gold for dark mode to be brighter */
    --gold-text: #F2C94C;
    --gold-glow: rgba(242, 201, 76, 0.5);
}

body { 
    margin: 0; padding: 0; 
    background-color: var(--bg-page); color: var(--text-main); 
    font-family: 'Inter', system-ui, sans-serif; 
    display: flex; flex-direction: column; height: 100vh; 
    overflow: hidden; 
}

::-webkit-scrollbar { display: none; }
* { -ms-overflow-style: none; scrollbar-width: none; box-sizing: border-box; }

/* Rico God Mode - Golden Text with breathing glow */
.owner-name {
    color: var(--gold-text);
    font-weight: 700;
    text-shadow: 0 0 8px var(--gold-glow);
    animation: gold-breathe 3s ease-in-out infinite;
}

@keyframes gold-breathe {
    0%, 100% { text-shadow: 0 0 6px var(--gold-glow); }
    50% { text-shadow: 0 0 15px var(--gold-glow); }
}

.topbar { 
    display: flex; justify-content: space-between; align-items: center; 
    padding: 0 40px; height: 60px; border-bottom: 1px solid var(--border); 
    background: var(--bg-card); z-index: 100; flex-shrink: 0;
}
.logo { font-size: 18px; font-weight: 700; color: var(--text-main); text-decoration: none; letter-spacing: -0.5px;}

.badge-icon { margin-left: 4px; font-size: 13px; }
.fi { margin-left: 6px; border-radius: 2px; }

.search-container { position: relative; flex-grow: 1; max-width: 350px; margin: 0 30px; }
#find-writers-input { 
    width: 100%; background: var(--bg-page); color: var(--text-main); border: 1px solid var(--border); 
    padding: 8px 12px; border-radius: var(--radius); font-size: 13px; outline: none; transition: border 0.2s; 
    font-family: 'Inter', sans-serif;
}
#find-writers-input:focus { border-color: var(--text-muted); }
#search-results { 
    position: absolute; top: calc(100% + 4px); left: 0; width: 100%; 
    background: var(--bg-card); border: 1px solid var(--border); 
    border-radius: var(--radius); max-height: 300px; overflow-y: auto; display: none; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.05); z-index: 1000; 
}
.search-item { padding: 12px; cursor: pointer; border-bottom: 1px solid var(--border); font-size: 13px; display: flex; justify-content: space-between; }
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--hover); }

.header-right { display: flex; align-items: center; gap: 8px; }
.stat-badge { font-size: 12px; font-weight: 500; padding: 6px 10px; background: var(--bg-page); border: 1px solid var(--border); border-radius: var(--radius); }

.btn { 
    background: var(--bg-card); border: 1px solid var(--border); font-family: inherit; font-size: 13px; font-weight: 500; color: var(--text-main);
    cursor: pointer; padding: 8px 14px; border-radius: var(--radius); transition: all 0.15s ease; 
}
.btn:hover { background: var(--hover); }
.btn-primary { background: var(--accent); color: var(--bg-page); border-color: var(--accent); }
.btn-primary:hover { opacity: 0.85; background: var(--accent); }
.icon-btn { padding: 8px; font-size: 14px; border-color: transparent; background: transparent; }
.icon-btn:hover { background: var(--hover); border-color: var(--border); }

#follow-btn.following { background: transparent; color: var(--text-main); border-color: var(--border); }

.layout-grid { 
    display: grid; grid-template-columns: 240px 1fr 240px; flex-grow: 1; 
    max-width: 1400px; margin: 0 auto; width: 100%; overflow: hidden; padding: 20px; gap: 20px;
}

.sidebar { overflow-y: auto; display: flex; flex-direction: column; gap: 20px; }
.sidebar-section { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 15px; }
.sidebar-section h4 { margin: 0 0 12px 0; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

.leaderboard-list { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.leaderboard-list li { margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.lb-user-container { display: flex; align-items: center; cursor: pointer; color: var(--text-main); }
.lb-user-container:hover { text-decoration: underline; }
.lb-score { font-weight: 500; font-size: 12px; color: var(--text-muted); }
.empty-state { color: var(--text-muted); font-size: 13px; font-style: italic; }

.main-column { display: flex; flex-direction: column; gap: 15px; overflow: hidden; }

/* Custom Banner */
.room-banner { width: 100%; height: 160px; background-size: cover; background-position: center; border-radius: var(--radius); display: none; border: 1px solid var(--border); flex-shrink: 0; }

.editor-toolbar { 
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); 
    padding: 8px 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; flex-shrink: 0;
}
.editor-toolbar select, .editor-toolbar input[type=range] { margin: 0; padding: 6px; font-size: 12px; border: 1px solid var(--border); border-radius: 4px; background: var(--bg-page); color: var(--text-main); outline: none; font-family: inherit; }

.editor-card { 
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); 
    padding: 40px 60px; flex-grow: 1; overflow-y: auto; 
}
textarea, #viewer { 
    width: 100%; height: 100%; border: none; resize: none; outline: none; 
    font-size: 18px; line-height: 1.8; background-color: transparent; color: inherit; 
    font-family: 'Georgia', serif; overflow-wrap: break-word; 
}
#viewer { display: none; }
#viewer p { margin-top: 0; margin-bottom: 1.5em; }

.hero-section { text-align: center; padding: 40px 0; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.hero-section h1 { font-size: 32px; font-weight: 700; margin: 0 0 10px 0; letter-spacing: -1px; }
.hero-section p { color: var(--text-muted); font-size: 15px; max-width: 500px; margin: 0 auto 20px auto; line-height: 1.5; }
.global-stats { font-size: 12px; color: var(--text-muted); margin-top: 20px; background: var(--bg-page); padding: 8px 16px; border-radius: var(--radius); display: inline-block; }

.pulse-item { padding: 12px; border: 1px solid var(--border); margin-bottom: 8px; border-radius: var(--radius); display: flex; justify-content: space-between; cursor: pointer; background: var(--bg-card); transition: border 0.1s; }
.pulse-item:hover { border-color: var(--text-muted); }

#reaction-bar { 
    position: fixed; bottom: 30px; right: 30px; display: flex; gap: 5px; 
    background: var(--bg-card); padding: 6px; border-radius: var(--radius); 
    border: 1px solid var(--border); box-shadow: 0 4px 12px rgba(0,0,0,0.05); z-index: 100; display: none; 
}
.reaction-btn { background: var(--bg-page); border: 1px solid var(--border); font-size: 18px; cursor: pointer; border-radius: 4px; padding: 6px 10px; transition: 0.1s; }
.reaction-btn:hover { background: var(--border); }
.reaction-btn:active { transform: scale(0.95); }
.floating-reaction { position: fixed; bottom: 80px; font-size: 24px; pointer-events: none; animation: floatUp 2s ease-out forwards; z-index: 99; }
@keyframes floatUp { 0% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-100px); } }

.modal { 
    display: none; position: absolute; background: var(--bg-card); border: 1px solid var(--border); 
    box-shadow: 0 10px 30px rgba(0,0,0,0.08); border-radius: var(--radius); z-index: 200; padding: 20px; 
}
.center-modal { top: 50%; left: 50%; transform: translate(-50%, -50%); width: 360px; }
.modal-title { margin: 0 0 15px 0; font-size: 14px; font-weight: 600; border-bottom: 1px solid var(--border); padding-bottom: 10px; }

.modal input[type="text"], .modal input[type="password"], .modal select, .modal textarea { 
    width: 100%; padding: 10px 12px; margin-bottom: 12px; border: 1px solid var(--border); 
    background: var(--bg-page); color: var(--text-main); border-radius: var(--radius); font-family: inherit; font-size: 13px; outline: none;
}
.modal input:focus, .modal textarea:focus { border-color: var(--text-muted); }
.modal label { font-size: 12px; font-weight: 500; margin-bottom: 6px; display: block; color: var(--text-muted); }

.menu-list { list-style: none; padding: 0; margin: 0; }
.menu-item { padding: 10px 12px; cursor: pointer; font-size: 13px; font-weight: 500; border-radius: 4px; margin-bottom: 2px;}
.menu-item:hover { background: var(--hover); }

.scroll-list { list-style: none; padding: 0; margin: 0; max-height: 350px; overflow-y: auto; }
.notif-badge { position: absolute; top: -5px; right: -5px; background: var(--accent); color: var(--bg-page); border-radius: 50%; padding: 2px 6px; font-size: 10px; font-weight: bold; pointer-events: none; }

.chat-modal { right: 30px; bottom: 80px; width: 320px; padding: 0; display: flex; flex-direction: column; }
.chat-header, .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 15px; border-bottom: 1px solid var(--border); background: var(--bg-page); border-radius: var(--radius) var(--radius) 0 0; }
.chat-history { height: 250px; overflow-y: auto; padding: 15px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.chat-input-area { padding: 12px; border-top: 1px solid var(--border); display: flex; gap: 8px; }
.chat-input-area input { margin: 0; }

.pm-bubble { padding: 8px 12px; border-radius: var(--radius); max-width: 85%; word-wrap: break-word; line-height: 1.4; }
.pm-sent { align-self: flex-end; background: var(--text-main); color: var(--bg-page); }
.pm-received { align-self: flex-start; background: var(--bg-page); border: 1px solid var(--border); }

.library-modal { top: 50px; left: 50%; transform: translateX(-50%); width: 90%; max-width: 600px; padding: 0; }
.library-reader { top: 40px; left: 50%; transform: translateX(-50%); width: 95%; max-width: 800px; height: 85vh; display: none; padding: 0; }
.reader-content { padding: 40px 60px; overflow-y: auto; flex-grow: 1; font-size: 18px; line-height: 1.7; font-family: 'Georgia', serif; }
.library-item { padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; cursor: pointer; transition: all 0.2s; background: var(--bg-page); }
.library-item:hover { border-color: var(--text-muted); }
.lib-title { font-weight: 600; font-size: 14px; display: block; margin-bottom: 4px; }
.lib-date { font-size: 12px; color: var(--text-muted); }
.lib-delete { color: #f43f5e; font-size: 12px; float: right; cursor: pointer; border: none; background: none; font-weight: 500; padding: 4px; }

#poll-widget { background: var(--bg-page); border: 1px solid var(--border); border-radius: var(--radius); padding: 15px; margin-bottom: 20px; display: none; }
.poll-question { font-weight: 600; font-size: 13px; margin: 0 0 12px 0; }
.poll-option-btn { width: 100%; text-align: left; background: var(--bg-card); border: 1px solid var(--border); padding: 10px 12px; margin-bottom: 8px; border-radius: var(--radius); cursor: pointer; font-size: 12px; transition: border 0.2s; position: relative; overflow: hidden; font-weight: 500; color: var(--text-main); }
.poll-option-btn:hover { border-color: var(--text-muted); }
.poll-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--border); z-index: 1; transition: width 0.5s ease; }
.poll-text-wrapper { position: relative; z-index: 2; display: flex; justify-content: space-between; }
.poll-meta { font-size: 11px; color: var(--text-muted); text-align: right; margin-top: 10px; }

.color-picker { height: 40px; padding: 0; border: none; cursor: pointer; background: transparent; width: 100%; border-radius: var(--radius); overflow: hidden; }
.bio-text { font-size: 13px; color: var(--text-muted); line-height: 1.5; margin: 0 0 15px 0; word-wrap: break-word; }

.admin-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.admin-table th, .admin-table td { text-align: left; padding: 10px; border-bottom: 1px solid var(--border); }
.admin-table th { background: var(--bg-page); font-weight: 500; color: var(--text-muted); }
.admin-table input[type="text"] { padding: 6px; margin: 0; font-size: 12px; border: 1px solid var(--border); width: 100%; font-family: inherit;}

@media (max-width: 1100px) {
    .layout-grid { grid-template-columns: 1fr 240px; }
    #sidebar-left { display: none; } 
}
@media (max-width: 800px) {
    .layout-grid { grid-template-columns: 1fr; }
    #sidebar-right { display: none; }
    .editor-card { padding: 20px; }
    .topbar { padding: 0 20px; }
    .search-container { display: none; }
    .room-banner { height: 120px; }
}
