:root {
  --primary: #4f46e5; /* Indigo */
  --primary-dark: #4338ca;
  --secondary: #64748b;
  --bg-body: #f3f4f6;
  --bg-card: #ffffff;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --border: #e5e7eb;

  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  --radius: 8px;
  --shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Dark Mode Variables */
body.dark-mode {
  --bg-body: #111827;
  --bg-card: #1f2937;
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --border: #374151;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: "Inter", sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
}

/* --- Utilities --- */
.hidden {
  display: none !important;
}
.mb-2 {
  margin-bottom: 0.5rem;
}
.mb-4 {
  margin-bottom: 1rem;
}
.mb-6 {
  margin-bottom: 1.5rem;
}
.mt-2 {
  margin-top: 0.5rem;
}
.mt-4 {
  margin-top: 1rem;
}
.mt-6 {
  margin-top: 1.5rem;
}
.mt-8 {
  margin-top: 2rem;
}
.mr-4 {
  margin-right: 1rem;
}
.ml-auto {
  margin-left: auto;
}
.text-center {
  text-align: center;
}
.text-muted {
  color: var(--text-muted);
}
.text-sm {
  font-size: 0.875rem;
}
.text-xs {
  font-size: 0.75rem;
}
.text-lg {
  font-size: 1.125rem;
}
.font-bold {
  font-weight: 600;
}
.font-medium {
  font-weight: 500;
}
.uppercase {
  text-transform: uppercase;
}
.italic {
  font-style: italic;
}
.w-100 {
  width: 100%;
}
.text-primary {
  color: var(--primary);
}
.gap-2 {
  gap: 0.5rem;
}
.cursor-pointer {
  cursor: pointer;
}
.text-success {
  color: var(--success);
}
.text-danger {
  color: var(--danger);
}
.text-red {
  color: #ef4444;
}
.text-red:hover {
  color: #f87171;
  text-shadow: 0 0 12px rgba(239, 68, 68, 0.6);
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.flex-start {
  display: flex;
  align-items: center;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}
.grid-2-1 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}
form .grid-2 {
  margin-bottom: 1rem;
}
.grid-2 .form-group {
  margin-bottom: 0;
}

/* --- Components --- */
.btn {
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-weight: 500;
  transition: 0.2s;
  font-size: 0.9rem;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #818cf8 100%);
  color: white;
  background-size: 200% auto;
  transition: 0.5s;
  position: relative;
  overflow: hidden;
  z-index: 1;
}
.btn-primary:hover {
  background-position: right center;
}
.btn-primary span {
  position: relative;
  z-index: 2;
}

.btn-primary::before,
.btn-primary::after {
  content: "";
  position: absolute;
  width: 500px;
  height: 500px;
  bottom: -460px;
  left: 50%;
  margin-left: -250px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 40% 45% 35% 40%;
  animation: btn-wave-rotate 6s infinite linear;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.6s ease-in-out;
}

.btn-primary:hover::before,
.btn-primary:hover::after {
  opacity: 1;
}

.btn-primary::after {
  bottom: -470px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 35% 40% 45% 35%;
  animation: btn-wave-rotate 8s infinite linear reverse;
}

@keyframes btn-wave-rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.btn-outline {
  background-color: transparent;
  border: 1px solid var(--border);
  color: var(--text-main);
}
.btn-outline:hover {
  background-color: #f9fafb;
}
.btn-text {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}
.btn-text:hover {
  color: var(--primary);
}
.btn-block {
  width: 100%;
  display: block;
}
.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.25rem;
  position: relative;
}
.btn-icon:hover {
  color: var(--primary);
}

.btn-icon.text-red:hover {
  background-color: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* Btn Danger */
.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
  color: white;
}
.btn-danger:hover {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
}

/* Notification Dot */
.notification-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  background-color: #ef4444;
  border-radius: 50%;
  border: 1px solid var(--primary);
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease,
    border-color 0.3s ease;
}
.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
  border-color: var(--primary);
}
.card.no-hover:hover {
  transform: none;
  box-shadow: var(--shadow);
  border-color: var(--border);
  cursor: default;
}
.input {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s;
  background-color: var(--bg-body);
  color: var(--text-main);
}
.input:focus {
  border-color: var(--primary);
}
.input.valid {
  border-color: var(--success);
  background-color: rgba(16, 185, 129, 0.05);
}
.input.invalid {
  border-color: var(--danger);
  background-color: rgba(239, 68, 68, 0.05);
}
.form-group {
  margin-bottom: 1rem;
}
.form-group label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  font-weight: 500;
}

/* Password Toggle */
.password-wrapper {
  position: relative;
}
.password-wrapper .input {
  padding-right: 2.5rem;
}
.toggle-password {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: var(--text-muted);
  z-index: 10;
}

/* Password Strength Meter */
.strength-meter {
  margin-top: 0.5rem;
  display: block;
}
.strength-bars {
  display: flex;
  gap: 4px;
  margin-bottom: 0.25rem;
}
.strength-bar {
  height: 4px;
  flex: 1;
  background: var(--border);
  border-radius: 2px;
  transition: all 0.3s;
}

