/* bernX - YoYo-Style Dark Theme */

:root {
    /* Dark theme colors - Red/White style */
    --color-primary: #f8fafc;
    --color-primary-hover: #e2e8f0;
    --color-primary-light: #ffffff;
    --color-accent: #06b6d4;
    --color-success: #10b981;
    --color-error: #ef4444;
    --color-warning: #f59e0b;

    /* Dark red backgrounds */
    --bg-darkest: #1a0505;      /* Main content area - very dark red */
    --bg-dark: #2e0a0a;          /* Panels, sidebar - dark red */
    --bg-darker: #4a1010;        /* Header, navigation - medium dark red */
    --bg-panel: #2e0a0a;         /* Panel background - dark red */

    /* Text colors - White */
    --text-primary: #ffffff;     /* Pure white */
    --text-secondary: #f1f5f9;   /* Light gray */
    --text-muted: #cbd5e1;       /* Muted gray */

    /* Borders */
    --border-color: #5a1818;
    --border-accent: #f8fafc;
    --border-radius: 6px;

    /* Shadows */
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 0 2px rgba(248, 250, 252, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-darkest);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #2e0a0a 0%, #1a0505 100%);
}

.login-card {
    background: var(--bg-dark);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.login-header .subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.login-form {
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    transition: all 0.2s;
    background: var(--bg-darkest);
    color: var(--text-primary);
}

.form-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--shadow-glow);
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-error);
    padding: 12px;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
    font-size: 0.9rem;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* App Layout - YoYo Style */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--bg-darkest);
}

/* Top Header */
.app-header {
    background: var(--bg-darker);
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.app-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-logo .icon {
    font-size: 1.8rem;
}

.app-logo h1 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
}

.app-user-info {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.user-info-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    cursor: pointer;
    transition: all 0.2s;
    padding: 6px 10px;
    border-radius: 4px;
}

.user-info-text:hover {
    background: rgba(248, 250, 252, 0.1);
}

.user-info-text:hover .user-name {
    color: var(--color-primary-light);
}

.app-user-info .user-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.app-user-info .user-name::after {
    content: '▼';
    font-size: 0.7rem;
    opacity: 0.7;
}

.app-user-info .user-role {
    display: none;
}

/* User Dropdown Menu - YoYo Style */
.user-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    min-width: 200px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    z-index: 1000;
}

.user-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 0.9rem;
}

.user-dropdown-menu-item:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.user-dropdown-menu-item:first-child {
    border-top-left-radius: var(--border-radius);
    border-top-right-radius: var(--border-radius);
}

.user-dropdown-menu-item:last-child {
    border-bottom-left-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
}

.user-dropdown-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

/* Navigation Tabs - Horizontal */
.app-navigation {
    background: var(--bg-darker);
    padding: 0 24px;
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border-color);
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    font-weight: 500;
    position: relative;
}

.nav-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
    color: var(--color-primary-light);
    border-bottom-color: var(--color-primary);
    background: rgba(248, 250, 252, 0.1);
}

.nav-tab .icon {
    font-size: 1.1rem;
}

/* Main Content Area */
.app-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Left Sidebar for Controls */
.app-sidebar {
    width: 280px;
    background: var(--bg-dark);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    overflow-y: auto;
}

.sidebar-panel {
    background: var(--bg-panel);
    border: 2px solid var(--border-accent);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.sidebar-panel h3 {
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 16px;
    font-weight: 600;
}

.sidebar-panel label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 8px;
    font-weight: 500;
}

.sidebar-panel select,
.sidebar-panel input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-darkest);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 0.95rem;
    margin-bottom: 12px;
    transition: all 0.2s;
}

.sidebar-panel select:focus,
.sidebar-panel input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--shadow-glow);
}

.sidebar-panel .info-text {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
    margin-top: 8px;
}

/* Main Content */
.app-main {
    flex: 1;
    background: var(--bg-darkest);
    overflow-y: auto;
    padding: 24px;
}

