/* LANChat - Main Stylesheet */
:root {
    --bg-primary: #0a0f1c;
    --bg-secondary: #0f172a;
    --bg-card: rgba(15, 23, 42, 0.8);
    --bg-input: rgba(30, 41, 59, 0.6);
    --border: rgba(148, 163, 184, 0.1);
    --border-focus: #3b82f6;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --sidebar-width: 260px;
    --topbar-height: 64px;
}

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

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.login-page::before {
    content: '';
    position: fixed;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(ellipse at 30% 20%, rgba(59,130,246,0.08) 0%, transparent 50%),
                radial-gradient(ellipse at 70% 80%, rgba(16,185,129,0.06) 0%, transparent 50%);
    z-index: 0;
}
.login-container { position: relative; z-index: 1; width: 100%; max-width: 420px; padding: 20px; }
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 48px 40px;
    backdrop-filter: blur(20px);
    box-shadow: 0 25px 60px rgba(0,0,0,0.4);
}
.logo { text-align: center; margin-bottom: 36px; }
.logo-icon {
    width: 56px; height: 56px;
    background: linear-gradient(135deg, var(--accent), var(--success));
    border-radius: 16px;
    display: inline-flex; align-items: center; justify-content: center;
    margin-bottom: 16px; font-size: 24px;
}
.logo h1 {
    font-size: 28px; font-weight: 700;
    background: linear-gradient(135deg, #e2e8f0, #94a3b8);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.logo p { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

/* Forms */
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block; font-size: 13px; font-weight: 500;
    color: var(--text-secondary); margin-bottom: 8px;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: inherit; font-size: 14px;
    outline: none; transition: all 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.form-group input::placeholder, .form-group textarea::placeholder { color: #475569; }
.form-group select option { background: var(--bg-secondary); color: var(--text-primary); }

/* Buttons */
.btn {
    padding: 10px 20px; border: none; border-radius: 10px;
    font-family: inherit; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: all 0.2s; display: inline-flex;
    align-items: center; gap: 8px; letter-spacing: 0.3px;
    text-decoration: none;
}
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-hover)); color: #fff; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(59,130,246,0.3); }
.btn-success { background: linear-gradient(135deg, var(--success), #059669); color: #fff; }
.btn-danger { background: linear-gradient(135deg, var(--danger), #dc2626); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-input); color: var(--text-primary); }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: 8px; }
.btn-full { width: 100%; justify-content: center; padding: 14px; }
.btn:active { transform: translateY(0); }

.error-msg {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.3);
    color: #fca5a5; padding: 12px 16px;
    border-radius: 10px; font-size: 14px;
    margin-bottom: 20px; text-align: center;
}
.success-msg {
    background: rgba(16,185,129,0.1);
    border: 1px solid rgba(16,185,129,0.3);
    color: #6ee7b7; padding: 12px 16px;
    border-radius: 10px; font-size: 14px;
    margin-bottom: 20px; text-align: center;
}

/* Admin Layout */
.admin-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0;
    z-index: 100;
}
.sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px;
}
.sidebar-header .mini-logo {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--accent), var(--success));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
}
.sidebar-header h2 { font-size: 18px; font-weight: 700; }
.sidebar-nav { flex: 1; padding: 16px 12px; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; border-radius: 10px;
    color: var(--text-secondary); text-decoration: none;
    font-size: 14px; font-weight: 500;
    transition: all 0.15s; margin-bottom: 4px;
}
.sidebar-nav a:hover { background: var(--bg-input); color: var(--text-primary); }
.sidebar-nav a.active { background: rgba(59,130,246,0.15); color: var(--accent); }
.sidebar-nav a .nav-icon { font-size: 18px; width: 24px; text-align: center; }
.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}
.sidebar-footer .user-info {
    display: flex; align-items: center; gap: 10px;
    font-size: 13px; color: var(--text-secondary);
}
.sidebar-footer .user-avatar {
    width: 32px; height: 32px; border-radius: 8px;
    background: var(--accent); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 14px;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px 40px;
}
.page-header {
    margin-bottom: 32px;
    display: flex; align-items: center; justify-content: space-between;
}
.page-header h1 { font-size: 26px; font-weight: 700; }
.page-header .breadcrumb { color: var(--text-muted); font-size: 13px; }

/* Cards & Tables */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    backdrop-filter: blur(10px);
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px; padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 16px; font-weight: 600; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left; padding: 12px 16px;
    font-size: 12px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--text-muted); border-bottom: 1px solid var(--border);
}
.data-table td {
    padding: 14px 16px; font-size: 14px;
    border-bottom: 1px solid rgba(148,163,184,0.05);
}
.data-table tr:hover td { background: rgba(59,130,246,0.03); }

