/**
 * LeCastle Bot - Modern Dark UI
 * Clean, minimal, professional
 */

/* ==========================================
   CSS VARIABLES
   ========================================== */
:root {
    /* Colors */
    --bg-0: #08080a;
    --bg-1: #0c0c0f;
    --bg-2: #111115;
    --bg-3: #16161b;
    --bg-hover: #1c1c22;
    --bg-active: #222228;

    --border-1: #1a1a1f;
    --border-2: #252530;
    --border-3: #303040;

    --text-1: #f5f5f7;
    --text-2: #a0a0ab;
    --text-3: #6b6b76;
    --text-4: #45454d;

    --accent: #8b5cf6;
    --accent-hover: #7c3aed;
    --accent-dim: rgba(139, 92, 246, 0.12);

    --green: #22c55e;
    --green-dim: rgba(34, 197, 94, 0.12);
    --red: #ef4444;
    --red-dim: rgba(239, 68, 68, 0.12);
    --yellow: #eab308;
    --yellow-dim: rgba(234, 179, 8, 0.12);
    --blue: #3b82f6;
    --blue-dim: rgba(59, 130, 246, 0.12);

    /* Layout */
    --sidebar-w: 320px;
    --header-h: 56px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* Animation */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --duration: 150ms;
}

/* ==========================================
   RESET
   ========================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-1);
    background: var(--bg-0);
    -webkit-font-smoothing: antialiased;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

input, textarea, select {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    background: var(--bg-1);
    border: 1px solid var(--border-1);
    border-radius: var(--radius);
    outline: none;
    transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}

input:focus, textarea:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

input::placeholder, textarea::placeholder {
    color: var(--text-4);
}

/* ==========================================
   SCROLLBAR
   ========================================== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-3);
}

/* ==========================================
   APP LAYOUT
   ========================================== */
.app {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ==========================================
   SIDEBAR
   ========================================== */
.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    height: 100vh;
    background: var(--bg-1);
    border-right: 1px solid var(--border-1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Sidebar Header */
.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-1);
}

.bot-profile {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.bot-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 20px;
    color: white;
    overflow: hidden;
}

.bot-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bot-info {
    flex: 1;
    min-width: 0;
}

.bot-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-1);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bot-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--text-3);
    margin-bottom: 4px;
}

.bot-balance {
    color: var(--yellow);
    font-weight: 500;
}

.bot-balance i {
    margin-right: 4px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--red);
}

.connection-status.online .status-indicator {
    background: var(--green);
    box-shadow: 0 0 6px var(--green);
}

.bot-location, .bot-time {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-3);
    margin-top: 2px;
}

.bot-location {
    cursor: pointer;
}

.bot-location:hover {
    color: var(--text-2);
}

.bot-location i {
    color: var(--accent);
}

.bot-time i {
    color: var(--blue);
}

.time-display {
    font-family: 'SF Mono', monospace;
    color: var(--text-1);
}

.time-zone {
    color: var(--text-4);
    font-size: 10px;
}

/* Action Bar */
.action-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}

.action-btn {
    width: 34px;
    height: 34px;
    border-radius: var(--radius);
    background: var(--bg-2);
    color: var(--text-3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration) var(--ease);
}

.action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-1);
}

.action-btn.danger:hover {
    background: var(--red-dim);
    color: var(--red);
}

/* Search Box */
.search-box {
    position: relative;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-4);
    font-size: 12px;
}

.search-box input {
    width: 100%;
    height: 36px;
    padding: 0 12px 0 36px;
    font-size: 13px;
}

/* Sidebar Navigation */
.sidebar-nav {
    display: flex;
    border-bottom: 1px solid var(--border-1);
}

.nav-tab {
    flex: 1;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-3);
    position: relative;
    transition: all var(--duration) var(--ease);
}

.nav-tab:hover {
    color: var(--text-2);
    background: var(--bg-hover);
}

.nav-tab.active {
    color: var(--accent);
}

.nav-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
}

.nav-tab .badge {
    position: absolute;
    top: 6px;
    right: calc(50% - 16px);
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 10px;
    font-weight: 600;
    background: var(--red);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Sidebar Panels */
.sidebar-panels {
    flex: 1;
    overflow: hidden;
}

.sidebar-panel {
    height: 100%;
    overflow-y: auto;
    display: none;
}

.sidebar-panel.active {
    display: block;
}

/* Panel Search */
.panel-search {
    padding: 12px;
    border-bottom: 1px solid var(--border-1);
    display: flex;
    gap: 8px;
}

.panel-search input {
    flex: 1;
    height: 36px;
    padding: 0 12px;
}

.search-btn {
    width: 36px;
    height: 36px;
    background: var(--accent);
    color: white;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-btn:hover {
    background: var(--accent-hover);
}

/* Lists */
.list {
    display: flex;
    flex-direction: column;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-4);
    text-align: center;
}

.empty-state i {
    font-size: 32px;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* Loading State */
.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px;
    color: var(--text-3);
}

/* Inventory */
.inventory-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid var(--border-1);
}

