/* ============================================================
   TaskFlow JSP - Exact React UI Match
   Override Bootstrap defaults to match Radix + Tailwind design
   ============================================================ */

[x-cloak] { display: none !important; }

:root {
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-350: #c9ccd1;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-900: #111827;
  --blue-50: #eff6ff;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --indigo-50: #eef2ff;
  --indigo-600: #4f46e5;
  --emerald-50: #ecfdf5;
  --emerald-600: #059669;
  --red-50: #fef2f2;
  --red-500: #ef4444;
  --red-600: #dc2626;
  --red-700: #b91c1c;
  --amber-50: #fffbeb;
  --amber-600: #d97706;
  --sidebar-border: #c1c6d7;
  --sidebar-active-bg: #d8e2ff;
  --sidebar-active-text: #0058bc;
  --sidebar-text: #414755;
  --sidebar-hover-bg: #f1f3fe;
  --sidebar-icon: #717786;
  --auth-gradient-start: #f0f4ff;
  --auth-gradient-end: #faf5ff;
}

/* ---- Base ---- */
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--gray-50);
  color: #181c23;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}

.auth-gradient {
  background: linear-gradient(135deg, #eff6ff 0%, #f8faff 40%, #f0fdf4 100%);
  min-height: 100vh;
}

.grid-pattern {
  background-image: radial-gradient(circle, #93c5fd 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.3;
}

/* ---- Card ---- */
.card {
  border-radius: 1rem;
  border: 1px solid var(--gray-200);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.card.auth-card {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -5px rgba(0, 0, 0, 0.02);
  border-radius: 1.25rem;
}

/* ---- Buttons ---- */
.btn {
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: 0.75rem;
  padding: 0.625rem 1.25rem;
  transition: all 0.15s ease;
  border: none;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background-color: var(--blue-600);
  color: #fff;
}

.btn-primary:hover {
  background-color: var(--blue-700);
  box-shadow: 0 4px 6px rgba(37, 99, 235, 0.25);
}

.btn-indigo {
  background-color: var(--indigo-600);
  color: #fff;
}

.btn-indigo:hover {
  background-color: #4338ca;
  box-shadow: 0 4px 6px rgba(79, 70, 229, 0.25);
}

.btn-outline-secondary {
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
  background: transparent;
}

.btn-outline-secondary:hover {
  background: var(--gray-100);
}

/* ---- Form Controls ---- */
.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.375rem;
}

.form-control {
  border-radius: 0.75rem;
  border: 1px solid var(--gray-300);
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control.with-icon {
  padding-left: 2.5rem;
}

.input-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  width: 1rem;
  height: 1rem;
  pointer-events: none;
}

/* ---- Alerts ---- */
.alert-error {
  background-color: var(--red-50);
  border: 1px solid #fecaca;
  color: var(--red-700);
  border-radius: 0.75rem;
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
}

.alert-success {
  background-color: var(--emerald-50);
  border: 1px solid #a7f3d0;
  color: #065f46;
  border-radius: 0.75rem;
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
}

/* ---- Sidebar ---- */
.sidebar {
  width: 15rem;
  min-width: 15rem;
  height: 100vh;
  border-right: 1px solid var(--sidebar-border);
  background: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 50;
  transition: width 0.3s ease, min-width 0.3s ease;
  overflow: hidden;
}

@media (min-width: 992px) {
  .sidebar.collapsed {
    width: 4rem;
    min-width: 4rem;
  }
  .sidebar.collapsed .sidebar-logo {
    justify-content: center;
    padding: 0 0.5rem;
  }
  .sidebar.collapsed .nav-link-custom {
    justify-content: center;
    padding: 0.5rem 0;
    width: 2.5rem;
    margin: 0 auto;
  }
  .sidebar.collapsed .sidebar-footer {
    padding: 0.5rem;
  }
}

.sidebar-logo {
  height: 3.5rem;
  display: flex;
  align-items: center;
  padding: 0 1rem;
  border-bottom: 1px solid var(--sidebar-border);
  gap: 0.75rem;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-size: 1.125rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: #181c23;
  white-space: nowrap;
}

.sidebar-powered {
  font-size: 0.625rem;
  font-weight: 500;
  color: var(--sidebar-icon);
  letter-spacing: 0.05em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  flex-shrink: 0;
}

.nav-link-custom {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--sidebar-text);
  text-decoration: none;
  transition: background 0.15s;
  gap: 0.625rem;
}

.nav-link-custom:hover {
  color: #181c23;
  background: var(--sidebar-hover-bg);
}

.nav-link-custom.active {
  color: var(--sidebar-active-text);
  background: var(--sidebar-active-bg);
}

.nav-link-custom .icon {
  color: var(--sidebar-icon);
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
}

.nav-link-custom.active .icon {
  color: var(--sidebar-active-text);
}

.nav-link-custom:hover .icon {
  color: var(--sidebar-text);
}

.main-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  transition: margin-left 0.3s ease;
}

.main-content.expanded {
  margin-left: 4rem;
}

.main-content:not(.expanded) {
  margin-left: 15rem;
}