.strength-weak .strength-bar:nth-child(1) {
  background: linear-gradient(90deg, #ef4444, #f87171);
}
.strength-medium .strength-bar:nth-child(1),
.strength-medium .strength-bar:nth-child(2) {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}
.strength-strong .strength-bar {
  background: linear-gradient(90deg, #10b981, #34d399);
}

.badge {
  padding: 0.25rem 0.6rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-green {
  background-color: #d1fae5;
  color: #065f46;
}
.badge-yellow {
  background-color: #fef3c7;
  color: #92400e;
}
.badge-blue {
  background-color: #dbeafe;
  color: #1e40af;
}
.badge-red {
  background-color: #fee2e2;
  color: #991b1b;
}

/* --- Login View --- */
#view-login,
#view-signup,
#view-forgot-password {
  height: 100vh;
  display: flex;
  align-items: flex-start; /* Permet le scroll si le contenu dépasse */
  justify-content: center;
  background-color: #f3f4f6;
  background-image: radial-gradient(
    circle at 50% 50%,
    #e0e7ff 0%,
    #f3f4f6 100%
  );
  padding: 1rem;
  overflow-y: auto; /* Active le scroll */

  /* Force le thème clair pour ces pages */
  --bg-body: #f3f4f6;
  --bg-card: #ffffff;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --primary: #4f46e5;
  color: var(--text-main);
}

/* Global App Background for Dashboard */
body.app-background {
  background-image: radial-gradient(
    circle at 50% 50%,
    #e0e7ff 0%,
    #f3f4f6 100%
  );
}
body.dark-mode.app-background {
  background-color: #111827;
  background-image: radial-gradient(
    circle at 50% 50%,
    #1e1b4b 0%,
    #111827 100%
  );
}

.login-container {
  width: 100%;
  max-width: 1000px;
  margin: auto;
}

.login-wrapper {
  display: flex;
  background: white;
  border-radius: 24px;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  min-height: 600px;
}

.login-visual {
  flex: 1;
  position: relative;
  background-color: var(--primary);
  display: flex;
  align-items: flex-end;
  padding: 3rem;
  color: white;
  overflow: hidden;
}

.login-bg-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.8;
  mix-blend-mode: overlay;
  animation: bg-breathe 25s infinite alternate ease-in-out;
  z-index: 0;
}

@keyframes bg-breathe {
  0% {
    transform: scale(1);
  }
  100% {
    transform: scale(1.15) rotate(1deg);
  }
}

/* Animation Vagues */
.login-visual::before,
.login-visual::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -190%;
  width: 300%;
  height: 300%;
  margin-left: -150%;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 40% 45% 35% 40%;
  animation: wave-rotate 14s infinite linear;
  z-index: 1;
}

.login-visual::after {
  bottom: -195%;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 35% 40% 45% 35%;
  animation: wave-rotate 9s infinite linear reverse;
}

.wave-layer {
  position: absolute;
  left: 50%;
  bottom: -185%;
  width: 300%;
  height: 300%;
  margin-left: -150%;
  background-color: rgba(255, 255, 255, 0.08);
  border-radius: 45% 35% 40% 45%;
  animation: wave-rotate 11s infinite linear;
  z-index: 1;
}

@keyframes wave-rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.visual-content {
  position: relative;
  z-index: 2;
}
.visual-content h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
  line-height: 1.2;
  font-weight: 700;
}
.visual-content p {
  opacity: 0.9;
  font-size: 1.1rem;
}

.login-form-side {
  flex: 1;
  padding: 4rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Brand Logo definition kept generic */
.brand-logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* --- App Layout --- */
#app-layout {
  display: flex;
  height: 100vh;
}

/* Floating App Layout (Dashboard) */
body.app-background #app-layout {
  margin: 0;
  width: 100%;
  max-width: none;
  height: 100vh;
  background: var(--bg-card);
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--primary);
  color: white;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  overflow-y: hidden;
  overflow-x: hidden;
  transition:
    width 0.3s ease,
    padding 0.3s ease;
}

/* Sidebar Waves */
.sidebar-bg-waves {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
.sidebar-bg-waves::before,
.sidebar-bg-waves::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -50%;
  width: 200%;
  height: 100%;
  margin-left: -100%;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 40%;
  animation: wave-rotate 15s infinite linear;
}
.sidebar-bg-waves::after {
  bottom: -55%;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 45%;
  animation: wave-rotate 20s infinite linear reverse;
}

/* Sidebar Content (Above Waves) */
.sidebar-header,
.project-context,
.sidebar-nav,
.sidebar-footer {
  position: relative;
  z-index: 1;
}