.inventory-path {
    flex: 1;
    font-size: 12px;
    color: var(--text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.back-btn, .refresh-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius);
    color: var(--text-3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-btn:hover, .refresh-btn:hover {
    background: var(--bg-hover);
    color: var(--text-1);
}

/* ==========================================
   CHAT AREA
   ========================================== */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-0);
    overflow: hidden;
}

/* Welcome Screen */
.welcome-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.welcome-content {
    text-align: center;
    color: var(--text-3);
}

.welcome-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: var(--radius-xl);
    background: var(--bg-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: var(--text-4);
}

.welcome-content h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-1);
    margin-bottom: 8px;
}

.welcome-content p {
    font-size: 14px;
}

/* Chat Container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Chat Header */
.chat-header {
    height: var(--header-h);
    min-height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: var(--bg-1);
    border-bottom: 1px solid var(--border-1);
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-lg);
    background: var(--bg-3);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 600;
    color: var(--text-2);
    overflow: hidden;
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-details {
    min-width: 0;
}

.chat-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-username {
    font-size: 12px;
    color: var(--text-3);
}

.chat-status {
    font-size: 12px;
    color: var(--green);
}

.chat-header-actions {
    display: flex;
    gap: 2px;
}

.header-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    color: var(--text-3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration) var(--ease);
}

.header-btn:hover {
    background: var(--bg-hover);
    color: var(--text-1);
}

.header-btn.danger:hover {
    background: var(--red-dim);
    color: var(--red);
}

/* Chat Search Bar */
.chat-search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-1);
    border-bottom: 1px solid var(--border-1);
}

.search-input-group {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-2);
    border-radius: var(--radius);
    padding: 0 12px;
    height: 36px;
}

.search-input-group i {
    color: var(--text-4);
    font-size: 12px;
}

.search-input-group input {
    flex: 1;
    border: none;
    background: none;
    height: 100%;
    padding: 0;
}

.search-input-group input:focus {
    box-shadow: none;
}

.search-count {
    font-size: 12px;
    color: var(--text-3);
    white-space: nowrap;
}

.search-nav {
    display: flex;
    gap: 4px;
}

.search-nav button {
    width: 28px;
    height: 28px;
    border-radius: var(--radius);
    color: var(--text-3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-nav button:hover {
    background: var(--bg-hover);
    color: var(--text-1);
}

.search-nav button.danger:hover {
    background: var(--red-dim);
    color: var(--red);
}

/* Messages Area */
.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 12px;
    color: var(--text-3);
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-3);
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

/* Input Area */
.input-area {
    padding: 16px;
    background: var(--bg-1);
    border-top: 1px solid var(--border-1);
}

.input-container {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--bg-2);
    border: 1px solid var(--border-1);
    border-radius: var(--radius-lg);
    padding: 8px;
    transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}

.input-container:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.message-input {
    flex: 1;
    min-height: 40px;
    max-height: 120px;
    padding: 8px 12px;
    border: none;
    background: none;
    resize: none;
    line-height: 1.4;
}

.message-input:focus {
    box-shadow: none;
}

.input-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    color: var(--text-3);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--duration) var(--ease);
}

.input-btn:hover {
    background: var(--bg-hover);
    color: var(--text-1);
}

.input-btn.send-btn {
    background: var(--accent);
    color: white;
}

.input-btn.send-btn:hover {
    background: var(--accent-hover);
}

/* ==========================================
   PANELS (Profile, Members)
   ========================================== */
