/* ============================================================
   TASKFLOW - MAIN STYLES
   ============================================================ */

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

:root {
  --primary: #3B82F6;
  --primary-dark: #2563EB;
  --primary-light: #EFF6FF;
  --success: #10B981;
  --success-light: #ECFDF5;
  --warning: #F59E0B;
  --warning-light: #FFFBEB;
  --danger: #EF4444;
  --danger-light: #FEF2F2;
  --purple: #8B5CF6;
  --cyan: #06B6D4;
  --orange: #F97316;
  --pink: #EC4899;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;
  --bg: #F3F4F6;
  --surface: #FFFFFF;
  --surface-2: #F9FAFB;
  --border: #E5E7EB;
  --text: #111827;
  --text-muted: #6B7280;
  --text-light: #9CA3AF;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.16);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --topbar-h: 60px;
  --bottomnav-h: 64px;
  --sidebar-w: 260px;
  --transition: 0.2s ease;
}

html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  height: 100%;
  min-height: 100%;
}

/* ============================================================
   SPLASH SCREEN
   ============================================================ */
.splash-screen {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #1E40AF 0%, #3B82F6 40%, #06B6D4 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  transition: opacity 0.4s, visibility 0.4s;
}
.splash-screen.fade-out { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-content { text-align: center; color: white; padding: 32px; }
.splash-icon {
  width: 100px; height: 100px;
  background: rgba(255,255,255,0.15);
  border-radius: 28px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  font-size: 48px;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  animation: pulse-splash 2s infinite;
}
@keyframes pulse-splash {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
.splash-title { font-size: 36px; font-weight: 800; letter-spacing: -1px; margin-bottom: 8px; }
.splash-subtitle { font-size: 16px; opacity: 0.8; font-weight: 300; letter-spacing: 1px; }
.splash-loader { margin-top: 60px; }
.loader-bar { width: 200px; height: 4px; background: rgba(255,255,255,0.2); border-radius: 2px; overflow: hidden; margin: 0 auto 12px; }
.loader-progress { height: 100%; background: white; border-radius: 2px; width: 0%; transition: width 2.5s ease; }
.loader-text { font-size: 13px; opacity: 0.7; }

/* ============================================================
   AUTH SCREEN
   ============================================================ */
.auth-screen {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #1E40AF 0%, #3B82F6 50%, #06B6D4 100%);
  display: flex; align-items: center; justify-content: center;
  overflow-y: auto; padding: 20px;
  z-index: 100;
}
.auth-bg {
  position: absolute; inset: 0; overflow: hidden;
}
.auth-blob {
  position: absolute; border-radius: 50%;
  opacity: 0.15;
}
.blob-1 {
  width: 400px; height: 400px;
  background: white;
  top: -100px; right: -100px;
  animation: blob-float 8s ease-in-out infinite;
}
.blob-2 {
  width: 300px; height: 300px;
  background: #A78BFA;
  bottom: -50px; left: -80px;
  animation: blob-float 10s ease-in-out infinite reverse;
}
@keyframes blob-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(20px, -30px) scale(1.1); }
}
.auth-container {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 32px 28px;
  width: 100%; max-width: 400px;
  position: relative; z-index: 1;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.4s ease;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}
