@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* =====================================================
   CSS DESIGN SYSTEM – Daily Task Track
   ===================================================== */

:root {
  /* Color Palette */
  --primary:        #6366f1;
  --primary-hover:  #4f46e5;
  --primary-light:  #eef2ff;
  --secondary:      #8b5cf6;
  --accent:         #06b6d4;
  --success:        #10b981;
  --warning:        #f59e0b;
  --danger:         #ef4444;
  --info:           #3b82f6;

  /* Background */
  --bg-dark:        #0f0f1a;
  --bg-card:        #1a1a2e;
  --bg-card-hover:  #1e1e35;
  --bg-sidebar:     #12121f;
  --bg-input:       #252540;
  --bg-overlay:     rgba(0, 0, 0, 0.6);

  /* Text */
  --text-primary:   #f0f0ff;
  --text-secondary: #a0a0c0;
  --text-muted:     #606080;
  --text-inverse:   #0f0f1a;

  /* Border */
  --border:         rgba(255,255,255,0.08);
  --border-hover:   rgba(255,255,255,0.16);
  --border-focus:   rgba(99,102,241,0.5);

  /* Shadows */
  --shadow-sm:      0 2px 8px rgba(0,0,0,0.3);
  --shadow-md:      0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg:      0 8px 40px rgba(0,0,0,0.5);
  --shadow-glow:    0 0 30px rgba(99,102,241,0.2);

  /* Spacing */
  --sidebar-width:  260px;
  --header-height:  64px;
  --radius-sm:      8px;
  --radius-md:      12px;
  --radius-lg:      16px;
  --radius-xl:      24px;
  --radius-full:    9999px;

  /* Transitions */
  --transition:     all 0.2s ease;
  --transition-slow: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =====================================================
   RESET & BASE
   ===================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-hover); }

button { cursor: pointer; font-family: inherit; border: none; outline: none; }
input, textarea, select { font-family: inherit; outline: none; }

img { max-width: 100%; display: block; }
ul, ol { list-style: none; }

/* =====================================================
   LAYOUT
   ===================================================== */
#app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: var(--transition-slow);
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: var(--transition-slow);
}

.page-header {
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
}

.page-body {
  flex: 1;
  padding: 28px;
  overflow-y: auto;
}

/* =====================================================
   TYPOGRAPHY
   ===================================================== */
h1 { font-size: 1.8rem; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.4rem; font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: 1.1rem; font-weight: 600; }
h4 { font-size: 0.95rem; font-weight: 600; }

.text-muted { color: var(--text-secondary); }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

/* =====================================================
   BUTTONS
   ===================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 4px 15px rgba(99,102,241,0.4); }

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { filter: brightness(1.1); transform: translateY(-1px); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { filter: brightness(1.1); transform: translateY(-1px); }

.btn-warning { background: var(--warning); color: var(--text-inverse); }
.btn-warning:hover { filter: brightness(1.05); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-input); color: var(--text-primary); }

.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }
.btn-icon { padding: 8px; min-width: 36px; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* =====================================================
   FORM ELEMENTS
   ===================================================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-control {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 10px 14px;
  font-size: 0.875rem;
  width: 100%;
  transition: var(--transition);
}
.form-control:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.form-control::placeholder { color: var(--text-muted); }
.form-control option { background: var(--bg-card); }

textarea.form-control { resize: vertical; min-height: 80px; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

/* =====================================================
   CARDS
   ===================================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: var(--transition);
}
.card:hover { border-color: var(--border-hover); }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

/* =====================================================
   STAT CARDS
   ===================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: var(--transition-slow);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--stat-color, var(--primary));
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-hover); }

.stat-card .stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  margin-bottom: 12px;
  background: rgba(var(--stat-rgb, 99,102,241), 0.15);
}
.stat-card .stat-value { font-size: 2rem; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.stat-card .stat-label { font-size: 0.8rem; color: var(--text-secondary); font-weight: 500; }

/* =====================================================
   BADGES & TAGS
   ===================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-primary { background: rgba(99,102,241,0.2); color: #a5b4fc; }
.badge-success { background: rgba(16,185,129,0.2); color: #6ee7b7; }
.badge-warning { background: rgba(245,158,11,0.2); color: #fcd34d; }
.badge-danger  { background: rgba(239,68,68,0.2); color: #fca5a5; }
.badge-info    { background: rgba(59,130,246,0.2); color: #93c5fd; }
.badge-muted   { background: rgba(96,96,128,0.3); color: var(--text-secondary); }
.badge-purple  { background: rgba(139,92,246,0.2); color: #c4b5fd; }

/* Priority badges */
.priority-high   { background: rgba(239,68,68,0.15); color: #f87171; }
.priority-medium { background: rgba(245,158,11,0.15); color: #fbbf24; }
.priority-low    { background: rgba(16,185,129,0.15); color: #34d399; }

/* Role badges */
.role-super_admin { background: rgba(239,68,68,0.15); color: #f87171; }
.role-manager    { background: rgba(139,92,246,0.15); color: #c4b5fd; }
.role-team_leader{ background: rgba(59,130,246,0.15); color: #93c5fd; }
.role-employee   { background: rgba(16,185,129,0.15); color: #34d399; }

/* Status badges */
.status-todo        { background: rgba(96,96,128,0.2); color: var(--text-secondary); }
.status-in_progress { background: rgba(245,158,11,0.2); color: #fcd34d; }
.status-done        { background: rgba(16,185,129,0.2); color: #6ee7b7; }
.status-pending     { background: rgba(245,158,11,0.2); color: #fcd34d; }
.status-approved    { background: rgba(16,185,129,0.2); color: #6ee7b7; }
.status-rejected    { background: rgba(239,68,68,0.2); color: #fca5a5; }

/* =====================================================
   TABLE
   ===================================================== */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-md); }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--bg-input);
  white-space: nowrap;
}
.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: rgba(255,255,255,0.02); }

/* =====================================================
   SCROLLBAR
   ===================================================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-input); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* =====================================================
   UTILITY
   ===================================================== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.w-full { width: 100%; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.ml-auto { margin-left: auto; }
.text-center { text-align: center; }
.hidden { display: none !important; }
.relative { position: relative; }
.overflow-hidden { overflow: hidden; }

/* Grid helpers */
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

/* Gradient text */
.gradient-text {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Divider */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { margin-bottom: 8px; color: var(--text-primary); }

/* Loading spinner */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}

/* Fade in animation */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: translateX(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.5} }

.fade-in { animation: fadeIn 0.3s ease forwards; }
.slide-in { animation: slideIn 0.3s ease forwards; }
.scale-in { animation: scaleIn 0.2s ease forwards; }

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); width: 260px; box-shadow: var(--shadow-lg); }
  .main-content { margin-left: 0; }
  .page-body { padding: 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
}
