/* Resollo — Dark Theme */
:root {
  --bg: #0a0a0f;
  --bg-card: #12121a;
  --bg-card-hover: #1a1a25;
  --bg-sidebar: #0d0d14;
  --border: #1e1e2e;
  --text: #e4e4e7;
  --text-muted: #71717a;
  --text-dim: #52525b;
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --primary-bg: rgba(99, 102, 241, 0.1);
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.1);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.1);
  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

.page { display: none; }
.page.active { display: block; }

/* Nav */
.nav { display: flex; align-items: center; justify-content: space-between; padding: 16px 40px; border-bottom: 1px solid var(--border); background: rgba(10,10,15,0.95); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 100; }
.nav-brand { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.logo { font-size: 24px; }
.nav-links { display: flex; align-items: center; gap: 24px; }
.nav-links a { color: var(--text-muted); font-size: 14px; transition: color 0.2s; }
.nav-links a:hover { color: var(--text); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 10px 20px; border: none; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s; font-family: var(--font); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-danger { background: var(--danger); color: white; }
.btn-success { background: var(--success); color: white; }

/* Hero */
.hero { text-align: center; padding: 100px 40px 80px; max-width: 800px; margin: 0 auto; }
.hero-badge { display: inline-block; padding: 6px 16px; background: var(--primary-bg); color: var(--primary); border-radius: 20px; font-size: 13px; font-weight: 600; margin-bottom: 24px; border: 1px solid rgba(99,102,241,0.2); }
.hero h1 { font-size: 52px; font-weight: 800; line-height: 1.1; margin-bottom: 20px; letter-spacing: -0.02em; }
.gradient-text { background: linear-gradient(135deg, var(--primary), #a855f7, #ec4899); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero-sub { font-size: 18px; color: var(--text-muted); max-width: 600px; margin: 0 auto 32px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; margin-bottom: 60px; }
.hero-stats { display: flex; gap: 48px; justify-content: center; }
.stat { text-align: center; }
.stat-value { display: block; font-size: 32px; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 13px; color: var(--text-muted); }

/* Sections */
.section { padding: 80px 40px; max-width: 1100px; margin: 0 auto; }
.section-dark { background: var(--bg-card); max-width: 100%; }
.section-dark > * { max-width: 1100px; margin-left: auto; margin-right: auto; }
.section-title { font-size: 36px; font-weight: 800; text-align: center; margin-bottom: 48px; }

/* Features */
.features-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.feature-card { padding: 28px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); transition: all 0.2s; }
.feature-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.feature-icon { font-size: 28px; margin-bottom: 12px; }
.feature-card h3 { font-size: 16px; margin-bottom: 8px; }
.feature-card p { font-size: 14px; color: var(--text-muted); }

/* Steps */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.step { text-align: center; padding: 24px; }
.step-num { width: 40px; height: 40px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; margin: 0 auto 16px; }
.step h3 { font-size: 16px; margin-bottom: 8px; }
.step p { font-size: 14px; color: var(--text-muted); }

/* Pricing */
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; max-width: 900px; margin: 0 auto; }
.pricing-card { padding: 32px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); text-align: center; position: relative; }
.pricing-card.featured { border-color: var(--primary); transform: scale(1.05); }
.pricing-badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--primary); color: white; padding: 4px 16px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.pricing-card h3 { font-size: 20px; margin-bottom: 8px; }
.price { font-size: 42px; font-weight: 800; margin-bottom: 24px; }
.price span { font-size: 16px; color: var(--text-muted); font-weight: 400; }
.pricing-card ul { list-style: none; margin-bottom: 24px; }
.pricing-card li { padding: 8px 0; font-size: 14px; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.pricing-card li:last-child { border-bottom: none; }

/* Footer */
.footer { text-align: center; padding: 40px; border-top: 1px solid var(--border); color: var(--text-dim); font-size: 13px; }

/* Dashboard Layout */
.dashboard-layout { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: var(--bg-sidebar); border-right: 1px solid var(--border); padding: 20px 0; position: fixed; top: 0; bottom: 0; overflow-y: auto; }
.sidebar-brand { padding: 0 20px 20px; font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 8px; cursor: pointer; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 8px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); color: var(--text-muted); font-size: 14px; transition: all 0.15s; }
.nav-item:hover { color: var(--text); background: var(--bg-card); }
.nav-item.active { color: var(--text); background: var(--primary-bg); }

.main-content { flex: 1; margin-left: 240px; padding: 32px 40px; }
.tab { display: none; }
.tab.active { display: block; }
.tab h1 { font-size: 28px; font-weight: 700; margin-bottom: 24px; }

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 32px; }
.stat-card { padding: 20px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); }
.stat-card .stat-value { font-size: 28px; font-weight: 800; }
.stat-card .stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.warning .stat-value { color: var(--warning); }
.stat-card.info .stat-value { color: var(--info); }

