/* TaskFlow UI — Professional, Next-Gen SaaS Edition
   - Glassmorphism & Mesh Gradients
   - Ultra Responsive
   - Fluid Typography & Interactions
*/

/* ============== Theme tokens ============== */
:root {
  /* Dynamic Background */
  --bg-base: #060912;
  
  /* Glass Surfaces */
  --glass-bg: rgba(16, 20, 31, 0.45);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-blur: blur(28px);
  
  /* Solid Surfaces for interactions */
  --surface: #10141f;
  --surface-hover: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.08);
  
  /* Typography */
  --text-1: #ffffff;
  --text-2: #94a3b8;
  
  /* Brand Palette (Vivid Mix) */
  --primary: #10b981;
  --primary-600: #34d399;
  --primary-100: rgba(16, 185, 129, 0.15);
  
  /* Vivid Status Colors */
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.15);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  --info: #0ea5e9;
  --info-bg: rgba(14, 165, 233, 0.15);

  /* Geometry & Shadows */
  --radius: 20px;
  --radius-sm: 12px;
  --shadow-soft: 0 10px 40px -10px rgba(0,0,0,0.5);
  --shadow-hover: 0 20px 40px -10px rgba(0,0,0,0.7);
  --ring: 0 0 0 4px rgba(192, 132, 252, 0.15);

  /* Vivid Gradients */
  --grad-primary: linear-gradient(135deg, #10b981 0%, #0ea5e9 33%, #f59e0b 66%, #ef4444 100%);
  --grad-accent: linear-gradient(135deg, #ef4444 0%, #f59e0b 50%, #10b981 100%);
  --grad-3: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);

  /* Layout */
  --max-w: 1240px;
}

/* ============== Base ============== */
* { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  color: var(--text-1);
  background-color: var(--bg-base);
  line-height: 1.6;
  position: relative;
}

/* Typography */
h1, h2, h3, h4, h5, h6 { margin-top: 0; font-weight: 700; color: var(--text-1); letter-spacing: -0.02em; }
.tf-title { 
  font-size: clamp(24px, 4vw, 32px); font-weight: 800; letter-spacing: -0.03em;
  background: var(--grad-primary); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tf-subtitle, .tf-subtext { color: var(--text-2); font-weight: 500; }

/* Global Animated Background mesh */
.tf-global-bg {
  position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--bg-base);
}
.tf-global-bg .blob {
  position: absolute; border-radius: 50%; filter: blur(120px); opacity: 0.45;
  animation: float 20s infinite ease-in-out alternate;
}
.blob.b-green  { width: 45vw; height: 45vw; background: #10b981; top: -10vw; left: -10vw; }
.blob.b-blue   { width: 40vw; height: 40vw; background: #0ea5e9; bottom: -10vw; right: -10vw; animation-delay: -3s; }
.blob.b-orange { width: 45vw; height: 45vw; background: #f59e0b; top: 10vh; right: 40vw; animation-delay: -6s; }
.blob.b-red    { width: 40vw; height: 40vw; background: #ef4444; top: 30vh; left: 60vw; animation-delay: -9s; }

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(10vw, 15vh) scale(1.1); }
}

/* Links */
a { color: var(--primary); text-decoration: none; transition: color 0.2s ease; }
a:hover { color: var(--primary-600); }
.tf-link { color: var(--primary); font-weight: 600; text-underline-offset: 4px; }
.tf-link:hover { text-decoration: underline; }

/* Layout container */
.tf-container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: clamp(16px, 3vw, 32px);
}

/* ============== Topbar (Sticky Glass) ============== */
.tf-topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--glass-bg);
  border-bottom: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}