.profile-panel, .members-panel {
    width: 320px;
    min-width: 320px;
    background: var(--bg-1);
    border-left: 1px solid var(--border-1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    height: var(--header-h);
    min-height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 1px solid var(--border-1);
}

.panel-header h3 {
    font-size: 15px;
    font-weight: 600;
}

.panel-header button {
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    color: var(--text-3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-header button:hover {
    background: var(--bg-hover);
    color: var(--text-1);
}

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.profile-avatar-large {
    width: 100px;
    height: 100px;
    margin: 0 auto 16px;
    border-radius: var(--radius-xl);
    background: var(--bg-3);
    overflow: hidden;
}

.profile-avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-name {
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 4px;
}

.profile-username {
    font-size: 14px;
    color: var(--text-3);
    text-align: center;
    margin-bottom: 16px;
}

.profile-info, .profile-actions {
    margin-top: 16px;
}

/* ==========================================
   MODALS
   ========================================== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 100;
}

.modal-content {
    background: var(--bg-1);
    border: 1px solid var(--border-1);
    border-radius: var(--radius-xl);
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-content.small { max-width: 400px; }
.modal-content.medium { max-width: 560px; }
.modal-content.large { max-width: 720px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-1);
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.modal-header button {
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    color: var(--text-3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-header button:hover {
    background: var(--bg-hover);
    color: var(--text-1);
}

.modal-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-1);
}

.modal-footer .footer-left {
    margin-right: auto;
}

.modal-footer .footer-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Warning Icon */
.warning-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: var(--red-dim);
    color: var(--red);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.warning-text {
    text-align: center;
    color: var(--text-2);
}

/* ==========================================
   BUTTONS
   ========================================== */
.btn {
    height: 36px;
    padding: 0 16px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all var(--duration) var(--ease);
}

.btn.primary {
    background: var(--accent);
    color: white;
}

.btn.primary:hover {
    background: var(--accent-hover);
}

.btn.secondary {
    background: var(--bg-2);
    color: var(--text-1);
}

.btn.secondary:hover {
    background: var(--bg-hover);
}

.btn.danger {
    background: var(--red);
    color: white;
}

.btn.danger:hover {
    background: #dc2626;
}

.btn.ghost {
    background: transparent;
    color: var(--text-2);
}

.btn.ghost:hover {
    background: var(--bg-hover);
    color: var(--text-1);
}

.btn.full-width {
    width: 100%;
}

/* ==========================================
   FORMS
   ========================================== */
.form-group {
    margin-bottom: 16px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
}

textarea.form-input {
    height: auto;
    min-height: 100px;
    padding: 12px;
    resize: vertical;
}

/* Toggle */
.toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--bg-3);
    border-radius: 12px;
    cursor: pointer;
    transition: background var(--duration) var(--ease);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform var(--duration) var(--ease);
}

.toggle input:checked + .toggle-slider {
    background: var(--accent);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* Checkbox */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-2);
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

/* ==========================================
   TOAST
   ========================================== */
#toast-container {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 16px;
    background: var(--bg-2);
    border: 1px solid var(--border-1);
    border-radius: var(--radius-lg);
    color: var(--text-1);
    font-size: 13px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    animation: slideIn 0.2s var(--ease);
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--blue); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ==========================================
   CONTEXT MENU
   ========================================== */
.context-menu {
    position: fixed;
    background: var(--bg-2);
    border: 1px solid var(--border-1);
    border-radius: var(--radius);
    padding: 4px;
    min-width: 160px;
    z-index: 150;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text-2);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
}

.context-menu-item:hover {
    background: var(--bg-hover);
    color: var(--text-1);
}

.context-menu-item.danger:hover {
    background: var(--red-dim);
    color: var(--red);
}

.context-menu-divider {
    height: 1px;
    background: var(--border-1);
    margin: 4px 0;
}

/* ==========================================
   BADGE
   ========================================== */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    font-size: 11px;
    font-weight: 600;
    background: var(--accent);
    color: white;
    border-radius: 9px;
}

.badge.small {
    min-width: 14px;
    height: 14px;
    padding: 0 4px;
    font-size: 10px;
}

/* ==========================================
   BULK MODAL SPECIFICS
   ========================================== */
.mode-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.mode-btn {
    flex: 1;
    height: 48px;
    border-radius: var(--radius);
    background: var(--bg-2);
    color: var(--text-2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all var(--duration) var(--ease);
}

.mode-btn:hover {
    background: var(--bg-hover);
}

.mode-btn.active {
    background: var(--accent-dim);
    color: var(--accent);
}

.bulk-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.bulk-tab {
    height: 32px;
    padding: 0 12px;
    border-radius: var(--radius);
    background: var(--bg-2);
    color: var(--text-2);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--duration) var(--ease);
}

.bulk-tab:hover {
    background: var(--bg-hover);
}

.bulk-tab.active {
    background: var(--accent);
    color: white;
}

.bulk-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.search-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.search-row input {
    flex: 1;
    height: 36px;
    padding: 0 12px;
}

.search-row button {
    width: 36px;
    height: 36px;
    background: var(--accent);
    color: white;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.message-container {
    margin-bottom: 16px;
}

.message-container label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    margin-bottom: 6px;
}

.message-container textarea {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    resize: vertical;
}

.selection-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--bg-2);
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 13px;
}

.progress-container {
    margin-bottom: 16px;
}

