/* ABAX Email Assistant — Dashboard Styles */

:root {
    --primary: #4f46e5;
    --primary-light: #e0e7ff;
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --sidebar-bg: #1e293b;
    --sidebar-text: #cbd5e1;
    --radius: 8px;
}

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

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

/* Login */
.login-container {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; background: var(--bg);
}
.login-box {
    background: var(--bg-card); padding: 40px; border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08); width: 380px; text-align: center;
}
.login-box h1 { font-size: 24px; margin-bottom: 8px; }
.login-subtitle { color: var(--text-secondary); margin-bottom: 24px; }
.login-box input {
    width: 100%; padding: 12px 16px; border: 1px solid var(--border);
    border-radius: var(--radius); margin-bottom: 12px; font-size: 14px;
}
.login-box input:focus { outline: none; border-color: var(--primary); }
.error-msg { color: var(--danger); font-size: 13px; margin-top: 8px; }

/* Buttons */
.btn {
    padding: 10px 20px; border: none; border-radius: var(--radius);
    font-size: 14px; cursor: pointer; font-weight: 500; transition: all 0.2s;
}
.btn-primary { background: var(--primary); color: white; width: 100%; }
.btn-primary:hover { background: #4338ca; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #15803d; }
.btn-warning { background: var(--warning); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-outline {
    background: transparent; border: 1px solid var(--border); color: var(--text-secondary);
}
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* App Layout */
.app-container { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: 260px; background: var(--sidebar-bg); color: var(--sidebar-text);
    display: flex; flex-direction: column; position: fixed; height: 100vh;
}
.sidebar-header { padding: 20px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-header h2 { color: white; font-size: 18px; }
.user-badge {
    display: inline-block; background: rgba(255,255,255,0.1);
    padding: 2px 10px; border-radius: 12px; font-size: 12px; margin-top: 4px;
}
.nav-list { list-style: none; flex: 1; padding: 12px 0; }
.nav-item {
    padding: 12px 20px; cursor: pointer; display: flex;
    justify-content: space-between; align-items: center;
    transition: background 0.2s; font-size: 14px;
}
.nav-item:hover { background: rgba(255,255,255,0.05); }
.nav-item.active { background: rgba(255,255,255,0.1); color: white; }
.badge {
    background: var(--danger); color: white; padding: 2px 8px;
    border-radius: 10px; font-size: 11px; font-weight: 600;
}
.badge:empty { display: none; }
.sidebar-footer {
    padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.1);
    display: flex; gap: 8px;
}
.sidebar-footer .btn { flex: 1; color: var(--sidebar-text); }

/* Main Content */
.main-content { margin-left: 260px; flex: 1; padding: 24px; }
.view-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px;
}
.view-header h2 { font-size: 20px; }
.filters { display: flex; gap: 8px; }
.filters select {
    padding: 8px 12px; border: 1px solid var(--border);
    border-radius: var(--radius); font-size: 13px; background: white;
}
.badge-info {
    background: var(--primary-light); color: var(--primary);
    padding: 4px 12px; border-radius: 12px; font-size: 13px;
}

/* Email List */
.email-list { display: flex; flex-direction: column; gap: 8px; }
.email-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px; cursor: pointer;
    transition: all 0.2s; display: flex; align-items: flex-start; gap: 12px;
}
.email-card:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.email-priority {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 6px;
}
.priority-critical { background: var(--danger); }
.priority-high { background: var(--warning); }
.priority-medium { background: #eab308; }
.priority-low { background: var(--success); }
.email-info { flex: 1; min-width: 0; }
.email-subject { font-weight: 600; font-size: 14px; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.email-meta { font-size: 12px; color: var(--text-secondary); display: flex; gap: 12px; flex-wrap: wrap; }
.email-meta span { white-space: nowrap; }
.email-category {
    padding: 2px 8px; border-radius: 4px; font-size: 11px;
    background: var(--primary-light); color: var(--primary); font-weight: 500;
}
.email-status {
    padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500;
}
.status-new { background: #dbeafe; color: #1d4ed8; }
.status-classified { background: #e0e7ff; color: #4f46e5; }
.status-draft_ready { background: var(--warning-light); color: var(--warning); }
.status-approved { background: var(--success-light); color: var(--success); }
.status-assigned { background: #fef3c7; color: #92400e; }

/* Drafts */
.draft-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px; margin-bottom: 12px;
}
.draft-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.draft-subject { font-weight: 600; font-size: 15px; }
.draft-from { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.draft-body {
    background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
    padding: 16px; margin: 12px 0; font-size: 14px; white-space: pre-wrap;
    line-height: 1.6;
}
.draft-actions { display: flex; gap: 8px; justify-content: flex-end; }
.draft-edit-area {
    width: 100%; min-height: 150px; padding: 12px; border: 1px solid var(--border);
    border-radius: 6px; font-family: inherit; font-size: 14px; resize: vertical;
    margin: 12px 0;
}

/* KB */
.kb-list { display: flex; flex-direction: column; gap: 8px; }
.kb-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px;
}
.kb-question { font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.kb-response { font-size: 13px; color: var(--text-secondary); white-space: pre-wrap; }
.kb-meta { font-size: 11px; color: var(--text-secondary); margin-top: 8px; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.stat-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px; text-align: center;
}
.stat-value { font-size: 32px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* Modal */
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4); z-index: 1000;
    display: flex; align-items: center; justify-content: center;
}
.modal-content {
    background: var(--bg-card); border-radius: 12px; width: 700px;
    max-height: 80vh; overflow-y: auto; box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}
.modal-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; flex: 1; }
.btn-close {
    background: none; border: none; font-size: 18px; cursor: pointer;
    color: var(--text-secondary); padding: 4px;
}
.modal-meta { padding: 16px 24px; font-size: 13px; color: var(--text-secondary); border-bottom: 1px solid var(--border); }
.modal-body { padding: 20px 24px; white-space: pre-wrap; font-size: 14px; line-height: 1.6; }
.modal-actions { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state-text { font-size: 15px; }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar-header h2, .nav-item span:first-child, .user-badge, .sidebar-footer { display: none; }
    .main-content { margin-left: 60px; }
}