.sidebar-header {
  margin-bottom: 2rem;
  white-space: nowrap;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand-logo.white {
  color: white;
}

.project-context {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.75rem;
  border-radius: var(--radius);
  margin-bottom: 2rem;
  backdrop-filter: blur(5px);
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.2s;
}
.project-context .text-muted {
  color: rgba(255, 255, 255, 0.8);
}
.project-selector {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.25rem;
  cursor: pointer;
}
.project-selector i {
  transition: transform 0.3s ease;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  transition: 0.2s;
  white-space: nowrap;
}
.nav-item i {
  width: 1.5rem;
  text-align: center;
  flex-shrink: 0;
}
.nav-item:hover,
.nav-item.active {
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  white-space: nowrap;
}
.back-to-projects {
  text-decoration: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.back-to-projects:hover {
  color: white;
}

.sidebar .btn-icon {
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.1rem;
}
.sidebar .btn-icon:hover {
  color: white;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.8);
}
.sidebar .btn-icon i {
  transition: transform 0.3s ease;
}
/* Force red hover for logout in sidebar */
.sidebar .btn-icon.text-red:hover {
  color: #ef4444;
  text-shadow: 0 0 15px rgba(239, 68, 68, 0.6);
}

/* Collapsed Sidebar State */
.sidebar.collapsed {
  width: 80px;
  padding: 1.5rem 0.75rem;
}
.sidebar.collapsed .sidebar-header {
  justify-content: center;
}

/* Hide text in collapsed mode */
.sidebar.collapsed .brand-logo {
  display: none;
}

.sidebar.collapsed .project-context {
  opacity: 0;
  pointer-events: none;
  height: 0;
  margin: 0;
  padding: 0;
}
.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 0.75rem;
  gap: 0;
}
.sidebar.collapsed .nav-item i {
  margin: 0;
  font-size: 1.2rem;
}
.sidebar.collapsed .nav-item span, /* If text wrapped */
.sidebar.collapsed .nav-item {
  font-size: 0;
} /* Hide text hack */
.sidebar.collapsed .nav-item i {
  font-size: 1.2rem;
} /* Restore icon */

.sidebar.collapsed .back-to-projects {
  justify-content: center;
  gap: 0;
}
.sidebar.collapsed .back-to-projects i {
  margin: 0;
}
.sidebar.collapsed .back-to-projects {
  font-size: 0;
}
.sidebar.collapsed .back-to-projects i {
  font-size: 1rem;
}

.sidebar.collapsed .user-profile-sidebar {
  justify-content: center;
}
.sidebar.collapsed .user-profile-sidebar > div:last-child {
  display: none;
}

