/* Variables CSS pour le mode sombre */
:root {
  --primary-color: #818cf8;
  --primary-dark: #6366f1;
  --secondary-color: #fbbf24;
  --success-color: #34d399;
  --error-color: #f87171;
  --warning-color: #fbbf24;
  --background: #0f172a;
  --surface: #1e293b;
  --surface-dark: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --border: #475569;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  --radius: 12px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
}

/* Page de connexion */
.background-pattern {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  opacity: 0.03;
}

.login-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

.logo {
  text-align: center;
  margin-bottom: 2rem;
}

.logo-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  display: block;
}

.logo h1 {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-card {
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--surface);
  padding: 2.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
}

.login-card h2 {
  font-size: 1.5rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 0.5rem;
}

.subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-size: 0.9rem;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.input-group label {
  display: flex;
  align-items: center;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.platform-icon {
  margin-right: 0.5rem;
  font-size: 1.1rem;
}

/* Amélioration du contraste pour les icônes de plateforme */
.platform-icon.twitch {
  color: #a855f7;
}

.platform-icon.tiktok {
  color: #ff6b9d;
}

.input-group input {
  background: var(--background);
  color: var(--text-primary);
  border: 2px solid var(--border);
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
}

.input-group input::placeholder {
  color: var(--text-secondary);
}

.input-group input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.2);
}

.connect-btn {
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  position: relative;
  overflow: hidden;
}

.connect-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.connect-btn:active {
  transform: translateY(0);
}

.connect-btn.loading {
  pointer-events: none;
}

.connect-btn.loading::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  animation: loading 1s infinite;
}

@keyframes loading {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

.btn-arrow {
  transition: var(--transition);
}

.connect-btn:hover .btn-arrow {
  transform: translateX(4px);
}

/* Page de chat */
.chat-page {
  background: var(--surface-dark);
}

.header {
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.logo-small {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 1.1rem;
}

.logo-small .logo-icon {
  font-size: 1.5rem;
}

.status-indicators {
  display: flex;
  gap: 1.5rem;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transition: var(--transition);
}

.status-dot.connected {
  background: var(--success-color);
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.3);
}

.status-dot.error {
  background: var(--error-color);
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.3);
}

.status-dot.disconnected {
  background: var(--text-secondary);
}

.platform-name {
  font-weight: 500;
}

.status-text {
  color: var(--text-secondary);
}

.back-btn {
  background: var(--surface-dark);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.9rem;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.chat-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  height: calc(100vh - 100px);
}

.chat-panel {
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  background: var(--surface-dark);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.chat-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  flex: 1;
}

.chat-controls {
  display: flex;
  gap: 0.5rem;
}

.control-btn {
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
  padding: 0.5rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.9rem;
}

.control-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.chat-content {
  flex: 1;
  overflow: hidden;
}

.chat-content iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.tiktok-chat {
  height: 100%;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.chat-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-secondary);
  gap: 1rem;
}

.loading-spinner {
  border: 3px solid var(--border);
  border-top: 3px solid var(--primary-color);
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.chat-message {
  background: var(--surface-dark);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 0.5rem;
  border-radius: 6px;
  background: var(--surface-dark);
  margin-bottom: 0.25rem;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.username {
  font-weight: 600;
  color: var(--primary-color);
  margin-right: 0.5rem;
}

.message {
  color: var(--text-primary);
}

.error-message {
  text-align: center;
  color: var(--error-color);
  padding: 2rem;
  font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
  .login-container {
    padding: 1rem;
  }

  .login-card {
    padding: 2rem;
  }

  .logo h1 {
    font-size: 2rem;
  }

  .header-content {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .status-indicators {
    justify-content: center;
  }

  .chat-container {
    grid-template-columns: 1fr;
    padding: 1rem;
    gap: 1rem;
    height: auto;
  }

  .chat-panel {
    min-height: 400px;
  }
}

@media (max-width: 480px) {
  .status-indicators {
    flex-direction: column;
    gap: 0.5rem;
  }

  .chat-header {
    padding: 0.75rem 1rem;
  }

  .chat-header h3 {
    font-size: 1rem;
  }
}