.tf-topbar-inner {
  max-width: var(--max-w);
  margin: 0 auto; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px clamp(16px, 3vw, 32px);
}
.tf-brand {
  display: flex; align-items: center; gap: 12px;
  font-weight: 800; letter-spacing: -0.03em;
  background: var(--grad-accent); -webkit-background-clip: text; background-clip: text; color: transparent;
  font-size: clamp(20px, 3vw, 24px);
}
/* Navbar Advanced Navigation */
.tf-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tf-nav-link {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 10px;
  color: var(--text-2); font-weight: 600; font-size: 14px;
  text-decoration: none; transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.tf-nav-link svg { width: 18px; height: 18px; stroke-width: 2.2px; opacity: 0.8; }
.tf-nav-link:hover { background: var(--glass-bg); color: var(--primary); transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0,0,0,0.03); }
.tf-nav-link:hover svg { opacity: 1; color: var(--primary); }
.tf-nav-link.active { background: rgba(255, 255, 255, 0.08); color: #fff; font-weight: 700; }
.tf-nav-link.active::after {
  content: ''; position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%);
  width: 24px; height: 3px; background: var(--grad-accent); border-radius: 4px;
}

/* User Profile & Dropdown Systems */
.tf-avatar {
  width: 32px; height: 32px; border-radius: 10px; background: var(--grad-primary);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 13px; text-transform: uppercase;
  flex-shrink: 0; box-shadow: 0 4px 12px rgba(236,72,153,0.3);
}
.tf-dropdown { position: relative; display: inline-block; }
.tf-dropdown-trigger {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 4px 12px 4px 4px; border-radius: 14px; border: 1px solid transparent;
  transition: all 0.2s ease; user-select: none; background: transparent; color: inherit; font-family: inherit;
}
.tf-dropdown-trigger:hover, .tf-dropdown-trigger.open {
  background: var(--glass-bg); border-color: var(--glass-border); box-shadow: 0 4px 10px rgba(0,0,0,0.03);
}
.tf-dropdown-name { font-weight: 700; font-size: 14px; color: var(--text-1); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tf-dropdown-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 220px; background: var(--glass-bg); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border); border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.1);
  opacity: 0; visibility: hidden; transform: translateY(-10px);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 8px; z-index: 2000;
}
.tf-dropdown-menu.show { opacity: 1; visibility: visible; transform: translateY(0); }
.tf-dropdown-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  color: var(--text-2); font-weight: 600; font-size: 14px; text-decoration: none;
  border-radius: 10px; transition: all 0.2s ease;
}
.tf-dropdown-item svg { width: 16px; height: 16px; color: var(--text-2); transition: color 0.2s ease; }
.tf-dropdown-item:hover { background: var(--surface-hover); color: var(--text-1); }
.tf-dropdown-item:hover svg { color: var(--text-1); }
.tf-dropdown-divider { height: 1px; background: var(--border); margin: 6px 0; }
.tf-dropdown-item.danger { color: var(--danger); }
.tf-dropdown-item.danger:hover { background: var(--danger-bg); color: var(--danger); }
.tf-dropdown-item.danger svg { color: var(--danger); }

/* Notification Bell */
.tf-badge-wrap { position: relative; display: inline-flex; }
.tf-badge-pulse {
  position: absolute; top: -2px; right: -2px; width: 8px; height: 8px;
  background-color: var(--danger); border-radius: 50%;
  box-shadow: 0 0 0 2px var(--glass-bg); z-index: 10;
}
.tf-badge-pulse::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--danger); animation: tf-ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}
@keyframes tf-ping { 75%, 100% { transform: scale(2.5); opacity: 0; } }

/* Mobile Hiding Overrides */
@media (max-width: 900px) {
  .tf-dropdown-name { display: none; }
  .tf-dropdown-trigger { padding: 4px; border-radius: 12px; }
  .tf-nav-link span { display: none; } /* On medium screens, collapse text but keep icons */
}
@media (max-width: 600px) {
  .tf-nav-link { display: none; } /* Below 600px, heavily rely on hamburger drawer */
}

