/* TaskSummary - Main Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&display=swap');

:root {
  --sidebar-width: 260px;
  --topbar-height: 60px;
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --danger: #dc3545;
  --warning: #fd7e14;
  --success: #16a34a;
  --info: #0ea5e9;
  --bg-body: #f1f5f9;
  --bg-sidebar: #1e293b;
  --bg-sidebar-hover: #334155;
  --text-sidebar: #cbd5e1;
  --border-color: #e2e8f0;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --transition: all 0.2s ease;
}

* { box-sizing: border-box; }

body {
  font-family: 'Sarabun', -apple-system, sans-serif;
  font-size: 14px;
  background: var(--bg-body);
  color: #1e293b;
  margin: 0;
  padding: 0;
}

/* ─── Sidebar ─────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1050;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: var(--topbar-height);
  background: rgba(0,0,0,0.15);
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.sidebar-logo i {
  font-size: 22px;
}

.sidebar-brand { color: #fff; }

.sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar-body::-webkit-scrollbar { width: 4px; }
.sidebar-body::-webkit-scrollbar-track { background: transparent; }
.sidebar-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.sidebar-nav { list-style: none; padding: 0; margin: 0; }

.nav-section-title {
  padding: 10px 20px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #64748b;
}

.sidebar-nav .nav-item { margin: 1px 8px; }

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  color: var(--text-sidebar);
  text-decoration: none;
  border-radius: 8px;
  transition: var(--transition);
  font-size: 14px;
  font-weight: 400;
}

.sidebar-nav .nav-link i { font-size: 16px; flex-shrink: 0; }

.sidebar-nav .nav-item.active .nav-link,
.sidebar-nav .nav-link:hover {
  background: var(--bg-sidebar-hover);
  color: #fff;
}

.sidebar-nav .nav-item.active .nav-link {
  background: var(--primary);
  color: #fff;
  font-weight: 500;
}

.sidebar-footer {
  padding: 12px 16px;
  background: rgba(0,0,0,0.15);
  flex-shrink: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.user-avatar-sm {
  width: 28px;
  height: 28px;
  background: var(--primary);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  flex-shrink: 0;
}

.user-details { flex: 1; overflow: hidden; }
.user-name { color: #fff; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { color: #94a3b8; font-size: 11px; text-transform: capitalize; }

/* ─── Main Wrapper ────────────────────────────────────── */
.main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s ease;
}

/* ─── Topbar ──────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.sidebar-toggle {
  color: #64748b;
  border: none;
  background: none;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 6px;
}
.sidebar-toggle:hover { background: #f1f5f9; color: var(--primary); }

/* ─── Content Area ────────────────────────────────────── */
.content-area {
  flex: 1;
  padding: 24px;
  max-width: 1400px;
  width: 100%;
}

/* ─── Page Header ─────────────────────────────────────── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.page-title i { color: var(--primary); }

/* ─── Cards ───────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
}

.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  background: transparent;
  border-radius: 12px 12px 0 0;
}

.card-title { font-size: 14px; font-weight: 600; color: #1e293b; }

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

.border-dashed { border-style: dashed !important; }

/* ─── Stat Cards ──────────────────────────────────────── */
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--border-color);
  box-shadow: var(--card-shadow);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }

.stat-icon {
  font-size: 28px;
  margin-bottom: 12px;
  display: inline-block;
}

.stat-value {
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 13px;
  color: #64748b;
  font-weight: 500;
}

.stat-card-primary { border-left: 4px solid var(--primary); }
.stat-card-primary .stat-icon, .stat-card-primary .stat-value { color: var(--primary); }

.stat-card-success { border-left: 4px solid var(--success); }
.stat-card-success .stat-icon, .stat-card-success .stat-value { color: var(--success); }

.stat-card-danger { border-left: 4px solid var(--danger); }
.stat-card-danger .stat-icon, .stat-card-danger .stat-value { color: var(--danger); }

