/* --- GLOBAL STYLES --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --bg-sidebar: rgba(15, 23, 42, 0.8);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
    --accent: #10b981;
    --accent-hover: #059669;
    --logs-height: 0px;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
    --radius-md: 12px;
    --radius-lg: 16px;

    /* Semantic Default (Dark) */
    --bg-gradient-start: #1e1b4b;
    --bg-gradient-end: #0f172a;
    --bg-chat-main: rgba(15, 23, 42, 0.6);
    --bg-header: rgba(30, 41, 59, 0.8);
    --bg-input: rgba(30, 41, 59, 0.8);
    --bg-input-focus: rgba(15, 23, 42, 0.8);
}

[data-theme="light"] {
    /* Backgrounds */
    --bg-dark: #f1f5f9;
    /* Slate-100 */
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-sidebar: #ffffff;

    /* Text */
    --text-main: #0f172a;
    /* Slate-900 */
    --text-muted: #64748b;
    /* Slate-500 */

    /* Borders & Shadows */
    --border-color: #cbd5e1;
    /* Slate-300 */
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 15px rgba(99, 102, 241, 0.2);

    /* Semantic Light */
    --bg-gradient-start: #e2e8f0;
    --bg-gradient-end: #f8fafc;
    --bg-chat-main: rgba(255, 255, 255, 0.6);
    --bg-header: rgba(255, 255, 255, 0.9);
    --bg-input: #ffffff;
    --bg-input-focus: #f8fafc;

    /* Interactive Elements */
    --nav-hover-bg: #f1f5f9;
    --nav-hover-text: #334155;
    --nav-active-text: #ffffff;
    --scrollbar-track: transparent;
    --scrollbar-thumb: #cbd5e1;
    --scrollbar-thumb-hover: #94a3b8;
}

[data-theme="dark"] {
    --nav-hover-bg: rgba(255, 255, 255, 0.08);
    --nav-hover-text: #ffffff;
    --scrollbar-track: rgba(15, 23, 42, 0.5);
    --scrollbar-thumb: rgba(100, 116, 139, 0.5);
    --scrollbar-thumb-hover: rgba(100, 116, 139, 0.8);

    /* Dark theme specific overrides for inputs */
    --bg-input-dark: #1e293b;
    --text-input: #e2e8f0;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    overflow: hidden;
    background: var(--bg-dark);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
}

/* Background Animation */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(circle at 50% 50%, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    overflow: hidden;
}

.blob {
    position: absolute;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    filter: blur(80px);
    opacity: 0.3;
    border-radius: 50%;
    animation: float 10s infinite ease-in-out;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(30px, -30px);
    }
}

.app-container {
    display: flex;
    height: calc(100vh - var(--logs-height));
    width: 100vw;
    backdrop-filter: blur(10px);
}

/* --- SIDEBAR NAVIGATION --- */
.main-sidebar {
    width: 80px;
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0;
    border-right: 1px solid var(--border-color);
    z-index: 100;
    flex-shrink: 0;
}

.sidebar-logo {
    font-size: 10px;
    font-weight: 800;
    margin-bottom: 32px;
    text-align: center;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    padding: 0 16px;
}

