/* ============================================================
   TrendJump — Portail Client
   CSS principal
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --primary:       #1a1a2e;
  --accent:        #e94560;
  --sidebar-bg:    #16213e;
  --sidebar-hover: #0f3460;
  --sidebar-text:  #a8b2c8;
  --sidebar-active:#e94560;
  --content-bg:    #f4f6f9;
  --white:         #ffffff;
  --text:          #2d3748;
  --text-muted:    #718096;
  --border:        #e2e8f0;
  --shadow:        0 2px 8px rgba(0,0,0,0.08);
}

/* ── Reset & Base ───────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--content-bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ─────────────────────────────────────────────────── */
.app-wrapper {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar-logo {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.02em;
}

.sidebar-logo span {
  color: var(--accent);
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  color: var(--sidebar-text);
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
  font-size: 0.9rem;
}

.sidebar-nav a:hover {
  background: var(--sidebar-hover);
  color: var(--white);
}

.sidebar-nav a.active {
  background: var(--accent);
  color: var(--white);
  font-weight: 600;
}

.sidebar-section-title {
  padding: 0.5rem 1.5rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.3);
  margin-top: 1rem;
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  margin-top: auto;
}

.sidebar-footer .user-name {
  color: var(--white);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.sidebar-footer a {
  color: var(--sidebar-text);
  font-size: 0.8rem;
  text-decoration: none;
  transition: color 0.2s;
}

.sidebar-footer a:hover {
  color: var(--accent);
}

/* ── Icons (SVG inline) ─────────────────────────────────────── */
.icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ── Page Header ────────────────────────────────────────────── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

/* ── Stats Grid ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--white);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--accent);
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}

.stat-card .stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1rem;
}

/* ── Tables ─────────────────────────────────────────────────── */
table.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

table.table thead {
  background: var(--primary);
  color: var(--white);
}

table.table th {
  padding: 0.875rem 1rem;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

table.table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

table.table tbody tr:last-child td {
  border-bottom: none;
}

table.table tbody tr:hover {
  background: #f8f9fa;
}

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-warning   { background: #fff3cd; color: #856404; }
.badge-info      { background: #cce5ff; color: #004085; }
.badge-purple    { background: #e8d5f5; color: #6f42c1; }
.badge-success   { background: #d4edda; color: #155724; }
.badge-secondary { background: #e9ecef; color: #495057; }
.badge-danger    { background: #f8d7da; color: #721c24; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.btn-primary {
  background: var(--accent);
  color: var(--white);
}

.btn-primary:hover {
  background: #c73652;
}

.btn-secondary {
  background: var(--primary);
  color: var(--white);
}

.btn-secondary:hover {
  background: #0f1547;
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: var(--white);
}

.btn-danger {
  background: #dc3545;
  color: var(--white);
}

.btn-danger:hover {
  background: #b02a37;
}

.btn-sm {
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
}

.btn-group {
  display: flex;
  gap: 0.5rem;
}

/* ── Forms ──────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.form-control {
  width: 100%;
  padding: 0.6rem 0.875rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none;
}

.form-control:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(233,69,96,0.1);
}

select.form-control {
  cursor: pointer;
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
  padding: 0.875rem 1.25rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.alert-success {
  background: #d4edda;
  color: #155724;
  border-left: 4px solid #28a745;
}

.alert-error {
  background: #f8d7da;
  color: #721c24;
  border-left: 4px solid #dc3545;
}

.alert-info {
  background: #cce5ff;
  color: #004085;
  border-left: 4px solid #007bff;
}

/* ── Login Page ─────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
}

.login-card {
  background: var(--white);
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary);
}

.login-logo span {
  color: var(--accent);
}

/* ── Messages Chat ──────────────────────────────────────────── */
.messages-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 500px;
  overflow-y: auto;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.message-item {
  display: flex;
  max-width: 75%;
}

.message-mine {
  margin-left: auto;
  flex-direction: row-reverse;
}

.message-bubble {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.message-mine .message-bubble {
  background: var(--accent);
  color: var(--white);
  border-radius: 12px 12px 0 12px;
}

.message-theirs .message-bubble {
  background: var(--white);
  color: var(--text);
  border-radius: 12px 12px 12px 0;
  box-shadow: var(--shadow);
}

.message-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  text-align: right;
}

/* ── Upload Zone ────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.upload-zone:hover {
  border-color: var(--accent);
  background: rgba(233,69,96,0.02);
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-wrapper {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    flex-direction: row;
    overflow-x: auto;
  }

  .sidebar-nav {
    flex-direction: row;
    padding: 0.5rem;
  }

  .sidebar-nav a {
    white-space: nowrap;
    padding: 0.6rem 1rem;
  }

  .sidebar-logo,
  .sidebar-section-title,
  .sidebar-footer {
    display: none;
  }

  .main-content {
    padding: 1rem;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
}