/* Cards */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 16px; }
.card h2, .card h3 { margin-bottom: 16px; }

/* Tab Header */
.tab-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.tab-header h1 { margin-bottom: 0; }
.tab-desc { color: var(--text-muted); font-size: 14px; margin-bottom: 20px; }
.tab-filters select { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); padding: 8px 12px; border-radius: var(--radius-sm); font-size: 14px; }

/* Ticket List */
.ticket-list { display: flex; flex-direction: column; gap: 8px; }
.ticket-item { display: flex; align-items: center; gap: 16px; padding: 16px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; transition: all 0.15s; }
.ticket-item:hover { background: var(--bg-card-hover); border-color: var(--primary); }
.ticket-from { font-weight: 600; min-width: 180px; font-size: 14px; }
.ticket-subject { flex: 1; color: var(--text-muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-time { color: var(--text-dim); font-size: 12px; min-width: 100px; text-align: right; }

/* Badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.badge-new { background: var(--info-bg); color: var(--info); }
.badge-auto_replied, .badge-replied { background: var(--success-bg); color: var(--success); }
.badge-escalated { background: var(--warning-bg); color: var(--warning); }
.badge-resolved, .badge-processing { background: var(--primary-bg); color: var(--primary); }
.badge-error { background: var(--danger-bg); color: var(--danger); }
.badge-high { background: var(--success-bg); color: var(--success); }
.badge-medium { background: var(--warning-bg); color: var(--warning); }
.badge-low { background: var(--danger-bg); color: var(--danger); }

/* KB Grid */
.kb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.kb-card { padding: 20px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); transition: all 0.15s; }
.kb-card:hover { border-color: var(--primary); }
.kb-card h3 { font-size: 16px; margin-bottom: 8px; }
.kb-card-meta { display: flex; gap: 12px; font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.kb-card-keywords { display: flex; flex-wrap: wrap; gap: 4px; }
.kb-card-keywords span { background: var(--primary-bg); color: var(--primary); padding: 2px 8px; border-radius: 10px; font-size: 11px; }
.kb-card-actions { display: flex; gap: 8px; margin-top: 12px; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.form-group small { display: block; margin-top: 4px; color: var(--text-dim); font-size: 12px; }
.form-group input, .form-group textarea, .form-group select { width: 100%; padding: 10px 14px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 14px; font-family: var(--font); transition: border-color 0.2s; }
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); }
.form-group textarea { resize: vertical; }
.form-actions { display: flex; gap: 8px; }

/* Test Result */
.result-meta { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.response-preview { padding: 16px; background: var(--bg); border-radius: var(--radius-sm); white-space: pre-wrap; font-size: 14px; line-height: 1.6; }
.response-reasoning { margin-top: 12px; padding: 12px; background: var(--primary-bg); border-radius: var(--radius-sm); font-size: 13px; color: var(--text-muted); }

/* Webhook URLs */
.webhook-urls { display: flex; flex-direction: column; gap: 12px; }
.webhook-url { display: flex; align-items: center; gap: 12px; }
.webhook-url strong { min-width: 100px; font-size: 14px; }
.webhook-url code { flex: 1; padding: 8px 12px; background: var(--bg); border-radius: var(--radius-sm); font-size: 13px; color: var(--primary); word-break: break-all; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.modal-content { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); width: 100%; max-width: 700px; max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 24px; cursor: pointer; }
.modal-close:hover { color: var(--text); }
#modal-body { padding: 24px; }
.detail-section { margin-bottom: 20px; }
.detail-section h4 { font-size: 13px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.detail-section p, .detail-section pre { font-size: 14px; line-height: 1.6; }
.detail-section pre { padding: 12px; background: var(--bg); border-radius: var(--radius-sm); white-space: pre-wrap; overflow-x: auto; }
.detail-actions { display: flex; gap: 8px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }

/* Loading */
.loading { text-align: center; padding: 40px; color: var(--text-muted); }
.empty { text-align: center; padding: 60px 20px; color: var(--text-dim); }

/* Responsive */
@media (max-width: 900px) {
  .hero h1 { font-size: 36px; }
  .features-grid { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .pricing-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
}
@media (max-width: 600px) {
  .hero h1 { font-size: 28px; }
  .features-grid { grid-template-columns: 1fr; }
  .hero-stats { flex-direction: column; gap: 16px; }
  .nav { padding: 12px 20px; }
  .main-content { padding: 20px; }
}