.progress-bar {
    height: 8px;
    background: var(--bg-3);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s var(--ease);
}

.status-text {
    font-size: 12px;
    color: var(--text-3);
}

.hint {
    font-size: 12px;
    color: var(--text-3);
    font-style: italic;
}

/* ==========================================
   SETTINGS
   ========================================== */
.settings-section {
    margin-bottom: 24px;
}

.settings-section h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--bg-2);
    border-radius: var(--radius);
    margin-bottom: 8px;
}

.scheduled-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 12px;
}

/* ==========================================
   MODERATION
   ========================================== */
.moderation-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
}

.mod-tab {
    flex: 1;
    height: 36px;
    border-radius: var(--radius);
    background: var(--bg-2);
    color: var(--text-2);
    font-size: 13px;
    transition: all var(--duration) var(--ease);
}

.mod-tab:hover {
    background: var(--bg-hover);
}

.mod-tab.active {
    background: var(--accent);
    color: white;
}

.mod-panel {
    max-height: 300px;
    overflow-y: auto;
}

/* ==========================================
   GROUP MODAL
   ========================================== */
.group-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
}

.group-tab {
    padding: 8px 16px;
    border-radius: var(--radius);
    background: var(--bg-2);
    color: var(--text-2);
    font-size: 13px;
    transition: all var(--duration) var(--ease);
}

.group-tab:hover {
    background: var(--bg-hover);
}

.group-tab.active {
    background: var(--accent);
    color: white;
}

.group-panel {
    min-height: 200px;
}

/* ==========================================
   NOTECARD
   ========================================== */
.notecard-content {
    white-space: pre-wrap;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    background: var(--bg-2);
    padding: 16px;
    border-radius: var(--radius);
    max-height: 400px;
    overflow: auto;
}

/* ==========================================
   TEXTURE
   ========================================== */
.texture-body {
    display: flex;
    align-items: center;
    justify-content: center;
}

.texture-body img {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: var(--radius);
}

/* ==========================================
   ATTACHMENT
   ========================================== */
.attachment-picker {
    display: flex;
    gap: 8px;
}

.attachment-picker input {
    flex: 1;
}

/* ==========================================
   MOBILE
   ========================================== */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 9999;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: #6366f1;
    color: white;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    font-size: 18px;
    cursor: pointer;
    border: none;
    -webkit-tap-highlight-color: transparent;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9000;
}

.sidebar-overlay.visible {
    display: block;
}