/* Main Content without padding for chat */
.app-main:has(.chat-container) {
    padding: 0;
    overflow: hidden;
}

/* Buttons - Dark Theme */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    box-shadow: 0 0 12px rgba(248, 250, 252, 0.4);
}

.btn-secondary {
    background: var(--bg-darker);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-danger {
    background: var(--color-error);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-success {
    background: var(--color-success);
    color: white;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Old sidebar layout compatibility */
.sidebar {
    width: 260px;
    background: var(--bg-dark);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-md);
    border-right: 1px solid var(--border-color);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
    font-size: 1.5rem;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--color-primary);
    color: white;
    border-left: 3px solid var(--color-primary-light);
}

.nav-item .icon {
    margin-right: 12px;
    font-size: 1.2rem;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 1.2rem;
}

.user-details {
    flex: 1;
}

.user-name {
    font-weight: 500;
    margin-bottom: 2px;
}

.user-role {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.main-content {
    flex: 1;
    overflow: auto;
    background: var(--bg-darkest);
}

/* Chat - Full height layout */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.chat-header {
    padding: 20px 30px;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.chat-header h3 {
    color: var(--text-primary);
}

.chat-actions {
    display: flex;
    gap: 10px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    background: var(--bg-darkest);
    min-height: 0;
}

.welcome-message {
    max-width: 600px;
    margin: 40px auto;
    text-align: center;
    color: var(--text-secondary);
}

.welcome-message h2 {
    margin-bottom: 15px;
    color: var(--color-primary-light);
}

.welcome-message ul {
    text-align: left;
    margin: 20px auto;
    max-width: 400px;
    color: var(--text-secondary);
}

.welcome-message code {
    background: var(--bg-dark);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: var(--color-primary-light);
}

.hint {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.message {
    margin-bottom: 20px;
    display: flex;
    gap: 12px;
}

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: var(--bg-darker);
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: var(--border-radius);
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.message.user .message-content {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

/* Chat Tables - Professional styling */
.message-content .table-wrapper {
    overflow-x: auto;
    margin: 12px 0;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.message-content .chat-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-darkest);
    font-size: 0.9rem;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.message-content .chat-table thead {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
    color: white;
}

.message-content .chat-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--color-primary-light);
}

.message-content .chat-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s;
}

.message-content .chat-table tbody tr:nth-child(even) {
    background: rgba(248, 250, 252, 0.03);
}

.message-content .chat-table tbody tr:hover {
    background: rgba(248, 250, 252, 0.08);
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(248, 250, 252, 0.15);
}

/* Clickable rows */
.message-content .chat-table tbody tr.clickable-row {
    cursor: pointer;
    transition: all 0.2s ease;
}

.message-content .chat-table tbody tr.clickable-row:hover {
    background: rgba(248, 250, 252, 0.12);
    transform: scale(1.02);
    box-shadow: 0 3px 10px rgba(248, 250, 252, 0.25);
}

.message-content .chat-table tbody tr.clickable-row:active {
    transform: scale(0.99);
    background: rgba(248, 250, 252, 0.2);
}

.message-content .chat-table td {
    padding: 10px 16px;
    color: var(--text-secondary);
    vertical-align: middle;
}

.message-content .chat-table tbody tr:last-child {
    border-bottom: none;
}

/* Numeric columns - right align and monospace */
.message-content .chat-table td:has(> *:only-child:is([data-numeric])) {
    text-align: right;
    font-family: 'Courier New', monospace;
    font-weight: 500;
}

/* User message tables - adjust colors */
.message.user .chat-table {
    background: rgba(255, 255, 255, 0.1);
}

.message.user .chat-table thead {
    background: rgba(255, 255, 255, 0.2);
}

.message.user .chat-table th {
    color: white;
    border-bottom-color: rgba(255, 255, 255, 0.3);
}

.message.user .chat-table td {
    color: rgba(255, 255, 255, 0.95);
}

.message.user .chat-table tbody tr {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.message.user .chat-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.05);
}

.message.user .chat-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.15);
}

