/* ===== VARIABLES GLOBALES ===== */
:root {
  --noir: #0a0a0a;
  --noir-doux: #1a1a1a;
  --gris-fonce: #2a2a2a;
  --gris: #3a3a3a;
  --gris-clair: #666666;
  --blanc-casse: #f5f5f5;
  --blanc: #ffffff;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--noir);
  color: var(--blanc-casse);
  line-height: 1.6;
  overflow-x: hidden;
}

/* ANIMATIONS */
@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-20px); }
}

@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

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

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 20px rgba(102, 126, 234, 0.3); }
  50% { box-shadow: 0 0 40px rgba(102, 126, 234, 0.6); }
}

/* DASHBOARD */
.dashboard-container {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
  overflow-x: hidden;
}

.sidebar {
  background: var(--noir-doux);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  padding: 2rem 1rem;
  position: fixed;
  height: 100vh;
  width: 280px;
  overflow-y: auto;
  animation: slideInLeft 0.6s ease-out;
}

.user-profile {
  text-align: center;
  margin-bottom: 2rem;
  animation: slideInUp 0.6s ease-out;
}

.user-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  background-size: 200% 200%;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: white;
  animation: gradient-shift 3s ease infinite, glow 2s ease-in-out infinite;
}

.sidebar-item {
  padding: 1rem 1.5rem;
  margin-bottom: 0.5rem;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--gris-clair);
  position: relative;
  overflow: hidden;
  border: 1px solid transparent;
}

.sidebar-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
  transition: left 0.5s ease;
}

.sidebar-item:hover::before {
  left: 100%;
}

.sidebar-item:hover {
  background: var(--gris);
  color: var(--blanc);
  transform: translateX(5px);
  border-color: rgba(102, 126, 234, 0.3);
}

.sidebar-item.active {
  background: var(--gris-fonce);
  border-color: rgba(102, 126, 234, 0.5);
  color: var(--blanc);
}

.unread-badge {
  margin-left: auto;
  background: linear-gradient(135deg, #667eea, #764ba2);
  background-size: 200% 200%;
  color: var(--blanc);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  animation: gradient-shift 3s ease infinite, pulse 2s ease-in-out infinite;
}

.main-content {
  margin-left: 280px;
  padding: 2rem;
  min-height: 100vh;
  width: calc(100% - 280px);
  max-width: calc(100vw - 280px);
  overflow-x: hidden;
  box-sizing: border-box;
}

.section {
  animation: fadeIn 0.3s ease-out;
  width: 100%;
  max-width: 1200px;
}

h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 2rem;
  background: linear-gradient(135deg, var(--blanc) 0%, var(--gris-clair) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: slideInUp 0.6s ease-out;
}

h2 {
  font-size: 1.8rem;
  color: var(--blanc);
}

h3 {
  font-size: 1.3rem;
  color: var(--blanc);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

.stat-card {
  background: var(--noir-doux);
  padding: 2rem;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.4s ease;
  position: relative;
  overflow: hidden;
  animation: slideInUp 0.6s ease-out backwards;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(102, 126, 234, 0.1), transparent);
  animation: float 15s ease-in-out infinite;
}

.stat-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
  border-color: rgba(102, 126, 234, 0.4);
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 3s ease infinite;
}

.card {
  background: var(--noir-doux);
  padding: 2.5rem;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
  transition: all 0.4s ease;
  animation: slideInUp 0.6s ease-out backwards;
  margin-bottom: 2rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
  transition: left 0.5s ease;
}

.card:hover::before {
  left: 100%;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
  border-color: rgba(102, 126, 234, 0.3);
}

.chat-container {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 2rem;
  height: 75vh;
  animation: slideInUp 0.6s ease-out;
}

.conversations-list {
  background: var(--noir-doux);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow-y: auto;
  padding: 1.5rem;
  animation: slideInLeft 0.6s ease-out;
}

.search-box {
  margin-bottom: 1.5rem;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 1rem 1rem 1rem 3rem;
  background: var(--gris-fonce);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: var(--blanc);
  transition: all 0.3s ease;
}

.search-box input:focus {
  outline: none;
  border-color: rgba(102, 126, 234, 0.5);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  background: var(--gris);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gris-clair);
}

.conversation-item {
  padding: 1.2rem;
  border-radius: 12px;
  margin-bottom: 0.8rem;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid transparent;
  animation: slideInLeft 0.4s ease-out backwards;
  position: relative;
  overflow: hidden;
}

.conversation-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
  transition: left 0.5s ease;
}

.conversation-item:hover::before {
  left: 100%;
}

.conversation-item:hover {
  background: var(--gris-fonce);
  border-color: rgba(102, 126, 234, 0.3);
  transform: translateX(5px);
}

.conversation-item.active {
  background: var(--gris);
  border-color: rgba(102, 126, 234, 0.5);
}

.conversation-type {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  background: rgba(102, 126, 234, 0.2);
  border-radius: 10px;
  color: #667eea;
}

.chat-window {
  background: var(--noir-doux);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideInUp 0.6s ease-out 0.2s backwards;
}

.chat-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--gris-fonce);
}

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.message {
  max-width: 65%;
  padding: 1rem 1.5rem;
  border-radius: 18px;
  animation: slideInUp 0.3s ease-out;
  position: relative;
}