@media (max-width: 768px) {
    /* Show mobile menu button */
    .mobile-menu-btn {
        display: flex !important;
    }

    /* Hide sidebar by default - use display none, not transform */
    #sidebar {
        display: none !important;
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        bottom: 0 !important;
        width: 85vw !important;
        max-width: 320px !important;
        z-index: 9500 !important;
        background: var(--bg-1) !important;
    }

    /* Show sidebar when open */
    #sidebar.open {
        display: flex !important;
    }

    /* Chat area full width */
    .chat-area,
    #chat-area {
        width: 100% !important;
        flex: 1 !important;
    }

    /* Chat header padding for menu button */
    #chat-header {
        padding-left: 56px !important;
        padding-right: 8px !important;
    }

    /* Header buttons container - ensure clickable */
    #chat-header .flex.items-center.space-x-2 {
        position: relative !important;
        z-index: 100001 !important;
    }

    /* Chat header buttons - compact and touch-friendly */
    #chat-header .flex.items-center.space-x-2,
    #chat-header .chat-header-actions {
        gap: 2px !important;
        flex-shrink: 0 !important;
    }

    #chat-header .flex.items-center.space-x-2 button,
    #chat-header .chat-header-actions button {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        font-size: 13px !important;
        flex-shrink: 0 !important;
    }

    /* Hide less important buttons on mobile to save space */
    #clear-history-btn,
    #pin-btn,
    #add-friend-btn {
        display: none !important;
    }

    /* ========== NEARBY PANEL - MOBILE ========== */
    /* Hide nearby panel by default on mobile */
    #nearby-panel {
        display: none !important;
        position: fixed !important;
        right: 0 !important;
        top: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        z-index: 100000 !important;
        background: var(--bg-1) !important;
        border-left: none !important;
    }

    /* Show nearby panel when it doesn't have 'hidden' class (opened by JS) */
    #nearby-panel:not(.hidden) {
        display: flex !important;
    }

    /* ========== PROFILE & MEMBERS PANELS - MOBILE ========== */
    /* Hide panels by default - fullscreen overlay on mobile */
    .profile-panel,
    .members-panel,
    #profile-panel,
    #members-panel {
        display: none !important;
        position: fixed !important;
        right: 0 !important;
        top: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        z-index: 100000 !important;
        background: var(--bg-1) !important;
        border-left: none !important;
    }

    .profile-panel.open,
    .members-panel.open,
    .profile-panel:not(.hidden),
    .members-panel:not(.hidden),
    #profile-panel:not(.hidden),
    #members-panel:not(.hidden) {
        display: flex !important;
    }

    /* ========== MODAL ADJUSTMENTS ========== */
    .modal-content {
        max-width: calc(100vw - 24px) !important;
        max-height: calc(100vh - 24px) !important;
    }

    /* Fix all Tailwind modals on mobile */
    /* Modal overlays - ensure they are above everything */
    #pay-modal,
    #remove-friend-modal,
    #tp-offer-modal,
    #group-invite-modal,
    #settings-modal,
    #bulk-modal,
    #template-modal,
    #inventory-info-modal,
    #moderation-modal,
    #notecard-modal,
    #texture-modal,
    #share-modal,
    #my-group-modal,
    #notice-modal {
        z-index: 200000 !important;
        padding: 8px !important;
    }

    /* Modal inner content - full width on mobile */
    #pay-modal > div,
    #remove-friend-modal > div,
    #tp-offer-modal > div,
    #group-invite-modal > div,
    #settings-modal > div,
    #bulk-modal > div,
    #template-modal > div,
    #inventory-info-modal > div,
    #moderation-modal > div,
    #notecard-modal > div,
    #texture-modal > div,
    #share-modal > div,
    #my-group-modal > div,
    #notice-modal > div {
        max-width: calc(100vw - 16px) !important;
        max-height: calc(100vh - 16px) !important;
        margin: 0 !important;
        width: 100% !important;
        border-radius: 12px !important;
    }

    /* Bulk modal header buttons - stack on mobile */
    #bulk-modal .flex.items-center.space-x-2 {
        flex-wrap: wrap !important;
        gap: 4px !important;
    }

    /* Settings modal scroll */
    #settings-modal .max-h-\[60vh\] {
        max-height: calc(100vh - 120px) !important;
    }

    /* Bulk modal content area */
    #bulk-modal .max-h-\[90vh\] {
        max-height: calc(100vh - 16px) !important;
    }

    /* ========== INPUT AREA ========== */
    #input-area {
        padding: 8px 12px !important;
    }

    /* Sound toggle - hide text on mobile, keep icon */
    #input-area .text-xs.text-gray-500 {
        font-size: 0 !important;
    }

    /* ========== TOAST ========== */
    #toast-container {
        left: 12px !important;
        right: 12px !important;
        bottom: 80px !important;
    }

    .toast {
        width: 100% !important;
    }

    /* ========== MESSAGE BUBBLES ========== */
    .chat-message,
    .rounded-2xl.px-4.py-2 {
        max-width: 85% !important;
    }

    /* ========== iOS FIXES ========== */
    /* Prevent iOS zoom on input focus */
    #message-input,
    input[type="text"],
    textarea {
        font-size: 16px !important;
    }

    /* Safe area support for notched phones */
    #input-area {
        padding-bottom: max(8px, env(safe-area-inset-bottom)) !important;
    }

    /* ========== CONTEXT MENU ========== */
    .context-menu {
        max-width: calc(100vw - 24px) !important;
    }

    /* ========== MAIN FLEX LAYOUT ========== */
    /* Chat area should fill the screen on mobile */
    .flex.h-screen {
        position: relative !important;
    }

    #chat-area {
        min-width: 0 !important;
        width: 100vw !important;
    }

    /* ========== CHAT HEADER - MOBILE ========== */
    /* Make header buttons scrollable */
    #chat-header > .flex {
        flex-wrap: nowrap !important;
    }

    #chat-header .flex.items-center.space-x-2 {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        flex-wrap: nowrap !important;
        gap: 2px !important;
    }

    #chat-header .flex.items-center.space-x-2::-webkit-scrollbar {
        display: none !important;
    }

    /* Chat avatar smaller on mobile */
    #chat-avatar-container {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
    }

    #chat-header h2 {
        font-size: 14px !important;
        max-width: 100px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    #chat-header p {
        display: none !important;
    }

    /* ========== EMOJI PICKER - MOBILE ========== */
    #emoji-picker {
        width: calc(100vw - 24px) !important;
        max-width: 320px !important;
        right: -8px !important;
    }

    /* ========== MOBILE BACK BUTTON FOR PANELS ========== */
    .mobile-panel-back {
        display: flex !important;
    }

    /* ========== SEARCH BAR MOBILE ========== */
    #chat-search-bar .flex {
        flex-wrap: wrap !important;
        gap: 4px !important;
    }

    #chat-search-bar input {
        font-size: 16px !important; /* prevent iOS zoom */
    }

    /* ========== SIDEBAR OVERLAY ========== */
    .sidebar-overlay {
        z-index: 9400 !important;
    }
}