/* Sidebar Tools (Bottom) */
.sidebar-tools {
  display: flex;
  justify-content: space-between;
  gap: 0;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-top: 0;
}
.sidebar.collapsed .sidebar-tools {
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

/* Notification Panel */
.notification-panel {
  position: fixed;
  bottom: 90px;
  left: 20px;
  width: 320px;
  background: white;
  border-radius: var(--radius);
  box-shadow:
    0 10px 25px -5px rgba(0, 0, 0, 0.1),
    0 8px 10px -6px rgba(0, 0, 0, 0.1);
  z-index: 10005;
  overflow: hidden;
  animation: slideUpFade 0.3s ease;
  border: 1px solid var(--border);
}

body.dark-mode .notification-panel {
  background: var(--bg-card);
  border-color: var(--border);
}

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

.notification-list {
  max-height: 300px;
  overflow-y: auto;
}

.notification-item {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 0.75rem;
  align-items: center;
  transition: background 0.2s;
  background: white;
}
.notification-item:last-child {
  border-bottom: none;
}
.notification-item.unread {
  background: rgba(79, 70, 229, 0.1);
}

.notification-icon {
  color: var(--primary);
  font-size: 1.2rem;
  min-width: 24px;
  text-align: center;
}

.btn-delete-notif {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}
.btn-delete-notif:hover {
  color: var(--danger);
}

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

/* Project Dropdown Menu */
.project-dropdown {
  margin-top: 0.5rem;
  background: rgba(0, 0, 0, 0.6);
  border-radius: var(--radius);
  padding: 0.5rem;
  animation: fadeIn 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Scrollbar for sidebar and dropdowns */
.sidebar::-webkit-scrollbar,
.project-dropdown::-webkit-scrollbar {
  width: 4px;
}
.sidebar::-webkit-scrollbar-track,
.project-dropdown::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar::-webkit-scrollbar-thumb,
.project-dropdown::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}
.sidebar::-webkit-scrollbar-thumb:hover,
.project-dropdown::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.project-item {
  padding: 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
  transition: background 0.2s;
}

.project-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.project-item.active {
  color: white;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
}

.project-item-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 0.5rem 0;
}

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

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.top-header {
  height: 64px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2rem;
}
.user-profile {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.avatar {
  width: 36px;
  height: 36px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
}
.avatar-lg {
  width: 48px;
  height: 48px;
  background: #e0e7ff;
  color: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.content-body {
  padding: 2rem;
  overflow-y: auto;
  height: calc(100vh - 64px);
}

/* --- Specific Views --- */
.project-card {
  transition: transform 0.2s;
}
.project-card:hover {
  transform: translateY(-4px);
}
.card-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.icon-box {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}
.bg-blue {
  background: #3b82f6;
}
.bg-purple {
  background: #8b5cf6;
}
.bg-green {
  background: #10b981;
}

.stat-card .stat-value {
  font-size: 1.8rem;
  margin: 0.5rem 0;
}
.stat-trend {
  font-size: 0.85rem;
  font-weight: 500;
}
.stat-trend.positive {
  color: var(--success);
}
.stat-trend.negative {
  color: var(--danger);
}

/* Fake Chart */
.fake-chart {
  height: 200px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.bar {
  width: 10%;
  background: #e0e7ff;
  border-radius: 4px 4px 0 0;
  transition: height 1s;
}
.bar:hover {
  background: var(--primary);
}
.chart-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Table */
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th {
  text-align: left;
  padding: 1rem;
  background: var(--bg-body);
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}
.table th.text-center {
  text-align: center;
}
.table th.text-right {
  text-align: right;
}
.table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.table tr:last-child td {
  border-bottom: none;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10010;
}
.modal {
  background: white;
  width: 95%;
  max-width: 450px;
  border-radius: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  animation: slideIn 0.3s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 90%;
}
.modal-header {
  padding: 1.5rem 2rem 0.5rem;
  border-bottom: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.modal-body {
  padding: 1rem 2rem 2rem;
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.5;
  overflow-y: auto;
}
.modal-footer {
  padding: 0 2rem 2rem;
  background: transparent;
  border-top: none;
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  flex-shrink: 0;
}

/* Dark mode adjustments for modal */
body.dark-mode .modal {
  background: var(--bg-card);
}
body.dark-mode .modal-header h3 {
  color: var(--text-main);
}
body.dark-mode .modal-body {
  color: var(--text-muted);
}

.modal-large {
  max-width: 1100px;
}

.modal-medium {
  max-width: 720px;
}

.form-grid {
  display: grid;
  gap: 1rem;
}

.campaign-preview {
  margin-top: 1.5rem;
  padding: 1rem;
  border: 1px solid var(--border-light);
  border-radius: 16px;
  background: var(--bg-secondary);
  display: grid;
  gap: 0.75rem;
}

.campaign-preview .preview-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.prospects-toolbar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

/* Modal Large & Grid for Preview */
#modal-project .modal {
  max-width: 900px;
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.preview-label {
  display: block;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
}

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

/* Custom Projects Header */
.projects-header-custom {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  position: relative;
  margin-bottom: 3rem;
  padding: 1rem 0;
  min-height: 80px;
}

.centered-logo-bubble {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  padding: 0.8rem 2rem;
  border-radius: 50px;
  box-shadow: var(--shadow);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--border);
}

.btn-big-plus {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: var(--primary);
  color: white;
  border: none;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
  transition: all 0.2s;
}

.btn-big-plus:hover {
  transform: scale(1.1) rotate(90deg);
  background-color: var(--primary-dark);
}

/* --- Projects View Styling (Form Style) --- */
.projects-view {
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 100px 1rem 2rem;
}

.projects-wrapper {
  background: var(--bg-card);
  border-radius: 24px;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.1);
  padding: 3rem;
  width: 100%;
  max-width: 1000px;
  margin: auto;
}

/* --- Nouveaux Styles Cartes Projets (Minimalistes) --- */
.project-card-minimal {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 200px; /* Hauteur fixe pour uniformité */
  padding: 0;
  overflow: hidden;
  position: relative;
  border: none;
}

.project-card-minimal:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.project-card-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  transition: transform 0.5s;
}

.project-card-minimal:hover .project-card-bg {
  transform: scale(1.05);
}

.project-status {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.project-card-footer {
  position: relative;
  z-index: 1;
  background: var(--primary);
  color: white;
  padding: 1rem;
  border-top: none;
  text-align: center;
  overflow: hidden;
}

.project-card-footer::before,
.project-card-footer::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -165px;
  width: 200px;
  height: 200px;
  margin-left: -100px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 40% 45% 35% 40%;
  animation: wave-rotate 14s infinite linear;
  z-index: 0;
}

.project-card-footer::after {
  bottom: -170px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 35% 40% 45% 35%;
  animation: wave-rotate 12s infinite linear reverse;
  animation-delay: -5s;
}

/* Varier l'animation pour éviter la répétition visuelle sur la grille */
.project-card-minimal:nth-child(2n) .project-card-footer::before {
  animation-delay: -3s;
}
.project-card-minimal:nth-child(2n) .project-card-footer::after {
  animation-delay: -9s;
}

.project-date {
  color: rgba(255, 255, 255, 0.8);
  opacity: 1;
  font-size: 0.85rem;
  margin-top: 0.25rem;
  display: block;
  position: relative;
  z-index: 2;
}

.project-card-footer h3 {
  position: relative;
  z-index: 2;
}

.card-add-project {
  border: 2px dashed var(--border);
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  min-height: 200px;
  transition: all 0.2s;
  color: var(--text-muted);
  box-shadow: none;
}

.card-add-project:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #f9fafb;
  transform: translateY(-5px);
}

.card-add-project i {
  font-size: 3.5rem;
  margin-bottom: 0.5rem;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .grid-3,
  .grid-4,
  .grid-2-1,
  .grid-2 {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Configuration Sidebar Mobile */
  .sidebar {
    display: flex !important; /* Force l'affichage */
    position: fixed;
    top: 0;
    left: -100%; /* Caché hors écran par défaut */
    height: 100dvh;
    width: 85%;
    max-width: 320px;
    z-index: 9999;
    transition: left 0.3s ease;
    box-shadow: 5px 0 15px rgba(0, 0, 0, 0.2);
  }
  .sidebar.mobile-open {
    left: 0;
  } /* Affiche le menu */
  .mobile-column-reverse {
    display: flex !important;
    flex-direction: column-reverse !important;
    gap: 1rem;
  }

  /* Augmentation taille texte menu mobile */
  .nav-item {
    font-size: 1.2rem;
  }
  .back-to-projects {
    font-size: 1.1rem;
  }
}

/* Désactiver le scroll sidebar sur Desktop uniquement */
@media (min-width: 1025px) {
  .sidebar {
    overflow-y: hidden;
  }
}

/* --- Dashboard New KPIs --- */
.funnel-row {
  display: flex;
  align-items: center;
  margin-bottom: 0.8rem;
  gap: 1rem;
}
.funnel-label {
  width: 100px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}
.funnel-bar-container {
  flex: 1;
  height: 12px;
  background: var(--bg-body);
  border-radius: 6px;
  overflow: hidden;
}
.funnel-bar {
  height: 100%;
  border-radius: 6px;
}
.funnel-value {
  width: 50px;
  text-align: right;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-main);
}