.stat-card-info { border-left: 4px solid var(--info); }
.stat-card-info .stat-icon, .stat-card-info .stat-value { color: var(--info); }

/* ─── Priority Sections ───────────────────────────────── */
.priority-section { border: 1px solid var(--border-color); border-radius: 10px; overflow: hidden; }

.priority-header {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 13px;
}

.priority-header-critical { background: #fee2e2; color: #dc2626; border-left: 4px solid #dc2626; }
.priority-header-high     { background: #fff7ed; color: #ea580c; border-left: 4px solid #ea580c; }
.priority-header-medium   { background: #fefce8; color: #ca8a04; border-left: 4px solid #ca8a04; }
.priority-header-low      { background: #f0fdf4; color: #16a34a; border-left: 4px solid #16a34a; }

/* ─── Tasks Table ─────────────────────────────────────── */
.task-table thead th {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  padding: 10px 12px;
}

.task-table tbody td { padding: 10px 12px; vertical-align: middle; }
.task-table tbody tr:hover { background: #f8fafc; }
.task-row.task-overdue { background: #fff5f5; }
.task-row.task-overdue:hover { background: #fee2e2; }

.task-title-link {
  color: #1e293b;
  font-weight: 500;
  text-decoration: none;
  font-size: 13.5px;
}
.task-title-link:hover { color: var(--primary); text-decoration: underline; }

.task-desc-preview {
  font-size: 11px;
  margin-top: 2px;
  color: #94a3b8;
}

.status-select {
  font-size: 12px;
  padding: 3px 6px;
  min-width: 100px;
}

.progress-range {
  height: 4px;
  cursor: pointer;
}

/* ─── Comments ────────────────────────────────────────── */
.comment-item { }
.comment-avatar {
  width: 32px;
  height: 32px;
  background: #e2e8f0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  color: #475569;
  flex-shrink: 0;
}
.comment-header { font-size: 13px; }
.comment-body { font-size: 13.5px; background: #f8fafc; padding: 8px 12px; border-radius: 8px; }

/* ─── Task Info List ──────────────────────────────────── */
.task-info-list dt { font-size: 12px; margin-bottom: 8px; }
.task-info-list dd { font-size: 13px; margin-bottom: 8px; }

/* ─── AI Summary ──────────────────────────────────────── */
.ai-summary-text, .ai-summary-preview {
  font-size: 13.5px;
  line-height: 1.7;
  color: #374151;
}
.ai-summary-html { line-height: 1.7; }
.ai-summary-html h3, .ai-summary-html h4, .ai-summary-html h5 { 
  color: var(--primary-dark); 
  margin-top: 1rem; 
  margin-bottom: 0.5rem;
}

/* ─── Category Icon ───────────────────────────────────── */
.category-icon-preview {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

/* ─── Sidebar Overlay (mobile) ────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1040;
}

.sidebar-overlay.show { display: block; }

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

.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo {
  font-size: 40px;
  color: var(--primary);
  margin-bottom: 8px;
}

/* ─── Breadcrumb ──────────────────────────────────────── */
.breadcrumb { font-size: 13px; }
.breadcrumb-item + .breadcrumb-item::before { content: '/'; color: #cbd5e1; }

/* ─── Responsive ──────────────────────────────────────── */
@media (max-width: 992px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.show {
    transform: translateX(0);
  }
  .main-wrapper {
    margin-left: 0;
  }
  .content-area {
    padding: 16px;
  }
}

@media (max-width: 576px) {
  .page-header { flex-direction: column; }
  .stat-value { font-size: 24px; }
}

/* ─── Custom Scrollbar ────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ─── Utilities ───────────────────────────────────────── */
.fw-medium { font-weight: 500; }
.fs-xs { font-size: 11px; }

.badge-category {
  font-size: 10px;
  padding: 2px 6px;
}

.toast-notification {
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { transform: translateX(100px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* Install page */
.install-container {
  max-width: 680px;
  margin: 40px auto;
  padding: 20px;
}

/* Sticky layout */
.sticky-top { top: 80px; }