.nav-item {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 12px;
    width: 100%;
    border-radius: 16px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item:hover {
    color: var(--nav-hover-text);
    background: var(--nav-hover-bg);
    transform: translateY(-2px);
}

.nav-item.active {
    color: var(--nav-active-text);
    background: var(--primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.nav-item .icon {
    font-size: 24px;
    line-height: 1;
}

.nav-item span {
    font-size: 10px;
    font-weight: 500;
}

.sidebar-footer {
    margin-top: auto;
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
    padding-bottom: 16px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    margin: 0 auto 6px;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.status-indicator.online {
    background: var(--accent);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

/* --- VIEW SECTIONS --- */
.view-section {
    display: none;
    flex: 1;
    height: 100%;
    overflow: hidden;
    animation: fadeIn 0.3s ease;
}

.view-section.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- CHATS VIEW STYLES --- */
.chats-sidebar {
    width: 380px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.chats-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.chats-header h2 {
    margin: 0 0 16px 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
}

.header-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.refresh-btn {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.refresh-btn:hover {
    background: var(--nav-hover-bg);
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

.chat-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #475569, #334155);
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    font-size: 14px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.online-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: var(--accent);
    border: 2px solid #1e293b;
    border-radius: 50%;
    display: none;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.chat-item.online .online-badge {
    display: block;
}

.chat-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.chat-name {
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
}

.chat-preview {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    min-width: 60px;
}

.unread-badge {
    background: var(--primary);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 99px;
    min-width: 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.main-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-chat-main);
    position: relative;
}

.chat-main-header {
    padding: 16px 24px;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(10px);
}

.chat-title h3 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
}

.chat-status {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.model-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 12px;
    outline: none;
    background: var(--bg-header);
    color: var(--text-main);
    cursor: pointer;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 24px 24px;
}

.message {
    max-width: 70%;
    padding: 16px;
    border-radius: 20px;
    font-size: 14px;
    line-height: 1.6;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.message.in {
    align-self: flex-start;
    background: var(--bg-input);
    border-bottom-left-radius: 4px;
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.message.out {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.message-time {
    font-size: 10px;
    margin-top: 6px;
    opacity: 0.7;
    text-align: right;
    display: block;
}

.input-area {
    padding: 24px;
    background: var(--bg-header);
    border-top: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
}

.ai-controls {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.ai-btn {
    background: linear-gradient(135deg, #818cf8, #a855f7);
    /* Brighter gradient */
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    /* Larger padding */
    border-radius: 99px;
    font-size: 13px;
    /* Larger font */
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
    /* Neon glow */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.ai-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(139, 92, 246, 0.6);
    background: linear-gradient(135deg, #a78bfa, #c084fc);
}



.input-wrapper {
    display: flex;
    gap: 12px;
}

textarea {
    flex: 1;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    resize: none;
    height: 80px;
    /* Taller input */
    outline: none;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s;
    background: var(--bg-input);
    color: var(--text-main);
}

textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
    background: var(--bg-input-focus);
}

.send-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 0 24px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.send-btn:hover {
    background: var(--primary);
    color: white;
}

/* --- RIGHT PANEL --- */
.right-panel {
    width: 340px;
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    gap: 24px;
}

.panel-section h3 {
    margin: 0 0 12px 0;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.prompt-editor {
    width: 100%;
    height: 150px;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    resize: vertical;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    line-height: 1.6;
    background: var(--bg-input);
    color: var(--text-main);
    transition: all 0.2s;
}

.prompt-editor:focus {
    border-color: var(--primary);
    outline: none;
    background: var(--bg-input-focus);
}

.sm-btn {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.2s;
}

.sm-btn:hover {
    background: var(--nav-hover-bg);
    color: var(--text-main);
}

.sm-btn.save {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent);
    border-color: rgba(16, 185, 129, 0.2);
}

.sm-btn.save:hover {
    background: var(--accent);
    color: white;
}

.logs-container {
    flex: 1;
    background: #0f172a;
    color: #4ade80;
    padding: 16px;
    border-radius: var(--radius-md);
    font-family: 'Consolas', monospace;
    font-size: 11px;
    line-height: 1.5;
    overflow-y: auto;
    height: 200px;
    border: 1px solid var(--border-color);
}

/* --- BROADCAST VIEW STYLES --- */
.broadcast-container {
    padding: 32px;
    width: 100%;
    height: 100%;
    overflow-y: auto;
}

.broadcast-header h2 {
    color: white;
    font-size: 28px;
}

.card {
    background: rgba(30, 41, 59, 0.6);
    padding: 32px;
    border-radius: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
}

.form-group label {
    color: var(--text-muted);
}

.form-group textarea {
    height: 300px;
    width: 100%;
}

.form-group textarea,
.form-group select {
    background: rgba(15, 23, 42, 0.6);
    color: white;
    border-color: var(--border-color);
}

.primary-btn {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
    padding: 14px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    width: 100%;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.5);
}

.logs-console {
    background: #0f172a;
    border: 1px solid var(--border-color);
}

/* Table Styles */
.clients-table th {
    background: rgba(30, 41, 59, 0.8);
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.clients-table td {
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

textarea {
    flex: 1;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    resize: none;
    height: 80px;
    /* Taller input */
    outline: none;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s;
    background: var(--bg-input);
    /* Lighter background */
    color: white;
}

textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
    background: var(--bg-input-focus);
}

.send-btn {
    background: var(--primary);
    /* Use primary color */
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0 32px;
    /* Wider button */
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.send-btn:hover {
    background: white;
    color: var(--bg-dark);
}

/* --- RIGHT PANEL --- */
.right-panel {
    width: 340px;
    background: rgba(30, 41, 59, 0.4);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    gap: 24px;
}

.panel-section h3 {
    margin: 0 0 12px 0;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.prompt-editor {
    width: 100%;
    height: 150px;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    resize: vertical;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    line-height: 1.6;
    background: rgba(15, 23, 42, 0.8);
    color: #a5b4fc;
    transition: all 0.2s;
}

.prompt-editor:focus {
    border-color: var(--primary);
    outline: none;
}

.sm-btn {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.2s;
}

.sm-btn:hover {
    background: var(--nav-hover-bg);
    color: var(--text-main);
}

.sm-btn.save {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent);
    border-color: rgba(16, 185, 129, 0.2);
}

.sm-btn.save:hover {
    background: var(--accent);
    color: white;
}

.logs-container {
    flex: 1;
    background: var(--bg-dark);
    color: #4ade80;
    padding: 16px;
    border-radius: var(--radius-md);
    font-family: 'Consolas', monospace;
    font-size: 11px;
    line-height: 1.5;
    overflow-y: auto;
    height: 200px;
    border: 1px solid var(--border-color);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--bg-card);
    margin: 5% auto;
    padding: 30px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 90%;
    max-width: 1000px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content h3 {
    color: var(--text-main);
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 24px;
}

.close {
    color: var(--text-muted);
    float: right;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.close:hover,
.close:focus {
    color: var(--text-main);
}

.details-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.details-table th,
.details-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.details-table th {
    background: var(--bg-header);
    color: var(--text-muted);
    font-weight: 600;
    position: sticky;
    top: 0;
}

.details-table td {
    color: var(--text-main);
}

/* Modal Styles Duplicate Removal (if necessary, keeping logic consistent) */
/* Assuming the CSS file had duplicated sections, cleaning up here or just updating both */

.details-table tr:hover {
    background: var(--nav-hover-bg);
}

/* Small Button Styles (Duplicate block in file but updating just in case) */
.sm-btn {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-main);
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-block;
}

.sm-btn:hover {
    background: var(--nav-hover-bg);
    border-color: var(--border-color);
    transform: translateY(-1px);
}

.sm-btn:active {
    transform: translateY(0);
}

/* Global Logs Panel */
.global-logs-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.global-logs-panel.collapsed {
    transform: translateY(calc(100% - 40px));
}

.global-logs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    cursor: pointer;
    user-select: none;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.global-logs-header:hover {
    background: var(--nav-hover-bg);
}

.global-logs-header span {
    color: var(--text-main);
    font-weight: 600;
    font-size: 14px;
}

.global-logs-content {
    max-height: 300px;
    overflow-y: auto;
    padding: 15px 20px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    line-height: 1.6;
}

.log-entry {
    padding: 4px 0;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.log-entry:last-child {
    border-bottom: none;
}

.log-entry.error {
    color: #ef4444;
}

.log-entry.success {
    color: #22c55e;
}

.log-entry.warning {
    color: #f59e0b;
}

.log-entry.system {
    color: #6366f1;
}

/* --- Chat Header Link --- */
.chat-header-link {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s;
    max-width: 100%;
    display: block;
}

.chat-header-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* ========================================
   HELP SECTION STYLES (Moved from help.html)
   ======================================== */
.help-section {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 25px 30px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.help-section h2 {
    color: var(--primary);
    margin-bottom: 20px;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.help-section h3 {
    color: var(--text-muted);
    margin: 20px 0 10px;
    font-size: 1rem;
}

.help-section p {
    color: var(--text-main);
    margin-bottom: 15px;
    line-height: 1.6;
}

.help-section ul,
.help-section ol {
    margin-left: 20px;
    margin-bottom: 15px;
}

.help-section li {
    color: var(--text-main);
    margin-bottom: 8px;
}

.help-section code {
    background: var(--bg-input);
    padding: 3px 8px;
    border-radius: 5px;
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--primary);
    border: 1px solid var(--border-color);
}

.help-section table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

.help-section th,
.help-section td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.help-section th {
    color: var(--text-muted);
    font-weight: 600;
}

.help-section td {
    color: var(--text-main);
}

.help-tip {
    background: rgba(16, 185, 129, 0.1);
    padding: 12px 18px;
    border-radius: 10px;
    margin: 15px 0;
    color: var(--accent);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.help-warning {
    background: rgba(245, 158, 11, 0.1);
    padding: 12px 18px;
    border-radius: 10px;
    margin: 15px 0;
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* ====================================
   SCROLLBAR STYLES
   ==================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track, transparent);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb, rgba(100, 116, 139, 0.5));
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover, rgba(100, 116, 139, 0.8));
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb, rgba(100, 116, 139, 0.5)) var(--scrollbar-track, transparent);
}

.payment-provider-card {
    background: #0f172a;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #334155;
}

/* ====================================
   LIGHT THEME FIXES
   ==================================== */

/* Admin Panel - Cards and backgrounds */
[data-theme="light"] #view-admin .card {
    background: rgba(255, 255, 255, 0.95) !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Admin Panel - darker fonts in light theme */
[data-theme="light"] #view-admin .card,
[data-theme="light"] #view-admin .data-table td,
[data-theme="light"] #view-admin h3,
[data-theme="light"] #view-admin h4,
[data-theme="light"] #view-admin label,
[data-theme="light"] #view-admin p,
[data-theme="light"] #view-admin span {
    color: #1e293b !important;
}

[data-theme="light"] #view-admin .data-table {
    background: #ffffff;
}

[data-theme="light"] #view-admin .data-table th {
    color: #475569 !important;
    background: #f8fafc !important;
    border-bottom: 2px solid #e2e8f0 !important;
}

[data-theme="light"] #view-admin .data-table td {
    border-bottom: 1px solid #e2e8f0 !important;
}

[data-theme="light"] #view-admin .data-table tr:hover {
    background: #f1f5f9 !important;
}

[data-theme="light"] #view-admin .form-hint,
[data-theme="light"] #view-admin small {
    color: #64748b !important;
}

/* Admin panel inputs in light theme */
[data-theme="light"] #view-admin select,
[data-theme="light"] #view-admin input[type="text"],
[data-theme="light"] #view-admin input[type="password"],
[data-theme="light"] #view-admin input[type="number"],
[data-theme="light"] #view-admin textarea {
    background: #ffffff !important;
    color: #1e293b !important;
    border-color: #cbd5e1 !important;
}

[data-theme="light"] #view-admin select:focus,
[data-theme="light"] #view-admin input:focus,
[data-theme="light"] #view-admin textarea:focus {
    border-color: #6366f1 !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15) !important;
}

[data-theme="light"] #view-admin select option {
    background: #ffffff;
    color: #1e293b;
}

/* Admin badges should keep contrast */
[data-theme="light"] #view-admin .badge-role {
    color: white !important;
}

/* Admin modal in light theme */
[data-theme="light"] .modal-content {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
}

[data-theme="light"] .modal-content h3,
[data-theme="light"] .modal-content label,
[data-theme="light"] .modal-content p {
    color: #1e293b !important;
}

/* Support messages container in admin */
[data-theme="light"] #support-messages-container {
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
}