.action-list {
  list-style: none;
}
.action-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.action-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.action-item:first-child {
  padding-top: 0;
}
.action-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.9rem;
}
.bg-red-light {
  background: #fef2f2;
  color: #ef4444;
}
.bg-orange-light {
  background: #fffbeb;
  color: #f59e0b;
}
.bg-purple-light {
  background: #f3e8ff;
  color: #7c3aed;
}

.kpi-mini-card {
  padding: 1.25rem;
}
.kpi-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

/* Toggle Filter */
.toggle-filter {
  background: var(--bg-body);
  padding: 4px;
  border-radius: 8px;
  display: inline-flex;
  gap: 4px;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.toggle-btn {
  padding: 4px 12px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}
.toggle-btn:hover {
  color: var(--text-main);
}
.toggle-btn.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
  .login-wrapper {
    flex-direction: column;
    min-height: auto;
    background: transparent; /* Fond transparent pour voir les vagues */
    box-shadow: none;
    position: relative;
    overflow: visible;
  }
  .login-visual {
    display: block; /* Affiche le bloc visuel */
    position: absolute; /* Le place en fond */
    position: fixed; /* Le place en fond de tout l'écran */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    z-index: 0;
  }
  .login-visual img,
  .visual-content {
    display: none;
  } /* Cache l'image et le texte, garde les vagues */
  .login-form-side {
    padding: 2rem;
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 0.85); /* Fond semi-transparent */
    backdrop-filter: blur(10px);
    border-radius: 24px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
  }
  .projects-wrapper {
    padding: 1.5rem;
  }
  .modal-grid {
    grid-template-columns: 1fr;
  }

  /* Mobile Login Adjustments */
  .login-form-side .flex-between {
    flex-direction: column;
    gap: 1rem;
  }

  /* Mobile Notification Panel */
  .notification-panel {
    bottom: 20px;
    left: 20px;
    right: 20px;
    width: auto;
    max-height: 70vh;
    overflow-y: auto;
  }

  .toggle-filter {
    width: 100%;
    display: flex;
  }
  .toggle-btn {
    flex: 1;
  }

  /* Compact Sidebar for Mobile to avoid scrolling */
  .sidebar {
    padding: 1rem;
    overflow: hidden;
  }
  .sidebar-header {
    margin-bottom: 1rem;
  }
  .nav-item {
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.25rem;
  }
  .sidebar-footer {
    padding-top: 0.5rem;
  }
  .user-profile-sidebar {
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
  }
  .sidebar-tools {
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
  }
}

/* --- Kanban Pipeline View --- */
.kanban-board {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  height: calc(100vh - 180px); /* Ajustement hauteur */
  align-items: flex-start;
}

.kanban-column {
  min-width: 280px;
  width: 280px;
  background: #f3f4f6; /* Gris clair pour la colonne */
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  max-height: 100%;
}

body.dark-mode .kanban-column {
  background: #1f2937;
  border-color: var(--border);
}

.kanban-header {
  padding: 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
}

.kanban-body {
  padding: 0.75rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.kanban-card {
  background: var(--bg-card);
  padding: 1rem;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border);
  cursor: pointer;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}

.kanban-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  border-color: var(--primary);
}

.kanban-card-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
  color: var(--text-main);
}
.kanban-card-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}
.kanban-tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.tag-mini {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-body);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* --- Pipeline List View (Swimlanes) --- */
.pipeline-list-view {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.pipeline-row {
  display: flex;
  border-bottom: 1px solid var(--border);
  min-height: 140px;
}

.pipeline-row:last-child {
  border-bottom: none;
}

.pipeline-status-col {
  width: 160px;
  min-width: 160px;
  background: var(--bg-body);
  border-right: 1px solid var(--border);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.5rem;
  flex-shrink: 0;
  /* Sticky behavior is handled by the scrollable sibling, but we keep it distinct */
}

body.dark-mode .pipeline-status-col {
  background: #1f2937;
}

.pipeline-items-container {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  overflow-x: auto;
  /* Custom Scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.pipeline-items-container::-webkit-scrollbar {
  height: 6px;
}
.pipeline-items-container::-webkit-scrollbar-track {
  background: transparent;
}
.pipeline-items-container::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 3px;
}

.pipeline-list-view .kanban-card {
  min-width: 280px;
  width: 280px;
  flex-shrink: 0;
  margin-bottom: 0;
}

@media (max-width: 768px) {
  .pipeline-row {
    flex-direction: column;
    min-height: auto;
  }
  .pipeline-status-col {
    width: 100%;
    min-width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
  }
  .pipeline-items-container {
    flex-direction: column;
    align-items: stretch;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 1rem;
    max-height: 450px;
  }
  .pipeline-list-view .kanban-card {
    width: 100%;
    min-width: 0;
  }

  /* Responsive Table (Stacked) */
  .responsive-table {
    min-width: 0 !important;
  }
  .responsive-table thead {
    display: none;
  }
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table td {
    display: block;
    width: 100%;
  }
  .responsive-table tr {
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
  }
  .responsive-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: right;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
  }
  .responsive-table td:last-child {
    border-bottom: none;
  }
  .responsive-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: left;
    margin-right: 1rem;
  }
}