/* ==========================================
   UTILITY
   ========================================== */
.hidden {
    display: none !important;
}

.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mobile panel back button - hidden on desktop (uses max-width to not conflict with mobile) */
@media (min-width: 769px) {
    .mobile-panel-back {
        display: none !important;
    }
}

/* Prevent horizontal scroll */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* ==========================================
   TAILWIND OVERRIDES
   ========================================== */

/* Background colors */
.bg-dark-600 { background: var(--bg-3) !important; }
.bg-dark-700 { background: var(--bg-2) !important; }
.bg-dark-800 { background: var(--bg-1) !important; }
.bg-dark-900 { background: var(--bg-0) !important; }
.bg-dark-800\/50 { background: rgba(12, 12, 15, 0.5) !important; }
.bg-dark-700\/30 { background: rgba(17, 17, 21, 0.3) !important; }
.bg-dark-700\/50 { background: rgba(17, 17, 21, 0.5) !important; }

/* Border colors */
.border-dark-600 { border-color: var(--border-3) !important; }
.border-dark-700 { border-color: var(--border-2) !important; }
.border-gray-700 { border-color: var(--border-2) !important; }

/* Text colors */
.text-white { color: var(--text-1) !important; }
.text-gray-300 { color: var(--text-2) !important; }
.text-gray-400 { color: var(--text-2) !important; }
.text-gray-500 { color: var(--text-3) !important; }

/* Accent colors */
.text-accent-400, .text-accent-500 { color: var(--accent) !important; }
.bg-accent-500, .bg-accent-600, .bg-accent-700 { background: var(--accent) !important; }
.border-accent-500 { border-color: var(--accent) !important; }
.from-accent-500 { --tw-gradient-from: var(--accent) !important; }
.to-accent-700 { --tw-gradient-to: var(--accent-hover) !important; }

/* Status colors */
.bg-green-500, .bg-green-600 { background: var(--green) !important; }
.bg-red-500, .bg-red-600 { background: var(--red) !important; }
.bg-yellow-400, .bg-yellow-500 { background: var(--yellow) !important; }
.bg-blue-500, .bg-blue-600 { background: var(--blue) !important; }
.text-green-400, .text-green-500 { color: var(--green) !important; }
.text-red-400, .text-red-500 { color: var(--red) !important; }
.text-yellow-400, .text-yellow-500 { color: var(--yellow) !important; }
.text-blue-400, .text-blue-500 { color: var(--blue) !important; }

/* Hover states */
.hover\:bg-dark-700:hover { background: var(--bg-hover) !important; }
.hover\:bg-dark-600:hover { background: var(--bg-active) !important; }
.hover\:bg-accent-600:hover { background: var(--accent-hover) !important; }
.hover\:bg-green-600:hover { background: var(--green) !important; }
.hover\:bg-red-600:hover { background: var(--red) !important; }
.hover\:bg-blue-600:hover { background: var(--blue) !important; }
.hover\:bg-purple-600:hover { background: var(--accent) !important; }
.hover\:bg-yellow-600:hover { background: var(--yellow) !important; }
.hover\:text-white:hover { color: var(--text-1) !important; }
.hover\:text-gray-300:hover { color: var(--text-2) !important; }

/* Focus states */
.focus\:border-accent-500:focus { border-color: var(--accent) !important; }
.focus\:outline-none:focus { outline: none !important; }
.focus\:ring-accent-500:focus { box-shadow: 0 0 0 3px var(--accent-dim) !important; }

/* ==========================================
   EXISTING ELEMENTS OVERRIDE
   ========================================== */

/* Sidebar */
#sidebar, .w-80.bg-dark-800 {
    background: var(--bg-1) !important;
    border-right: 1px solid var(--border-1) !important;
}

/* Bot avatar ring */
#sidebar-bot-avatar {
    box-shadow: 0 0 0 2px var(--bg-1), 0 0 0 3px var(--accent);
}

/* Sidebar tabs */
#sidebar .flex.border-b button {
    border-bottom: 2px solid transparent;
    transition: all 150ms ease;
}

#sidebar .flex.border-b button.border-accent-500,
#sidebar .flex.border-b button.text-accent-400 {
    background: var(--accent-dim) !important;
    border-bottom-color: var(--accent) !important;
}

/* Conversation items */
#conversation-list > div,
#friends-list > div,
#groups-list > div {
    border-left: 3px solid transparent;
    transition: all 150ms ease;
}