.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-logo-icon {
  width: 68px; height: 68px;
  background: linear-gradient(135deg, #3B82F6, #06B6D4);
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; color: white;
  margin: 0 auto 12px;
  box-shadow: 0 4px 16px rgba(59,130,246,0.4);
}
.auth-logo h1 { font-size: 26px; font-weight: 800; color: var(--text); }
.auth-logo p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.auth-tabs {
  display: flex; gap: 4px;
  background: var(--gray-100);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 24px;
}
.auth-tab {
  flex: 1; padding: 10px;
  border: none; border-radius: calc(var(--radius) - 2px);
  background: transparent;
  font-weight: 600; font-size: 14px;
  color: var(--text-muted);
  cursor: pointer; transition: all var(--transition);
}
.auth-tab.active {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.auth-demo {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.auth-demo p { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }
.btn-demo {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: var(--gray-100);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px; font-weight: 500;
  color: var(--text);
  cursor: pointer;
  margin: 3px;
  transition: all var(--transition);
}
.btn-demo:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

.recovery-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px;
}
.recovery-header h3 { font-size: 18px; font-weight: 700; }
.recovery-text { font-size: 14px; color: var(--text-muted); margin-bottom: 20px; }

/* ============================================================
   MAIN APP LAYOUT
   ============================================================ */
.main-app { min-height: 100vh; display: flex; flex-direction: column; }

/* TOP BAR */
.top-bar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  z-index: 500;
  box-shadow: var(--shadow-sm);
}
.btn-menu {
  width: 40px; height: 40px;
  border: none; background: transparent;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--text);
  cursor: pointer;
  transition: background var(--transition);
}
.btn-menu:hover { background: var(--gray-100); }
.top-title { flex: 1; font-size: 17px; font-weight: 700; color: var(--text); }
.top-actions { display: flex; align-items: center; gap: 6px; }
.btn-icon {
  width: 38px; height: 38px;
  border: none; background: transparent;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.btn-icon:hover { background: var(--gray-100); color: var(--text); }
.notif-badge {
  position: absolute; top: 4px; right: 4px;
  width: 16px; height: 16px;
  background: var(--danger);
  border-radius: 50%;
  font-size: 10px; font-weight: 700;
  color: white;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface);
}
.user-avatar-small {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  color: white; cursor: pointer;
  transition: transform var(--transition);
}
.user-avatar-small:hover { transform: scale(1.05); }

/* SIDEBAR */
.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 800;
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active { opacity: 1; pointer-events: all; }
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  z-index: 900;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
}
.sidebar.open { transform: translateX(0); }
.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 20px; font-weight: 800; color: var(--primary);
}
.sidebar-logo i { font-size: 22px; }
.btn-close-sidebar {
  width: 32px; height: 32px;
  border: none; background: var(--gray-100);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 14px;
  color: var(--text-muted);
}
.sidebar-user {
  display: flex; align-items: center; gap: 12px;
  padding: 16px;
  background: var(--primary-light);
}
.user-avatar {
  width: 46px; height: 46px;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700;
  color: white; flex-shrink: 0;
}
.user-info .user-name { font-size: 14px; font-weight: 700; color: var(--text); }
.user-info .user-role { font-size: 12px; color: var(--text-muted); }
.sidebar-menu { flex: 1; padding: 12px 0; }
.menu-section { padding: 8px 0; }
.menu-label {
  font-size: 10px; font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-light);
  padding: 4px 20px 8px;
  display: block;
}
.menu-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px;
  font-size: 14px; font-weight: 500;
  color: var(--text-muted);
  text-decoration: none; cursor: pointer;
  border: none; background: transparent; width: 100%;
  transition: all var(--transition);
  border-radius: 0;
  position: relative;
}
.menu-item:hover { background: var(--gray-100); color: var(--text); }
.menu-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}
.menu-item.active::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--primary);
  border-radius: 0 2px 2px 0;
}
.menu-item i { width: 20px; text-align: center; font-size: 15px; }
.menu-badge {
  margin-left: auto;
  background: var(--danger);
  color: white; border-radius: 10px;
  padding: 2px 7px; font-size: 11px; font-weight: 700;
}
.menu-logout { color: var(--danger) !important; }
.menu-logout:hover { background: var(--danger-light) !important; }