[data-theme="light"] #support-reply-text {
    background: #ffffff !important;
    color: #1e293b !important;
    border-color: #cbd5e1 !important;
}

/* Telegram links remain blue */
[data-theme="light"] #view-admin a[href*="t.me"] {
    color: #3b82f6 !important;
}

/* Code and monospace elements */
[data-theme="light"] #view-admin code {
    background: #f1f5f9 !important;
    color: #1e293b !important;
}

/* Toggle switch slider background */
[data-theme="light"] .toggle-switch .slider {
    background-color: #cbd5e1;
}

[data-theme="light"] .toggle-switch input:checked+.slider {
    background-color: #22c55e;
}

/* Help - darker fonts in light theme */
[data-theme="light"] #view-help,
[data-theme="light"] .help-container,
[data-theme="light"] .help-container h1,
[data-theme="light"] .help-container h2,
[data-theme="light"] .help-container h3,
[data-theme="light"] .help-container h4,
[data-theme="light"] .help-container p,
[data-theme="light"] .help-container li,
[data-theme="light"] .help-container td,
[data-theme="light"] .help-container th {
    color: #1e293b !important;
}

[data-theme="light"] .help-container th {
    color: #475569 !important;
    background: rgba(241, 245, 249, 0.9) !important;
}

/* Profile - Prompt Manager select should be light in light theme */
[data-theme="light"] #prompt-file-select,
[data-theme="light"] #view-profile select,
[data-theme="light"] #view-profile input[type="text"],
[data-theme="light"] #view-profile input[type="password"],
[data-theme="light"] #view-profile textarea {
    background: #ffffff !important;
    color: #1e293b !important;
    border-color: #cbd5e1 !important;
}