#conversation-list > div:hover,
#friends-list > div:hover,
#groups-list > div:hover {
    background: var(--bg-hover) !important;
}

#conversation-list > div.active {
    background: var(--accent-dim) !important;
    border-left-color: var(--accent) !important;
}

/* Chat header */
#chat-header {
    background: var(--bg-1) !important;
    border-bottom: 1px solid var(--border-1) !important;
}

/* Chat header buttons */
#chat-header button {
    transition: all 150ms ease;
}

#chat-header button:hover {
    background: var(--bg-hover) !important;
}

/* Messages */
#messages {
    background: var(--bg-0) !important;
}

/* Chat message bubbles */
.rounded-2xl.px-4.py-2 {
    border-radius: var(--radius-lg) !important;
}

/* Input area */
#input-area {
    background: var(--bg-1) !important;
    border-top: 1px solid var(--border-1) !important;
}

#input-area .flex.items-end {
    background: var(--bg-2) !important;
    border: 1px solid var(--border-1) !important;
    border-radius: var(--radius-lg) !important;
}

#input-area .flex.items-end:focus-within {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px var(--accent-dim) !important;
}

/* Input field */
#input-area input,
#input-area textarea {
    background: transparent !important;
    border: none !important;
}

/* Modal styling */
[class*="fixed"][class*="inset-0"][class*="bg-black"] {
    background: rgba(0, 0, 0, 0.8) !important;
    backdrop-filter: blur(4px);
}

/* Modal content */
[class*="bg-dark-800"][class*="rounded"] {
    background: var(--bg-1) !important;
    border: 1px solid var(--border-1) !important;
}

/* Forms */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
textarea,
select {
    background: var(--bg-2) !important;
    border: 1px solid var(--border-1) !important;
    transition: all 150ms ease;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px var(--accent-dim) !important;
}

/* Buttons */
button.bg-accent-600,
button.bg-accent-500 {
    background: var(--accent) !important;
    transition: all 150ms ease;
}

button.bg-accent-600:hover,
button.bg-accent-500:hover {
    background: var(--accent-hover) !important;
}

/* Action buttons in sidebar header */
#sidebar .flex.gap-1 button {
    background: var(--bg-2) !important;
    border: 1px solid var(--border-1) !important;
    transition: all 150ms ease;
}

#sidebar .flex.gap-1 button:hover {
    background: var(--bg-hover) !important;
    border-color: var(--border-2) !important;
}

/* Online status glow */
.bg-green-500 {
    box-shadow: 0 0 6px var(--green);
}

/* Toast container */
#toast-container > div {
    background: var(--bg-2) !important;
    border: 1px solid var(--border-1) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
}

/* Context menu */
#inventory-context-menu {
    background: var(--bg-2) !important;
    border: 1px solid var(--border-1) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
}

/* ==========================================
   MOBILE FULLSCREEN MENU (MFM)
   Completely independent component
   ========================================== */

#mobile-fullscreen-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #0a0a0f;
    z-index: 999999;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#mobile-fullscreen-menu.open {
    display: flex;
}

/* MFM Header */
.mfm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #111118;
    border-bottom: 1px solid #222230;
    flex-shrink: 0;
}