/* ============== Glass Cards ============== */
.tf-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  padding: clamp(16px, 3vw, 24px);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
}
.tf-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.tf-card-title { font-weight: 800; font-size: 20px; color: var(--text-1); margin-bottom: 12px; }

/* ============== Buttons (Modern Interactive) ============== */
.tf-button {
  --btn-bg: rgba(255, 255, 255, 0.1);
  --btn-fg: #fff;
  --btn-bd: rgba(255, 255, 255, 0.1);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px 20px; font-weight: 700; font-size: 15px; font-family: inherit;
  border-radius: var(--radius-sm); border: 1px solid var(--btn-bd);
  background: var(--btn-bg); color: var(--btn-fg);
  cursor: pointer;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}
.tf-button:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}
.tf-button:active { transform: translateY(1px); box-shadow: 0 2px 4px rgba(0,0,0,0.2); }

.tf-button.primary {
  --btn-bd: transparent;
  color: #fff;
  background: var(--grad-primary);
  box-shadow: 0 8px 16px rgba(236, 72, 153, 0.25);
}
.tf-button.primary:hover {
  box-shadow: 0 12px 24px rgba(236, 72, 153, 0.4);
  filter: brightness(1.1);
}

.tf-button.danger {
  background: rgba(239, 68, 68, 0.1); color: #fca5a5; border-color: rgba(239, 68, 68, 0.3); box-shadow: 0 4px 6px rgba(239,68,68,.1);
}
.tf-button.danger:hover { background: rgba(239, 68, 68, 0.25); color: #fff; }
.tf-button.ghost {
  --btn-bg: transparent; border: none; box-shadow: none; color: var(--text-2);
}
.tf-button.ghost:hover { background: rgba(255,255,255,0.08); color: var(--text-1); box-shadow: none; transform:none; }

.tf-button.small { padding: 8px 14px; font-size: 13px; border-radius: 10px; }

/* ============== Modern Forms ============== */
.tf-form { display: grid; gap: 20px; }
.form-group { margin-bottom: 16px; width: 100%; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; width: 100%; }
@media (max-width: 768px) { .form-row { grid-template-columns: 1fr; } }

.tf-label { display: block; color: var(--text-1); font-weight: 700; font-size: 15px; margin-bottom: 6px; }

.tf-input, .tf-select, .tf-textarea, .tf-input[type="text"], .tf-input[type="datetime-local"] {
  width: 100%; padding: 14px 16px; 
  border-radius: var(--radius-sm); border: 1px solid var(--border); 
  background: rgba(0,0,0,0.3); color: #fff;
  font-family: inherit; font-size: 15px; font-weight: 500;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
}
.tf-input::placeholder, .tf-textarea::placeholder { color: var(--text-2); font-weight: 400; }

.tf-input:focus, .tf-select:focus, .tf-textarea:focus {
  outline: none; border-color: #ec4899; 
  background: rgba(0,0,0,0.4);
  box-shadow: 0 0 0 4px rgba(236, 72, 153, 0.15);
}

/* Custom Select Dropdown */
select, .tf-input[type="select"], .tf-select {
  appearance: none;
  background: rgba(0,0,0,0.3) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 16px center;
  background-size: 18px;
  padding-right: 44px;
  cursor: pointer;
}
.tf-input option { background: var(--surface); color: var(--text-1); }

/* ============== Tables (Clean Data Boards) ============== */
.tf-table-wrap {
  width: 100%; overflow: auto; border-radius: var(--radius);
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-soft);
  backdrop-filter: var(--glass-blur);
}
.tf-table { width: 100%; border-collapse: collapse; min-width: 680px; }
.tf-table th, .tf-table td { padding: 16px 20px; text-align: left; border-bottom: 1px solid rgba(255,255,255,0.06); }
.tf-table thead th {
  background: rgba(0,0,0,0.2); font-weight: 800; color: var(--text-2); text-transform: uppercase; font-size: 12px; letter-spacing: 0.05em;
  position: sticky; top: 0; z-index: 1; backdrop-filter: blur(4px);
}
.tf-table tbody tr { transition: background 0.2s ease; }
.tf-table tbody tr:hover { background: rgba(255,255,255,0.04); }
.tf-table tbody tr:last-child td { border-bottom: none; }