/* ---- Topbar ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--sidebar-border);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  height: 3.5rem;
  padding: 0 1.5rem;
  gap: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* ---- Profile Image ---- */
.profile-image {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  object-fit: cover;
}

.profile-image-sm {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  object-fit: cover;
}

/* ---- Badge ---- */
.badge-taskflow {
  font-weight: 600;
  font-size: 0.75rem;
  padding: 0.25em 0.625em;
  border-radius: 9999px;
}

/* ---- Profile image preview overlay ---- */
.profile-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  padding: 1rem;
}

/* ---- Modal ---- */
.modal-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-content {
  border-radius: 1.25rem;
  border: 1px solid #f1f5f9;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.1);
}

.modal-header {
  background: var(--gray-50);
  border-bottom: 1px solid #f1f5f9;
  border-radius: 1.25rem 1.25rem 0 0;
  padding: 1rem 1.5rem;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  border-top: 1px solid #f1f5f9;
  padding: 1rem 1.5rem;
}

.modal-backdrop {
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
}

/* ---- Tables ---- */
.table-taskflow {
  font-size: 0.875rem;
  margin-bottom: 0;
}

.table-taskflow th {
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--gray-200);
}

.table-taskflow td {
  padding: 0.75rem 1rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--gray-100);
}

/* ---- Dropdown ---- */
.dropdown-menu-custom {
  border: 1px solid var(--gray-200);
  border-radius: 0.75rem;
  box-shadow: 0 10px 15px rgba(0, 0, 0, 0.05);
  padding: 0.25rem;
}

.dropdown-menu-custom .dropdown-item {
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--gray-700);
}

.dropdown-menu-custom .dropdown-item:hover {
  background: var(--gray-50);
}

/* ---- Transitions ---- */
.fade-in {
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* ---- Page header ---- */
.page-header {
  padding: 1.5rem 2rem 1rem;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--gray-900);
}

.page-subtitle {
  font-size: 0.875rem;
  color: var(--gray-500);
}

/* ---- Stat cards ---- */
.stat-card {
  padding: 1.25rem;
  border-radius: 0.75rem;
  border: 1px solid var(--gray-200);
  background: #fff;
}

.stat-card .stat-value {
  font-size: 1.875rem;
  font-weight: 800;
  letter-spacing: -0.025em;
}

.stat-card .stat-label {
  font-size: 0.8125rem;
  color: var(--gray-500);
  font-weight: 500;
}

/* ---- Spinner ---- */
.spinner-custom {
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---- Icon wrapper ---- */
.icon-wrapper {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- Checkbox custom ---- */
.form-check-input-custom {
  width: 1rem;
  height: 1rem;
  border-radius: 0.25rem;
  cursor: pointer;
  margin-top: 0.125rem;
  flex-shrink: 0;
}

/* ---- OTP input ---- */
.otp-input {
  text-align: center;
  font-size: 1.5rem;
  letter-spacing: 0.5em;
  font-family: 'SF Mono', 'Fira Code', monospace;
  height: 3rem;
  border-radius: 0.75rem;
}

/* ---- New Project button ---- */
.btn-new-project {
  background: var(--sidebar-active-text);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.25rem;
  border: none;
  transition: all 0.15s;
  cursor: pointer;
}

.btn-new-project:focus,
.btn-new-project:focus-visible {
  outline: none;
}

.btn-new-project:active {
  opacity: 0.8;
}

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray-500);
}

.empty-state .empty-icon {
  width: 3rem;
  height: 3rem;
  margin-bottom: 1rem;
  color: var(--gray-300);
}

/* ---- Notifications ---- */
.notif-dropdown {
  width: 22rem;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 0.75rem;
  box-shadow: 0 10px 15px rgba(0, 0, 0, 0.05);
  z-index: 50;
  margin-top: 0.5rem;
  max-height: 26rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.625rem;
  border-radius: 0.5rem;
  text-decoration: none;
  transition: background 0.15s;
}

.notif-item:hover {
  background: #f9fafb;
}

.notif-item.unread {
  background: #f0f4ff;
}

.notif-item.unread:hover {
  background: #e0e7ff;
}

.notif-icon-box {
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notif-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #111827;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notif-message {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.125rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notif-time {
  font-size: 0.625rem;
  color: #9ca3af;
  white-space: nowrap;
  flex-shrink: 0;
}

.notif-unread-dot {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 50%;
  background: #2563eb;
  flex-shrink: 0;
  margin-top: 0.375rem;
}

.notif-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: #dc2626;
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  min-width: 1rem;
  height: 1rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.25rem;
  line-height: 1;
}

.notif-empty {
  text-align: center;
  padding: 2rem 1rem;
  font-size: 0.8125rem;
  color: #9ca3af;
}

.notif-empty-icon {
  font-size: 1.5rem;
  display: block;
  margin-bottom: 0.5rem;
  color: #d1d5db;
}

@media (max-width: 480px) {
  .notif-dropdown {
    width: 20rem;
    right: -4rem;
  }
}

@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .main-content:not(.expanded) {
    margin-left: 0;
  }
}

@media (min-width: 992px) {
  .sidebar-overlay {
    display: none !important;
  }
}