/* --- Scraping View --- */
.scraping-view-header {
  background: var(--bg-card);
  padding: 2rem 0.5rem 2rem 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.scraping-view {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.scraping-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.scraping-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.scraping-inputs {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
  gap: 0.75rem;
  align-items: end;
}

.input-block label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text-muted);
}

.input-connector {
  color: var(--text-muted);
  font-weight: 700;
  padding-bottom: 0.6rem;
  text-align: center;
}

.scraping-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 1rem;
}

.option-block label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text-muted);
}

.toggle-block {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.scraping-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.rentability {
  background: var(--bg-body);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 160px;
}

.rentability strong {
  font-size: 1.2rem;
  color: var(--primary);
}

.scraping-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.scraping-logs {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.scraping-logs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logs-container {
  background: var(--bg-body);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1rem;
  max-height: 320px;
  overflow: auto;
}

.log-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin-bottom: 0.75rem;
}

.log-title {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.log-level {
  font-weight: 700;
  text-transform: uppercase;
}

.log-message {
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}

.log-meta {
  font-size: 0.75rem;
  background: var(--bg-body);
  padding: 0.5rem;
  border-radius: 6px;
  overflow-x: auto;
}

.log-info .log-level {
  color: var(--primary);
}
.log-warn .log-level {
  color: var(--warning);
}
.log-error .log-level {
  color: var(--danger);
}

.history-title {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.quota {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.quota-bar {
  width: 120px;
  height: 6px;
  background: var(--bg-body);
  border-radius: 999px;
  overflow: hidden;
}

.quota-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
}

.history-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.campaigns-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.campaigns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
}

.campaign-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  position: relative;
}

.campaign-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.campaign-card h4 {
  margin: 0;
  font-size: 1rem;
}

.campaign-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 1rem;
}

.campaign-signature-meta {
  margin-top: 0.65rem;
}

.campaign-menu {
  position: relative;
}

.campaign-menu-items {
  position: absolute;
  right: 0;
  top: 110%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 0.35rem 0;
  min-width: 160px;
  z-index: 10;
}

.campaign-menu-items button {
  width: 100%;
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-size: 0.85rem;
}

.campaign-menu-items button:hover {
  background: var(--bg-body);
}

.campaign-menu-items .danger {
  color: var(--danger);
}

.campaign-form .textarea {
  min-height: 180px;
}

.btn-icon-only {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.job-meta-stack strong {
  display: block;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 999px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

.switch input:checked + .slider {
  background-color: var(--primary);
}

.switch input:checked + .slider:before {
  transform: translateX(20px);
}

@media (max-width: 1024px) {
  .scraping-inputs {
    grid-template-columns: 1fr;
  }
  .input-connector {
    display: none;
  }
  .scraping-options {
    grid-template-columns: 1fr 1fr;
  }
  .scraping-history-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .history-actions {
    width: 100%;
    flex-wrap: wrap;
  }
}

.scraping-form-container {
  max-width: 100%;
  margin: 0 auto;
}

.scraping-input-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  background: var(--bg-body);
  padding: 0.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.scraping-input-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0.25rem 0.75rem;
  position: relative;
}

.scraping-input-wrapper label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 2px;
}

.scraping-input-wrapper .input {
  border: none;
  background: transparent;
  padding: 0.25rem 0;
  font-size: 1rem;
  font-weight: 500;
  height: auto;
  border-radius: 0;
}

.scraping-input-wrapper .input:focus {
  box-shadow: none;
  border-bottom: 2px solid var(--primary);
}

.scraping-divider {
  width: 1px;
  height: 40px;
  background: var(--border);
}

/* Job List Styles */
.job-list-container {
  max-width: 100%;
  margin: 0 0.5rem 0 0.5rem;
  padding: 0 2rem 2rem;
  padding: 0;
}

.job-item {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  transition: all 0.2s;
}

.job-left {
  display: flex;
  align-items: center;
  flex: 1;
}
.job-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 1;
}

.job-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--primary);
}

.job-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  background: #eef2ff;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-right: 1.25rem;
  flex-shrink: 0;
}

.job-details {
  flex: 1;
}
.job-title {
  font-weight: 600;
  color: var(--text-main);
  font-size: 1rem;
  margin-bottom: 0.25rem;
}
.job-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  display: flex;
  gap: 1rem;
  align-items: center;
}

.job-metrics {
  display: flex;
  gap: 2rem;
  margin: 0 1.5rem 0 0;
  text-align: right;
}

.metric-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.metric-value {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-main);
}
.metric-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.job-progress {
  width: 120px;
  margin-right: 1.5rem;
}
.progress-bar-bg {
  height: 6px;
  background: var(--bg-body);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.25rem;
}
.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.5s;
}
.progress-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: right;
}

.status-select {
  padding: 0.4rem 1rem;
  border-radius: 2rem;
  border: 1px solid var(--border);
  background-color: var(--bg-body);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  outline: none;
  margin: 0 2rem;
  text-align: center;
  min-width: 130px;
  text-align-last: center; /* Centre le texte dans le select */
}
.status-select:focus {
  border-color: var(--primary);
}
/* Status Colors */
.status-select.running {
  background-color: #dbeafe;
  color: #1e40af;
  border-color: #dbeafe;
}
.status-select.completed {
  background-color: #d1fae5;
  color: #065f46;
  border-color: #d1fae5;
}
.status-select.pending {
  background-color: #fef3c7;
  color: #92400e;
  border-color: #fef3c7;
}

