/* ============================================================================
   IFG Dashboard — Legal Tech Pro
   Style radar (épuré, sophistiqué) + Couleurs IFG
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@300;400;500;600;700&family=Source+Serif+4:opsz,wght@8..60,400;500;600&display=swap');

:root {
  /* Couleurs IFG */
  --bg-primary: #050A14;
  --bg-secondary: #0A1220;
  --bg-elevated: #111827;
  --bg-card: #1A2942;
  
  --gold: #C5A572;
  --gold-bright: #D4B896;
  --gold-dim: rgba(197, 165, 114, 0.15);
  
  --text-primary: rgba(255, 255, 255, 0.95);
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.5);
  
  --border: rgba(197, 165, 114, 0.12);
  --border-light: rgba(197, 165, 114, 0.08);
  --border-strong: rgba(197, 165, 114, 0.25);
  
  /* Typography */
  --font-sans: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: 'Source Serif 4', Georgia, serif;
  
  /* Spacing */
  --radius: 6px;
  --radius-sm: 4px;
  --transition: all 0.2s ease;
}

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

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================================================
   Header Standard (Toutes les pages)
   ============================================================================ */
.dash-header {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  padding: 0 40px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.dash-logo img {
  height: 32px;
  display: block;
}

.dash-header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dash-header-link {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
}

.dash-header-link:hover {
  color: var(--gold);
  background: var(--gold-dim);
}

.dash-header-link.active {
  color: var(--gold);
  background: var(--gold-dim);
}

.dash-header-link i {
  font-size: 13px;
}

.dash-header-email {
  font-size: 13px;
  color: var(--text-muted);
  margin-right: 16px;
}

/* Burger */
.dash-burger {
  display: none;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  transition: var(--transition);
}

.dash-burger:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* Mobile Menu — inherits styling from connected-header.css .ifg-connected-mobile-menu */
/* Only override: use .open toggle (dashboard JS) instead of .hidden toggle (chat JS) */
.dash-mobile-menu.ifg-connected-mobile-menu {
  visibility: hidden;
  pointer-events: none;
}

.dash-mobile-menu.ifg-connected-mobile-menu.open {
  right: 0 !important;
  visibility: visible;
  pointer-events: auto;
  box-shadow: 0 16px 40px rgba(0,0,0,0.42), 0 0 0 9999px rgba(5,10,20,0.52);
}

/* ============================================================================
   Main Layout
   ============================================================================ */
.dash-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px;
}

/* ============================================================================
   Tabs (Style Radar)
   ============================================================================ */
.dash-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 32px;
  padding: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: fit-content;
}

.dash-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-sans);
}

.dash-tab:hover {
  color: var(--text-primary);
}

.dash-tab.active {
  color: var(--bg-primary);
  background: var(--gold);
  font-weight: 600;
}

.dash-tab i {
  font-size: 13px;
}

/* Tab Content */
.dash-tab-content {
  display: none;
}

.dash-tab-content.active {
  display: block;
}

/* ============================================================================
   Stats Grid (Style Radar — Cards sobres)
   ============================================================================ */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 40px;
}

.dash-stat {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
}

.dash-stat::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--gold), transparent);
}

.dash-stat-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.dash-stat-value {
  font-family: var(--font-sans);
  font-size: 32px;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 4px;
  letter-spacing: -0.5px;
}

.dash-stat-sub {
  font-size: 16px;
  font-weight: 400;
  color: var(--text-muted);
}

.dash-stat-detail {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Progress Bar */
.dash-progress {
  height: 4px;
  background: var(--bg-secondary);
  border-radius: 2px;
  margin-top: 12px;
  overflow: hidden;
}

.dash-progress-bar {
  height: 100%;
  background: var(--gold);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* ============================================================================
   Pricing Section (Propre et épuré)
   ============================================================================ */
.dash-pricing {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
}

.dash-pricing-header {
  text-align: center;
  margin-bottom: 40px;
}

.dash-pricing-header h3 {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.dash-pricing-header p {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* Billing Toggle */
.dash-billing-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.dash-billing-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.dash-billing-label.active {
  color: var(--gold);
}

.dash-billing-discount {
  font-size: 12px;
  color: var(--gold);
  margin-left: 4px;
}

.dash-billing-switch {
  width: 44px;
  height: 22px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 11px;
  position: relative;
  cursor: pointer;
  transition: var(--transition);
}

.dash-billing-switch:hover {
  border-color: var(--gold);
}

.dash-billing-slider {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  background: var(--gold);
  border-radius: 50%;
  transition: var(--transition);
}

.dash-billing-switch.monthly .dash-billing-slider {
  right: auto;
  left: 2px;
}

/* Pricing Grid */
.dash-pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.dash-pricing-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  position: relative;
  transition: var(--transition);
}

.dash-pricing-card:hover {
  border-color: var(--border-strong);
}

.dash-pricing-card.featured {
  border-color: var(--gold);
}

.dash-pricing-card.featured::before {
  content: 'Populaire';
  position: absolute;
  top: -1px;
  right: 24px;
  padding: 6px 12px;
  font-size: 10px;
  font-weight: 700;
  color: var(--bg-primary);
  background: var(--gold);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.dash-pricing-card-name {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.dash-pricing-card-tag {
  display: inline-block;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--gold);
  background: var(--gold-dim);
  border-radius: 100px;
  margin-bottom: 20px;
  letter-spacing: 0.02em;
}

.dash-pricing-card-price {
  font-family: var(--font-sans);
  font-size: 36px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: -1px;
}

.dash-pricing-card-price span {
  font-size: 16px;
  font-weight: 400;
  color: var(--text-muted);
}

.dash-pricing-card-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.5;
}

.dash-pricing-features {
  list-style: none;
  margin-bottom: 28px;
}

.dash-pricing-features li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.dash-pricing-features li i {
  color: var(--gold);
  font-size: 12px;
}

.dash-pricing-cta {
  display: block;
  width: 100%;
  padding: 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--bg-primary);
  background: var(--gold);
  text-decoration: none;
  text-align: center;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  font-family: var(--font-sans);
  border: none;
  cursor: pointer;
}

.dash-pricing-cta:hover {
  background: var(--gold-bright);
  transform: translateY(-1px);
}

.dash-pricing-cta.secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.dash-pricing-cta.secondary:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-dim);
}