/* PAGE CONTENT */
.page-content {
  padding-top: var(--topbar-h);
  padding-bottom: calc(var(--bottomnav-h) + 16px);
  min-height: 100vh;
  overflow-y: auto;
}
.page { padding: 20px 16px; animation: fadeIn 0.3s ease; }
.page.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; gap: 12px;
}
.page-title { font-size: 20px; font-weight: 800; color: var(--text); }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* BOTTOM NAV */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--bottomnav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-around;
  z-index: 500;
  padding: 0 4px;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
}
.bnav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  gap: 3px; padding: 8px 4px;
  border: none; background: transparent;
  font-size: 10px; font-weight: 500;
  color: var(--text-muted); cursor: pointer;
  transition: color var(--transition);
  max-width: 80px;
}
.bnav-item i { font-size: 20px; }
.bnav-item.active { color: var(--primary); }
.bnav-fab {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  border-radius: 50%;
  border: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: white;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(59,130,246,0.4);
  transform: translateY(-8px);
  transition: transform var(--transition), box-shadow var(--transition);
  flex-shrink: 0;
}
.bnav-fab:hover { transform: translateY(-10px); box-shadow: 0 6px 20px rgba(59,130,246,0.5); }

/* FAB */
.fab-btn {
  position: fixed; right: 20px; bottom: 84px;
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 50%; border: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: white;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(59,130,246,0.4);
  z-index: 400;
  display: none; /* Hidden on mobile, using bottom nav FAB */
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--text-muted); margin-bottom: 6px;
}
.form-group label i { margin-right: 6px; }
.form-input, .form-textarea, .form-select {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px; font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
  -webkit-appearance: none;
}
.form-input:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-footer { text-align: right; margin-bottom: 16px; }
.input-password { position: relative; }
.input-password .form-input { padding-right: 42px; }
.btn-eye {
  position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%);
  border: none; background: transparent;
  color: var(--text-muted); cursor: pointer;
  font-size: 15px;
}
.form-tabs {
  display: flex; gap: 4px;
  background: var(--gray-100);
  border-radius: var(--radius-sm);
  padding: 4px; margin-bottom: 20px;
}
.ftab {
  flex: 1; padding: 8px 12px;
  border: none; border-radius: calc(var(--radius-sm) - 2px);
  background: transparent; font-size: 13px; font-weight: 600;
  color: var(--text-muted); cursor: pointer;
  transition: all var(--transition);
}
.ftab.active { background: white; color: var(--primary); box-shadow: var(--shadow-sm); }
.form-tab.hidden { display: none; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white; border: none; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(59,130,246,0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(59,130,246,0.4); }
.btn-primary:active { transform: translateY(0); }
.btn-primary.btn-full { width: 100%; }
.btn-primary.btn-sm { padding: 8px 14px; font-size: 13px; }

.btn-outline {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px;
  background: transparent;
  color: var(--primary); border: 1.5px solid var(--primary);
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-outline:hover { background: var(--primary-light); }
.btn-outline.btn-full { width: 100%; }
.btn-outline.btn-sm { padding: 8px 14px; font-size: 13px; }

.btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px;
  background: var(--danger); color: white;
  border: none; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: all var(--transition);
}
.btn-danger.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-link {
  background: none; border: none;
  color: var(--primary); font-size: 13px; font-weight: 600;
  cursor: pointer; text-decoration: none;
  font-family: inherit;
}
.btn-link:hover { text-decoration: underline; }
.btn-back {
  width: 32px; height: 32px;
  border: none; background: var(--gray-100);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text);
}
.btn-sm { padding: 7px 14px; font-size: 13px; }

/* ============================================================
   UTILITIES
   ============================================================ */
.hidden { display: none !important; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.text-red { color: var(--danger); }
.text-green { color: var(--success); }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }

/* TOAST */
.toast-container {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none; width: min(400px, 90vw);
}
.toast {
  background: var(--gray-800); color: white;
  padding: 12px 16px; border-radius: var(--radius);
  font-size: 14px; font-weight: 500;
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.3s ease;
  pointer-events: all;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); color: var(--gray-900); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(20px); }
}