/* ============== Badges (Pills) ============== */
.tf-pill {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: 12px; letter-spacing: 0.02em;
  border: 1px solid var(--border); box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.tf-pill.prio-low { background: var(--info-bg); color: var(--info); border-color: rgba(14, 165, 233, 0.4); text-shadow: 0 0 8px rgba(14,165,233,0.5); }
.tf-pill.prio-medium { background: rgba(192, 132, 252, 0.15); color: #e879f9; border-color: rgba(192, 132, 252, 0.4); text-shadow: 0 0 8px rgba(232,121,249,0.5); }
.tf-pill.prio-high { background: var(--warning-bg); color: var(--warning); border-color: rgba(245, 158, 11, 0.4); text-shadow: 0 0 8px rgba(245,158,11,0.5); }
.tf-pill.prio-urgent { background: var(--danger-bg); color: #fca5a5; border-color: rgba(239, 68, 68, 0.4); text-shadow: 0 0 8px rgba(248,113,113,0.5); }

/* ============== Alerts ============== */
.tf-alert {
  border-radius: var(--radius-sm); padding: 14px 18px; margin-bottom: 20px;
  background: rgba(0,0,0,0.3); border: 1px solid var(--border); font-weight: 600;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2); display: flex; align-items: center; gap: 10px;
}
.tf-alert.error { background: var(--danger-bg); border-color: rgba(239, 68, 68, 0.4); color: #fca5a5; }
.tf-alert.success { background: var(--success-bg); border-color: rgba(16, 185, 129, 0.4); color: #6ee7b7; }

/* ============== Empty States ============== */
.tf-empty {
  text-align: center; padding: 40px 20px;
  border: 2px dashed rgba(255,255,255,0.1); border-radius: var(--radius);
  background: rgba(0,0,0,0.2); backdrop-filter: blur(8px);
}
.tf-empty-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.8; }
.tf-empty-title { font-weight: 800; font-size: 18px; color: var(--text-1); margin-bottom: 4px; }
.tf-empty-sub { color: var(--text-2); font-weight: 500; }

/* ============== Progress Bars ============== */
.tf-progress {
  background: rgba(0,0,0,0.06); border-radius: 999px; height: 8px; position: relative; overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.04);
}
.tf-progress > div {
  position: absolute; left: 0; top: 0; height: 100%;
  background: var(--grad-primary); border-radius: 999px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============== Toasts ============== */
#tf-toasts { position: fixed; right: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 12px; z-index: 9999; }
.tf-toast {
  background: rgba(16, 20, 31, 0.9); backdrop-filter: blur(16px); color: #fff;
  border: 1px solid rgba(255,255,255,0.1); border-radius: 14px;
  padding: 14px 18px; box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  min-width: 260px; max-width: 400px; display: flex; align-items: center; gap: 14px; font-weight: 600;
  animation: tf-slide-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}
.tf-toast__close { margin-left: auto; cursor: pointer; opacity: 0.5; transition: opacity 0.2s; }
.tf-toast__close:hover { opacity: 1; }
@keyframes tf-slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Utilities */
.tf-strong { font-weight: 800; color: var(--text-1); }
.tf-dim { color: var(--text-2); font-size: 13px; font-weight: 500; }
.w-full { width: 100%; }

/* Mobile Hiding */
@media (max-width: 768px) {
  .hide-sm { display: none; }
  .tf-topbar-inner { padding: 8px 16px; }
  .tf-container { padding: 12px; }
  .tf-card { padding: 16px; }
  
  /* Topbar Mobile Drawer Adjustments (Handled via overrides in header.php) */
}