/* ============================================================================
   History Section (Style Radar)
   ============================================================================ */
.dash-history-list {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.dash-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: var(--transition);
}

.dash-history-item:hover {
  background: var(--gold-dim);
}

.dash-history-item:last-child {
  border-bottom: none;
}

.dash-history-info {
  flex: 1;
  min-width: 0;
}

.dash-history-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.dash-history-date {
  font-size: 13px;
  color: var(--text-muted);
}

.dash-history-actions {
  display: flex;
  gap: 8px;
}

.dash-history-btn {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-sans);
}

.dash-history-btn:hover {
  color: var(--gold);
  border-color: var(--gold);
  background: var(--gold-dim);
}

/* ============================================================================
   Profile Section
   ============================================================================ */
.dash-profile-section {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 600px;
}

.dash-profile-section h4 {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.dash-form-group {
  margin-bottom: 20px;
}

.dash-form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.dash-form-group input {
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  font-family: var(--font-sans);
}

.dash-form-group input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}

.dash-form-group input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.dash-btn-save {
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  color: var(--bg-primary);
  background: var(--gold);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-sans);
}

.dash-btn-save:hover {
  background: var(--gold-bright);
}

/* ============================================================================
   Portal Section
   ============================================================================ */
.dash-portal-section {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  margin-top: 24px;
}

.dash-portal-section h4 {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.dash-portal-section p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.dash-btn-portal {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-sans);
  text-decoration: none;
}

.dash-btn-portal:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-dim);
}

.dash-btn-portal i {
  font-size: 13px;
}

/* ============================================================================
   Cards (Profile Tab)
   ============================================================================ */
.dash-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
}

.dash-card-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.dash-card-title i {
  color: var(--gold);
  font-size: 16px;
}

.dash-card-title--between {
  justify-content: space-between;
}

.dash-card-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

/* Buttons */
.dash-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-sans);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.dash-btn-gold {
  background: var(--gold);
  color: var(--bg-primary);
}

.dash-btn-gold:hover {
  background: var(--gold-bright);
}

.dash-btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.dash-btn-secondary:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.dash-btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.dash-btn-outline:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-dim);
}

.dash-btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.dash-btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* Manage Subscription Section */
.dash-manage {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.dash-manage-text h3 {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.dash-manage-text p {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Logo Area */
.dash-logo-area {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.dash-logo-preview {
  width: 120px;
  height: 120px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.dash-logo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
}

.dash-logo-placeholder i {
  font-size: 24px;
}

.dash-logo-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.dash-logo-actions {
  flex: 1;
}

.dash-logo-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* Form Elements */
.dash-form-group {
  margin-bottom: 20px;
}

.dash-form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.dash-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  font-family: var(--font-sans);
}

.dash-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}

.dash-input::placeholder {
  color: var(--text-muted);
}

.dash-input:read-only {
  cursor: text;
}

/* Referral */
.dash-referral-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.dash-referral-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.dash-referral-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.dash-referral-row .dash-input {
  flex: 1;
}

.dash-referral-hint {
  font-size: 13px;
  color: var(--text-muted);
}

.dash-referral-hint i {
  color: var(--gold);
  margin-right: 4px;
}

/* Info Rows */
.dash-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}

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

.dash-info-label {
  font-size: 14px;
  color: var(--text-secondary);
}

.dash-info-value {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

/* Badges */
.dash-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 100px;
}

.dash-badge-bonus {
  background: var(--gold);
  color: var(--bg-primary);
}

.dash-badge-free {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* Actions Section */
.dash-actions-section {
  padding-top: 8px;
}

/* Table */
.dash-table-wrap {
  overflow-x: auto;
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
}

.dash-table thead {
  border-bottom: 1px solid var(--border);
}

.dash-table th {
  padding: 14px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dash-table td {
  padding: 14px 16px;
  font-size: 14px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
}

.dash-table tbody tr:hover td {
  background: var(--gold-dim);
  color: var(--text-primary);
}

/* Toast */
.dash-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 14px 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1000;
}

.dash-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  visibility: visible;
}

/* Loading */
.dash-loading {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 20, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.dash-loading.show {
  opacity: 1;
  visibility: visible;
}

.dash-spinner {
  width: 40px;
  height: 40px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* ============================================================================
   Responsive
   ============================================================================ */
@media (max-width: 1024px) {
  .dash-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .dash-pricing-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .dash-header {
    padding: 0 20px;
    height: 64px;
  }
  
  .dash-header-nav {
    display: none;
  }
  
  .dash-burger {
    display: flex;
  }
  
  .dash-main {
    padding: 24px 20px;
  }
  
  .dash-tabs {
    width: 100%;
    overflow-x: auto;
  }
  
  .dash-stats {
    grid-template-columns: 1fr;
  }
  
  .dash-pricing {
    padding: 24px;
  }
  
  .dash-pricing-header h3 {
    font-size: 24px;
  }
  
  .dash-profile-section,
  .dash-portal-section {
    padding: 24px;
  }
}