/* Dropdown Menu */
.dropdown-menu {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 20;
  min-width: 240px;
  overflow: hidden;
  animation: fadeIn 0.2s ease;
}
.dropdown-item {
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-main);
  transition: background 0.2s;
}
.dropdown-item:hover {
  background: var(--bg-body);
}

/* Calendar View Styles */
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.calendar-day-header {
  background: var(--bg-body);
  padding: 1rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.calendar-day {
  background: var(--bg-card);
  min-height: 120px;
  padding: 0.5rem;
  cursor: pointer;
  transition: background 0.2s;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.calendar-day:hover {
  background: #f9fafb;
}
.calendar-day.other-month {
  background: #f9fafb;
  color: var(--text-muted);
  opacity: 0.6;
}
.calendar-day.selected {
  background: #eef2ff;
  box-shadow: inset 0 0 0 2px var(--primary);
}
.calendar-date {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
  display: block;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.calendar-day.today .calendar-date {
  background: var(--primary);
  color: white;
}

.calendar-event-pill {
  background: #fef3c7;
  color: #92400e;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Responsive Mobile */
@media (max-width: 768px) {
  .scraping-input-group {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  .scraping-divider {
    display: none;
  }

  /* Reset Grid to Block for Mobile to allow full-width expansion */
  .grid-3,
  .grid-4,
  .grid-2-1,
  .grid-2 {
    display: block !important;
  }
  .grid-2-1 > .card,
  .grid-3 > .card,
  .grid-2 > .card,
  .grid-4 > .card {
    margin-bottom: 1rem;
  }

  /* Job Item Mobile Layout */
  .job-item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.75rem;
    align-items: center;
    padding: 1rem;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .job-left,
  .job-details {
    display: contents;
  }

  .job-title {
    grid-column: 1 / -1;
    grid-row: 1;
    margin-bottom: 0.25rem;
  }

  .status-select {
    grid-column: 1;
    grid-row: 2;
    margin: 0;
    width: auto;
    min-width: 100px;
    padding: 0.3rem 0.8rem;
    font-size: 0.75rem;
  }

  .job-meta {
    grid-column: 2;
    grid-row: 2;
    justify-content: flex-end;
    flex-wrap: nowrap;
    text-align: right;
    gap: 0.5rem;
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .job-right {
    grid-column: 1 / -1;
    grid-row: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
  }

  .job-metrics {
    margin: 0;
    width: auto;
    gap: 1.5rem;
    justify-content: flex-start;
  }
  .metric-box {
    align-items: flex-start;
  }

  .job-progress {
    width: 100%;
    margin: 0;
  }

  /* Scraping History Header Mobile */
  .job-history-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1.5rem;
  }

  .job-history-title-group {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 0.5rem !important;
  }

  .job-history-filters {
    flex-wrap: wrap;
    margin: 0 0 1rem 0;
  }
  .job-history-filters .input-wrapper {
    width: 100% !important;
    order: -1; /* Place search bar first */
    margin-bottom: 0.5rem;
  }
  .job-history-filters input[type="date"] {
    width: 100% !important;
    flex: none;
  }

  /* Adjust Job List Container Padding */
  .job-list-container {
    padding: 0 0 100px 0;
  }

  /* General Mobile Padding Reduction */
  .content-body {
    padding: 0.5rem;
    padding-bottom: 100px;
  }
  .projects-view {
    padding-bottom: 100px;
  }
  #view-login,
  #view-signup,
  #view-forgot-password {
    padding-bottom: 100px;
  }
  .card {
    padding: 1rem;
    /* Restore margins and card style */
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
  }
  .calendar-header {
    flex-direction: row;
    gap: 0.5rem;
    align-items: center;
    justify-content: space-between;
  }
  .calendar-header h3 {
    min-width: auto !important;
    font-size: 1rem;
  }

  /* Calendar Mobile Optimization */
  .calendar-day {
    min-height: 80px;
    height: 80px;
    padding: 2px;
  }
  .calendar-day-header {
    padding: 0.5rem 0;
    font-size: 0.75rem;
  }
  .calendar-event-pill {
    font-size: 0.6rem;
    padding: 1px 3px;
    margin-top: 1px;
  }
  .calendar-date {
    font-size: 0.75rem;
    width: 20px;
    height: 20px;
    margin-bottom: 0;
  }

  /* Disable sticky on mobile for details card */
  .grid-2-1 > .card[style*="sticky"] {
    position: static !important;
  }

  /* Scrollable Calendar Grid */
  .calendar-scroll-wrapper {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.5rem;
    touch-action: pan-y;

    /* Barre de scroll visible en dessous */
    scrollbar-width: thin;
    scrollbar-color: var(--text-muted) transparent;
  }
  .calendar-scroll-wrapper::-webkit-scrollbar {
    height: 6px;
  }
  .calendar-scroll-wrapper::-webkit-scrollbar-track {
    background: transparent;
  }
  .calendar-scroll-wrapper::-webkit-scrollbar-thumb {
    background-color: var(--text-muted);
    border-radius: 3px;
  }

  .calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(85px, 1fr));
    width: 100%;
  }

  /* Clients Page Mobile Optimization */
  .mobile-column {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 1rem !important;
  }

  .w-100-mobile {
    width: 100% !important;
  }

  .mobile-transparent-card {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
  }

  .filters-wrapper {
    display: flex;
    display: grid;
    grid-template-columns: 1fr 1fr;
    display: flex !important;
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 5px; /* Espace pour la scrollbar */
    gap: 0.75rem;
    padding-bottom: 0;
  }
  .filters-wrapper > .input:nth-child(1) {
    grid-column: 1 / -1;
  }
  .filters-wrapper > .input {
    width: 100% !important;
    min-width: 0 !important;
  }
  .search-wrapper {
    max-width: 100% !important;
  }
}

/* Search Bar Styling (Global) */
.search-wrapper {
  position: relative;
  width: 100%;
  max-width: 25vw;
}
.search-wrapper i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.search-input {
  padding-left: 2.8rem !important;
  border-radius: var(--radius) !important;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}
.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

/* Client Status Colors */
.status-select.traite {
  background-color: #d1fae5;
  color: #065f46;
  border-color: #d1fae5;
}
.status-select.non-traite {
  background-color: #fee2e2;
  color: #991b1b;
  border-color: #fee2e2;
}

/* Table adjustments for status select */
.table .status-select {
  margin: 0;
  min-width: 120px;
}

/* Desktop: Filters wrapper acts as if it doesn't exist to keep alignment */
.filters-wrapper {
  display: contents;
}

/* --- Full Height Layout (Scraping A Desktop) --- */

/* Signature Styles */
.signature-preview {
  border: 1px solid var(--border);
  padding: 1rem;
  border-radius: var(--radius);
  background: white;
  font-family: "Inter", sans-serif;
  font-size: 0.9rem;
}
.sig-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.sig-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--bg-body);
}
.sig-info h4 {
  margin: 0;
  font-size: 1rem;
  color: var(--text-main);
  font-weight: 700;
}
.sig-info p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.sig-footer {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 0.5rem;
}
.sig-company {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
}
.sig-company-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}
.sig-company-left span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sig-logo {
  height: 20px;
  width: auto;
  max-width: 80px;
  object-fit: contain;
}
.sig-website {
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
  margin-left: auto;
}
.sig-website:hover {
  text-decoration: underline;
}
.sig-socials {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.25rem;
}
.sig-social-icon {
  color: var(--text-muted);
  font-size: 1.1rem;
  transition: color 0.2s;
}
.sig-social-icon:hover {
  color: var(--primary);
}
.signature-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
}