.mfm-title {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

.mfm-close {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a1a25;
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.mfm-close:active {
    background: #252535;
}

/* MFM Bot Info */
.mfm-bot-info {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px;
    background: #111118;
    border-bottom: 1px solid #222230;
    flex-shrink: 0;
}

.mfm-bot-avatar {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fff;
    flex-shrink: 0;
    overflow: hidden;
}

.mfm-bot-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mfm-bot-details {
    flex: 1;
}

.mfm-bot-name {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
}

.mfm-bot-balance {
    font-size: 14px;
    color: #eab308;
}

.mfm-bot-balance i {
    margin-right: 6px;
}

/* MFM Navigation */
.mfm-nav {
    padding: 12px;
    flex-shrink: 0;
}

.mfm-nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 16px 18px;
    background: transparent;
    border: none;
    border-radius: 12px;
    color: #a0a0ab;
    font-size: 16px;
    text-align: left;
    cursor: pointer;
    margin-bottom: 4px;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.mfm-nav-item:active {
    background: #1a1a25;
}

.mfm-nav-item.active {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
}

.mfm-nav-item i {
    width: 24px;
    text-align: center;
    font-size: 18px;
}

.mfm-badge {
    position: absolute;
    right: 16px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: #ef4444;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* MFM Divider */
.mfm-divider {
    height: 1px;
    background: #222230;
    margin: 8px 20px;
    flex-shrink: 0;
}

/* MFM Actions */
.mfm-actions {
    padding: 12px;
    flex-shrink: 0;
}

.mfm-action-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 18px;
    background: #151520;
    border: 1px solid #222230;
    border-radius: 12px;
    color: #d0d0d8;
    font-size: 15px;
    text-align: left;
    cursor: pointer;
    margin-bottom: 8px;
    -webkit-tap-highlight-color: transparent;
}

.mfm-action-btn:active {
    background: #1a1a28;
}

.mfm-action-btn.danger {
    border-color: rgba(239, 68, 68, 0.3);
}

.mfm-action-btn.danger:active {
    background: rgba(239, 68, 68, 0.1);
}

.mfm-action-btn i {
    width: 24px;
    text-align: center;
    font-size: 16px;
}

/* MFM Footer */
.mfm-footer {
    margin-top: auto;
    padding: 16px 20px;
    background: #0d0d12;
    border-top: 1px solid #222230;
    color: #6b6b76;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.mfm-footer i {
    color: #8b5cf6;
}

/* Desktop: Hide mobile menu completely */
@media (min-width: 769px) {
    #mobile-fullscreen-menu {
        display: none !important;
    }
}

/* Volume Slider */
.volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 80px;
    height: 6px;
    background: rgba(255,255,255,0.15);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    vertical-align: middle;
    transition: background 0.2s;
}
.volume-slider:hover {
    background: rgba(255,255,255,0.25);
}
.volume-slider::-webkit-slider-runnable-track {
    height: 6px;
    background: rgba(255,255,255,0.15);
    border-radius: 3px;
}
.volume-slider:hover::-webkit-slider-runnable-track {
    background: rgba(255,255,255,0.25);
}
.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #a78bfa;
    cursor: pointer;
    margin-top: -4px;
    box-shadow: 0 0 8px rgba(139,92,246,0.5);
    border: 2px solid #c4b5fd;
}
.volume-slider::-webkit-slider-thumb:hover {
    background: #c4b5fd;
    box-shadow: 0 0 12px rgba(139,92,246,0.7);
    transform: scale(1.15);
}
.volume-slider::-moz-range-track {
    height: 6px;
    background: rgba(255,255,255,0.15);
    border-radius: 3px;
    border: none;
}
.volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #a78bfa;
    cursor: pointer;
    border: 2px solid #c4b5fd;
    box-shadow: 0 0 8px rgba(139,92,246,0.5);
}

/* PIN Lock Screen */
.pin-btn {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: #fff;
    font-size: 22px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.pin-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
}
.pin-btn:active {
    background: rgba(139,92,246,0.3);
    transform: scale(0.95);
}
.pin-dot.filled {
    background: #a78bfa;
    border-color: #a78bfa;
    box-shadow: 0 0 8px rgba(139,92,246,0.5);
}
@keyframes pin-shake {
    0%,100% { transform: translateX(0); }
    20%,60% { transform: translateX(-8px); }
    40%,80% { transform: translateX(8px); }
}
.pin-shake {
    animation: pin-shake 0.4s ease;
}

/* ============================================================
   MOBILE CHAT SCROLL FIX (2026-05-28)
   iOS Safari / Android Chrome 100vh, address bar nedeniyle browser
   yüksekliğini değiştiriyor. Bu yüzden #messages-wrapper inner
   scroll yapamıyor — kullanıcı eski mesajları göremiyor.
   Dynamic viewport height (dvh) ile parent kesin yükseklik alır,
   min-height: 0 ile flex çocuk küçülebilir, overflow scroll çalışır.
   ============================================================ */
@media (max-width: 768px) {
    /* Body globalde scroll'lanmasın — sadece iç container'lar scroll yapar */
    html, body {
        overflow: hidden;
        overscroll-behavior: none;
        height: 100%;
    }

    /* Ana flex wrapper'ı dynamic viewport'a sabitle */
    .flex.h-screen {
        height: 100dvh !important;
        max-height: 100dvh !important;
        min-height: 0 !important;
    }

    /* Chat-area flex column içinde min-height: 0 olmazsa flex çocukları (mesaj listesi)
       parent'ı genişletmeye çalışır → inner scroll yerine outer scroll oluşur. */
    #chat-area {
        min-height: 0 !important;
        max-height: 100dvh !important;
        overflow: hidden !important;
    }

    /* Asıl mesaj listesi — touch scroll + flex sıkıştırma */
    #messages-wrapper {
        flex: 1 1 0 !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior-y: contain !important;
    }

    /* Sidebar açıldığında 100dvh sabit */
    #sidebar {
        height: 100dvh !important;
    }
}