.badge {
    display: inline-block; padding: 4px 10px;
    border-radius: 6px; font-size: 12px; font-weight: 600;
}
.badge-success { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.badge-danger { background: rgba(239,68,68,0.15); color: #fca5a5; }
.badge-info { background: rgba(59,130,246,0.15); color: #93c5fd; }

/* Stats Cards */
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px; margin-bottom: 32px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
}
.stat-card .stat-icon {
    font-size: 28px; margin-bottom: 12px;
}
.stat-card .stat-value {
    font-size: 32px; font-weight: 700;
    background: linear-gradient(135deg, #e2e8f0, #94a3b8);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.stat-card .stat-label {
    font-size: 13px; color: var(--text-muted); margin-top: 4px;
}

/* Modal */
.modal-overlay {
    display: none; position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 32px;
    width: 100%; max-width: 520px;
    max-height: 90vh; overflow-y: auto;
    box-shadow: 0 25px 60px rgba(0,0,0,0.5);
}
.modal h2 { font-size: 20px; margin-bottom: 24px; }
.modal-actions {
    display: flex; gap: 12px; justify-content: flex-end;
    margin-top: 24px; padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* Chat Layout */
.chat-layout { display: flex; height: 100vh; }
.chat-sidebar {
    width: 280px; background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
}
.chat-sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.chat-list { flex: 1; overflow-y: auto; padding: 8px; }
.chat-list-item {
    padding: 12px 16px; border-radius: 10px;
    cursor: pointer; margin-bottom: 2px;
    transition: all 0.15s;
}
.chat-list-item:hover { background: var(--bg-input); }
.chat-list-item.active { background: rgba(59,130,246,0.15); }
.chat-list-item .chat-title {
    font-size: 14px; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-list-item .chat-date {
    font-size: 12px; color: var(--text-muted); margin-top: 2px;
}

.chat-main { flex: 1; display: flex; flex-direction: column; }
.chat-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    background: var(--bg-secondary);
}
.chat-header h2 { font-size: 16px; font-weight: 600; }
.chat-header .model-badge {
    font-size: 12px; color: var(--text-muted);
    background: var(--bg-input); padding: 4px 12px;
    border-radius: 20px;
}

.chat-messages {
    flex: 1; overflow-y: auto;
    padding: 24px; display: flex;
    flex-direction: column; gap: 20px;
}
.message {
    max-width: 75%; padding: 16px 20px;
    border-radius: 16px; font-size: 14px;
    line-height: 1.7; word-wrap: break-word;
}
.message-user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: #fff; border-bottom-right-radius: 4px;
}
.message-assistant {
    align-self: flex-start;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}
.message-assistant pre {
    background: rgba(0,0,0,0.3);
    padding: 12px 16px; border-radius: 8px;
    overflow-x: auto; margin: 8px 0;
    font-size: 13px;
}
.message-assistant code {
    background: rgba(0,0,0,0.2);
    padding: 2px 6px; border-radius: 4px;
    font-size: 13px;
}
.message-time {
    font-size: 11px; color: var(--text-muted);
    margin-top: 6px;
}

.chat-input-area {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}
.chat-input-wrapper {
    display: flex; gap: 12px; align-items: flex-end;
}
.chat-input-wrapper textarea {
    flex: 1; resize: none;
    padding: 14px 18px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--text-primary);
    font-family: inherit; font-size: 14px;
    outline: none; max-height: 150px; min-height: 48px;
    transition: border-color 0.2s;
}
.chat-input-wrapper textarea:focus {
    border-color: var(--border-focus);
}
.chat-input-wrapper textarea::placeholder { color: #475569; }
.btn-send {
    width: 48px; height: 48px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border: none; border-radius: 14px;
    color: #fff; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; transition: all 0.2s;
    flex-shrink: 0;
}
.btn-send:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(59,130,246,0.3); }
.btn-send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Typing indicator */
.typing-indicator {
    display: none; align-self: flex-start;
    padding: 16px 20px; background: var(--bg-input);
    border: 1px solid var(--border); border-radius: 16px;
}
.typing-indicator.active { display: flex; gap: 4px; align-items: center; }
.typing-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--text-muted);
    animation: typingBounce 1.4s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* Empty state */
.empty-state {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    height: 100%; color: var(--text-muted);
    text-align: center; padding: 40px;
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { font-size: 20px; margin-bottom: 8px; color: var(--text-secondary); }
.empty-state p { font-size: 14px; max-width: 400px; }

/* Logout link */
.logout-link {
    color: var(--text-muted); text-decoration: none;
    font-size: 13px; display: flex; align-items: center; gap: 6px;
    padding: 8px 0; transition: color 0.15s;
}
.logout-link:hover { color: var(--danger); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148,163,184,0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,0.3); }

/* Status dot */
.status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    display: inline-block; margin-right: 6px;
}
.status-dot.online { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot.offline { background: var(--danger); }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; padding: 20px; }
    .chat-sidebar { display: none; }
    .login-card { padding: 32px 24px; }
}


/* Xarvis-specific styles */
.brand-logo { max-height: 40px; width: auto; }
.brand-logo-login { max-height: 60px; width: auto; margin-bottom: 16px; }

/* Dashboard layout */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.dashboard-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 24px; }
.dashboard-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }

/* Provider type badges */
.provider-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.provider-ollama { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.provider-openai { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.provider-anthropic { background: rgba(245,158,11,0.15); color: #fbbf24; }
.provider-groq { background: rgba(168,85,247,0.15); color: #c4b5fd; }
.provider-openrouter { background: rgba(59,130,246,0.15); color: #93c5fd; }
.provider-custom { background: rgba(148,163,184,0.15); color: #94a3b8; }

/* Usage meter */
.usage-bar { height: 8px; background: var(--bg-input); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.usage-bar-fill { height: 100%; border-radius: 4px; transition: width 0.3s; }
.usage-bar-fill.low { background: var(--success); }
.usage-bar-fill.mid { background: var(--warning); }
.usage-bar-fill.high { background: var(--danger); }

/* Tabs */
.tabs { display: flex; gap: 4px; margin-bottom: 24px; border-bottom: 1px solid var(--border); padding-bottom: 0; }
.tab { padding: 10px 20px; font-size: 14px; font-weight: 500; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.2s; background: none; border-top: none; border-left: none; border-right: none; font-family: inherit; }
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* API key display */
.api-key-display { font-family: 'JetBrains Mono', monospace; font-size: 13px; background: var(--bg-input); padding: 10px 14px; border-radius: 8px; border: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.api-key-display .key-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.api-key-display .key-copy { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 13px; padding: 4px 8px; }

/* Secret key input with toggle */
.secret-input-wrapper { position: relative; }
.secret-input-wrapper input { padding-right: 40px; }
.secret-toggle { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; }