.message.sent {
  align-self: flex-end;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  background-size: 200% 200%;
  animation: slideInUp 0.3s ease-out, gradient-shift 5s ease infinite;
  color: var(--blanc);
  border-bottom-right-radius: 4px;
}

.message.received {
  align-self: flex-start;
  background: var(--gris);
  color: var(--blanc-casse);
  border-bottom-left-radius: 4px;
}

.message-time {
  font-size: 0.75rem;
  opacity: 0.7;
  margin-top: 0.5rem;
}

.message-input-container {
  display: flex;
  gap: 1rem;
  padding: 1.5rem 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--gris-fonce);
}

.message-input-container input {
  flex: 1;
  padding: 1rem 1.5rem;
  background: var(--gris);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 25px;
  color: var(--blanc);
  transition: all 0.3s ease;
}

.message-input-container input:focus {
  outline: none;
  border-color: rgba(102, 126, 234, 0.5);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.send-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  background-size: 200% 200%;
  border: none;
  color: var(--blanc);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  animation: gradient-shift 3s ease infinite;
}

.send-btn:hover {
  transform: scale(1.1) rotate(15deg);
  box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.agency-profile-header, .brand-profile-header {
  background: linear-gradient(135deg, var(--noir-doux) 0%, var(--gris-fonce) 100%);
  padding: 3rem;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 3rem;
  position: relative;
  overflow: hidden;
  animation: slideInUp 0.6s ease-out;
}

.agency-profile-header::before, .brand-profile-header::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(102, 126, 234, 0.1), transparent);
  animation: float 15s ease-in-out infinite;
}

.edit-btn {
  position: absolute;
  top: 2rem;
  right: 2rem;
  padding: 0.8rem 1.5rem;
  background: var(--gris);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: var(--blanc);
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 1;
}

.edit-btn:hover {
  background: var(--gris-clair);
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.tabs {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  animation: slideInUp 0.6s ease-out 0.2s backwards;
}

.tab {
  padding: 1rem 2rem;
  cursor: pointer;
  color: var(--gris-clair);
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
  position: relative;
}

.tab.active {
  color: var(--blanc);
  border-bottom-color: #667eea;
}

.tab:hover {
  color: var(--blanc);
}

.representatives {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.representative-card {
  background: var(--gris-fonce);
  padding: 1.5rem;
  border-radius: 15px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.3s ease;
  animation: slideInUp 0.5s ease-out backwards;
}

.representative-card:hover {
  transform: translateY(-5px);
  border-color: rgba(102, 126, 234, 0.3);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.representative-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  background-size: 200% 200%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
  animation: gradient-shift 3s ease infinite;
}

.models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.model-card {
  background: var(--noir-doux);
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  animation: slideInUp 0.5s ease-out backwards;
}

.model-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
  border-color: rgba(102, 126, 234, 0.4);
}

.model-image {
  width: 100%;
  height: 350px;
  background: linear-gradient(135deg, var(--gris-fonce) 0%, var(--gris) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  position: relative;
  overflow: hidden;
}

.model-image::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.05), transparent);
  animation: float 20s ease-in-out infinite;
}

.model-info {
  padding: 1.5rem;
}

.model-name {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--blanc);
  margin-bottom: 0.5rem;
}

.model-details {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
  margin-top: 1rem;
}

.detail-item {
  display: flex;
  flex-direction: column;
  padding: 0.8rem;
  background: var(--gris-fonce);
  border-radius: 10px;
}

.detail-label {
  font-size: 0.75rem;
  color: var(--gris-clair);
  margin-bottom: 0.3rem;
}

.detail-value {
  font-weight: 600;
  color: var(--blanc-casse);
}

.filters-bar {
  background: var(--noir-doux);
  padding: 1.5rem 2rem;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 2rem;
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
  animation: slideInUp 0.5s ease-out;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-group label {
  font-size: 0.85rem;
  color: var(--gris-clair);
}

.filter-group select, .filter-group input {
  padding: 0.7rem 1rem;
  background: var(--gris-fonce);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: var(--blanc);
  min-width: 150px;
  transition: all 0.3s ease;
}

.filter-group select:focus, .filter-group input:focus {
  outline: none;
  border-color: rgba(102, 126, 234, 0.5);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  background: var(--gris);
}

.btn {
  padding: 0.8rem 1.5rem;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  background-size: 200% 200%;
  color: var(--blanc);
  animation: gradient-shift 3s ease infinite;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(102, 126, 234, 0.6);
}

.btn-secondary {
  background: transparent;
  color: var(--blanc);
  border: 2px solid var(--blanc);
}

.btn-secondary:hover {
  background: var(--blanc);
  color: var(--noir);
  transform: translateY(-2px);
}

.badge {
  display: inline-block;
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

.badge.available {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge.unavailable {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--noir);
}

::-webkit-scrollbar-thumb {
  background: var(--gris);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gris-clair);
}

@media (max-width: 1024px) {
  .dashboard-container {
    grid-template-columns: 1fr;
  }
  .sidebar {
    width: 100%;
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
  .main-content {
    margin-left: 0;
  }
  .chat-container {
    grid-template-columns: 1fr;
    height: auto;
  }
  .conversations-list {
    max-height: 300px;
  }
  .models-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  h1 {
    font-size: 2rem;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .filters-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-group select, .filter-group input {
    width: 100%;
  }
}