.signature-manager-modal {
  max-width: 460px;
}

.signatures-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.signature-item {
  padding: 0.85rem 0.9rem;
}

.signature-item-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.signature-avatar-small {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
}

.signature-item-info {
  line-height: 1.2;
}

.signature-item-actions {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.signature-empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 0.9rem;
  text-align: center;
}

.signature-create-btn {
  font-weight: 500;
}

.signature-editor-modal {
  max-width: 760px;
}

.signature-editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.campaign-signature-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.campaign-signature-row .input {
  flex: 1;
}

.signature-add-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.signature-add-btn:hover {
  background: #eef2ff;
}
@media (min-width: 1025px) {
  .full-height-layout {
    display: flex;
    flex-direction: column;
    overflow: hidden !important; /* Désactive le scroll de la page */
  }

  .scraping-view-header {
    padding: 2rem;
  }

  .full-height-layout > section:last-child {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
  }

  .full-height-layout > section:last-child > .card {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-bottom: 0 !important;
    overflow: hidden;
  }

  .table-scroll-wrapper {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    min-height: 0;
  }

  /* En-tête collant (Sticky) pour le tableau */
  .table-scroll-wrapper thead th {
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 10;
    box-shadow: 0 1px 0 var(--border);
  }
}

/* --- Full Height Layout (Scraping B Desktop) --- */
@media (min-width: 1025px) {
  .scraping-full-height {
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
  }

  .scraping-full-height .job-list-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0 2rem 2rem 2rem;
    margin: 0;
  }

  /* Le rectangle (carte) prend toute la place restante */
  .scraping-full-height .job-list-container .card {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 0;
  }

  /* Le tableau scrolle à l'intérieur de la carte */
  .scraping-full-height .table-scroll-wrapper {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
  }

  /* En-tête collant pour le tableau Scraping B */
  .scraping-full-height .table-scroll-wrapper thead th {
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 10;
    box-shadow: 0 1px 0 var(--border);
  }
}

/* --- Full Height Layout (Contacts Desktop) --- */
@media (min-width: 1025px) {
  .contacts-full-height {
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
  }

  .contacts-full-height .view-internal {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .contacts-full-height .card {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 0 !important;
  }

  .contacts-full-height .table-scroll-wrapper {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
  }

  .contacts-full-height thead th {
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 10;
    box-shadow: 0 1px 0 var(--border);
  }
}

/* --- Full Height Layout (Clients Desktop) --- */
@media (min-width: 1025px) {
  .clients-full-height {
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
  }

  .clients-full-height #view-clients,
  .clients-full-height #view-customers {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .clients-full-height .card {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 0 !important;
  }

  .clients-full-height .table-scroll-wrapper {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
  }

  .clients-full-height thead th {
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 10;
    box-shadow: 0 1px 0 var(--border);
  }
}