.chat-input-container {
    padding: 20px 30px;
    background: var(--bg-dark);
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.chat-form {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chat-form textarea {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 0.95rem;
    resize: none;
    max-height: 150px;
    background: var(--bg-darkest);
    color: var(--text-primary);
}

.chat-form textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--shadow-glow);
}

.send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
}

.send-btn:hover {
    background: var(--color-primary-hover);
    box-shadow: 0 0 12px rgba(248, 250, 252, 0.5);
}

.system-message {
    padding: 12px;
    margin: 12px 0;
    background: rgba(248, 250, 252, 0.1);
    border-left: 4px solid var(--color-primary);
    border-radius: var(--border-radius);
    color: var(--color-primary-light);
    font-size: 14px;
}

/* Database Page */
.database-container, .admin-container {
    padding: 30px;
}

.database-container h2,
.admin-container h2 {
    color: var(--text-primary);
    margin-bottom: 24px;
}

.db-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.db-description {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.db-stats {
    display: flex;
    gap: 12px;
}

.stat-badge {
    display: inline-block;
    padding: 8px 16px;
    background-color: var(--bg-dark);
    color: var(--text-secondary);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    border: 1px solid var(--border-color);
}

.stat-badge.active {
    background-color: rgba(248, 250, 252, 0.2);
    color: var(--color-primary-light);
    border-color: var(--color-primary);
}

.databases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.db-card {
    background: var(--bg-dark);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.db-card:hover {
    border-color: var(--color-primary);
    box-shadow: 0 4px 12px rgba(248, 250, 252, 0.2);
    transform: translateY(-2px);
}

.db-card.active {
    border-color: var(--color-primary);
    background-color: rgba(248, 250, 252, 0.1);
}

.db-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.db-checkbox {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: var(--color-primary);
}

.db-label {
    display: flex;
    gap: 12px;
    flex: 1;
    cursor: pointer;
    align-items: flex-start;
}

.db-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.db-info {
    flex: 1;
}

.db-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 16px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.db-meta {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
}

.badge-type {
    display: inline-block;
    padding: 2px 8px;
    background-color: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.badge-default {
    display: inline-block;
    padding: 2px 8px;
    background-color: rgba(251, 191, 36, 0.2);
    color: #fcd34d;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.db-host {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 4px;
}

.db-card .db-description {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.db-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

.loading, .empty-message, .error-message {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    font-size: 16px;
}

.error-message {
    color: var(--color-error);
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--border-radius);
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: var(--border-radius);
    color: white;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    z-index: 10000;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-success {
    background-color: var(--color-success);
}

.notification-error {
    background-color: var(--color-error);
}

/* Admin Page */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-dark);
    padding: 24px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    text-align: center;
    border: 1px solid var(--border-color);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-primary-light);
    margin-bottom: 8px;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.admin-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    padding: 12px 24px;
    background: transparent;
    border: none;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--color-primary-light);
    border-bottom-color: var(--color-primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.tab-header h3 {
    color: var(--text-primary);
}

.items-list {
    margin-top: 20px;
}

.item-card {
    background: var(--bg-dark);
    padding: 16px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 12px;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: default;
}

.item-card:hover {
    border-color: var(--color-primary);
}

.item-info {
    flex: 1;
}

.item-name {
    font-weight: 600;
    font-size: 1.05rem;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.item-details {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.item-stats {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 4px;
}

/* Scrollbar styling for dark theme */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-darkest);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-darker);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-color);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease-out;
}

.modal-overlay.show {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal {
    background: var(--bg-dark);
    border-radius: var(--border-radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: var(--text-primary);
    font-size: 1.2rem;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-form .form-group {
    margin-bottom: 20px;
}

.modal-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.modal-form input,
.modal-form select,
.modal-form textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-darkest);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.2s;
}

.modal-form input:focus,
.modal-form select:focus,
.modal-form textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--shadow-glow);
}