[data-theme="light"] #view-profile select option {
    background: #ffffff;
    color: #1e293b;
}

/* OAuth status badge in light theme */
[data-theme="light"] #oauth-status-badge {
    background: #f1f5f9 !important;
}

[data-theme="light"] #oauth-status-text {
    color: #1e293b !important;
}

/* Payment provider cards in light theme */
[data-theme="light"] .payment-provider-card,
[data-theme="light"] [class*="payment-card"] {
    background: #f8fafc !important;
    border-color: #e2e8f0 !important;
}

[data-theme="light"] .payment-provider-card label,
[data-theme="light"] .payment-provider-card input {
    color: #1e293b !important;
}

/* Button colors should stay vibrant */
[data-theme="light"] .btn-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6) !important;
    color: white !important;
}

/* --- TARIFF MODAL STYLES --- */
.tariff-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.tariff-card {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    display: flex;
    flex-direction: column;
}

.tariff-card:hover {
    background: rgba(45, 55, 72, 0.6);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.tariff-card.business {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.tariff-card.premium {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

.tariff-badge {
    position: absolute;
    top: -10px;
    right: 15px;
    background: var(--primary);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.4);
}

.tariff-card h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: var(--text-main);
}

.tariff-price {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--text-main);
}

.tariff-price span {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
}

.tariff-features {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
}

.tariff-features li {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: flex;
    gap: 6px;
}

/* Centered Modal Utility */
.modal.modal-centered {
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.modal.modal-centered .modal-content {
    margin: 0;
    max-width: 500px;
    /* Smaller width for simple forms */
    max-height: 90vh;
    animation: modalScaleIn 0.2s ease;
}

@keyframes modalScaleIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}