.modal-form textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.modal-form .checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-form .checkbox-group input[type="checkbox"] {
    width: auto;
}

.modal-form .form-hint {
    display: block;
    margin-top: 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

.modal-form .checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.modal-form .checkbox-label input[type="checkbox"] {
    width: auto;
    cursor: pointer;
    accent-color: var(--color-primary);
}

.modal-form .checkbox-label span {
    color: var(--text-primary);
}

/* Item card actions */
.item-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    padding: 6px 10px;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Settings Page */
.settings-form {
    max-width: 900px;
}

.settings-section {
    background: var(--bg-dark);
    padding: 24px;
    border-radius: var(--border-radius);
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

.settings-section-title {
    color: var(--text-primary);
    font-size: 1.1rem;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.settings-form .form-group {
    margin-bottom: 20px;
}

.settings-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.settings-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.settings-form input,
.settings-form select,
.settings-form textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-darkest);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.2s;
}

.settings-form input:focus,
.settings-form select:focus,
.settings-form textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--shadow-glow);
}

.settings-form textarea {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

.settings-form .form-hint {
    display: block;
    margin-top: 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

.settings-actions {
    display: flex;
    gap: 12px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 2px solid var(--border-color);
}

.settings-form label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-refresh {
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    color: var(--text-primary);
}

.btn-refresh:hover {
    background: var(--border-color);
    transform: rotate(90deg);
}

.btn-refresh:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-refresh.spinning {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Typing indicator */
.typing-indicator {
    color: var(--text-muted);
    font-style: italic;
}

.typing-indicator::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% {
        content: '.';
    }
    40% {
        content: '..';
    }
    60%, 100% {
        content: '...';
    }
}

/* Chart Visualization Styles */

/* Chart fullscreen modal */
.chart-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 3000;
    animation: fadeIn 0.3s ease-out;
}

.chart-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.chart-modal-content {
    background: var(--bg-dark);
    border-radius: var(--border-radius);
    width: 95%;
    max-width: 1400px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    border: 1px solid var(--border-color);
}

.chart-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.chart-modal-header h3 {
    color: var(--text-primary);
    margin: 0;
    font-size: 1.2rem;
}

.chart-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.chart-modal-close:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.chart-modal-body {
    flex: 1;
    padding: 20px;
    overflow: auto;
}

/* Fullscreen button for charts */
.chart-fullscreen-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(248, 250, 252, 0.2);
    border: 1px solid var(--color-primary);
    color: var(--color-primary-light);
    padding: 6px 12px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
    z-index: 100;
    opacity: 0.7;
}

.chart-fullscreen-btn:hover {
    background: rgba(248, 250, 252, 0.4);
    opacity: 1;
    transform: scale(1.1);
}

/* Chart container styling */
.chart-container {
    position: relative;
    background: var(--bg-darkest);
    border-radius: var(--border-radius);
    padding: 16px;
    margin: 16px 0;
    border: 1px solid var(--border-color);
}

/* Chart insights box */
.chart-insights {
    margin-top: 16px;
    padding: 16px;
    background: rgba(248, 250, 252, 0.1);
    border-left: 4px solid var(--color-primary);
    border-radius: var(--border-radius);
}

.insights-header {
    font-weight: 600;
    color: var(--color-primary-light);
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.insights-content {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Chart error styling */
.chart-error {
    padding: 24px;
    text-align: center;
    color: var(--color-error);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--border-radius);
}

.chart-error span {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.chart-error small {
    display: block;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Responsive chart sizing */
@media (max-width: 768px) {
    .chart-modal-content {
        width: 100%;
        height: 100vh;
        border-radius: 0;
    }

    .chart-fullscreen-btn {
        font-size: 1rem;
        padding: 4px 8px;
    }
}
