/* ═══════════════════════════════════════════════
   CHARTE GRAPHIQUE REFEXO — STYLE DU CRM
   ═══════════════════════════════════════════════ */
:root {
  --primary:        #0077B6;
  --primary-dark:   #005F92;
  --primary-light:  #E8F4FC;
  --dark:           #1A1F24;
  --dark2:          #343A40;
  --neutral:        #ADB5BD;
  --light:          #FFFFFF;
  --bg:             #F8FAFB;
  --border:         #E9ECF0;
  --text:           #3D4550;
  --text-light:     #6B7280;

  --shadow-sm:   0 2px 8px rgba(0,0,0,.04);
  --shadow-md:   0 8px 24px rgba(0,0,0,.06);
  --shadow-lg:   0 16px 48px rgba(0,0,0,.08);
  --shadow-blue: 0 8px 32px rgba(0,119,182,.15);

  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  20px;
}

/* ── Reset & Typo ──────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: 'Roboto', sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .brand-title {
  font-family: 'DM Serif Display', serif;
  color: var(--dark);
  font-weight: normal;
  margin-top: 0;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease;
}
a:hover {
  color: var(--primary-dark);
}

/* ── Header & Navigation ────────────────────── */
.crm-header {
  background: var(--light);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.header-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  height: 40px;
  width: auto;
}

.brand-title {
  font-size: 1.6rem;
  margin: 0;
  line-height: 1;
}

.brand-title span {
  color: var(--primary);
}

.crm-nav {
  display: flex;
  gap: 8px;
}

.nav-link {
  font-family: 'Roboto', sans-serif;
  font-weight: 500;
  color: var(--text-light);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link:hover, .nav-link.active {
  color: var(--primary);
  background: var(--primary-light);
}

.nav-link i {
  font-size: 1.1rem;
}

/* Quick Action Button */
.btn-action-nav {
  background: var(--primary);
  color: var(--light);
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-action-nav:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-blue);
  color: var(--light);
}

/* ── Main Layout ───────────────────────────── */
.crm-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 24px 60px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}

.page-title {
  font-size: 2.2rem;
  margin: 0;
}

.page-subtitle {
  color: var(--text-light);
  margin-top: 4px;
  font-size: 0.95rem;
}

/* ── Buttons ───────────────────────────────── */
.btn-refexo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Roboto', sans-serif;
}

.btn-primary {
  background: var(--primary);
  color: var(--light);
}
.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-blue);
}

.btn-secondary {
  background: var(--light);
  border-color: var(--border);
  color: var(--text);
}
.btn-secondary:hover {
  background: var(--bg);
  border-color: var(--neutral);
}

.btn-danger {
  background: #DC2626;
  color: var(--light);
}
.btn-danger:hover {
  background: #B91C1C;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.82rem;
}

/* ── Cards & Grid ──────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.metric-card {
  background: var(--light);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 20px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.metric-data {
  flex-grow: 1;
}

.metric-val {
  font-family: 'DM Serif Display', serif;
  font-size: 1.8rem;
  color: var(--dark);
  line-height: 1.1;
  margin-top: 4px;
}

.metric-label {
  font-size: 0.8rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 28px;
}

@media (max-width: 992px) {
  .dashboard-layout {
    grid-template-columns: 1fr;
  }
}

.crm-card {
  background: var(--light);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 28px;
}

.crm-card-title {
  font-size: 1.4rem;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ── Tables ────────────────────────────────── */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.crm-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.crm-table th {
  padding: 12px 16px;
  background: var(--bg);
  border-bottom: 2px solid var(--border);
  color: var(--text-light);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.crm-table td {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 0.92rem;
  vertical-align: middle;
}

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

.crm-table tr:hover td {
  background: #FAFBFD;
}

/* Badges */
.badge-refexo {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 100px;
  text-transform: uppercase;
}

.badge-draft { background: #E5E7EB; color: #4B5563; }
.badge-sent { background: #FEF3C7; color: #D97706; }
.badge-accepted { background: #D1FAE5; color: #059669; }
.badge-rejected { background: #FEE2E2; color: #DC2626; }
.badge-completed { background: #DBEAFE; color: #2563EB; }

.badge-prospect { background: #F3E8FF; color: #7C3AED; }
.badge-client { background: #E0F2FE; color: #0369A1; }

.badge-active { background: #D1FAE5; color: #059669; }
.badge-inactive { background: #F3F4F6; color: #4B5563; }
.badge-archived { background: #FEE2E2; color: #DC2626; }

/* ── Forms ─────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
}

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

.form-group.full-width {
  grid-column: 1 / -1;
}

.crm-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.crm-input, .crm-select, .crm-textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  padding: 10px 14px;
  background: var(--light);
  transition: all 0.15s ease;
  font-family: 'Roboto', sans-serif;
}

.crm-input:focus, .crm-select:focus, .crm-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,119,182,.12);
  outline: none;
}

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

/* ── Mobile Hamburger & Responsiveness ──────── */
.hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--dark);
  cursor: pointer;
}

.mobile-user-menu {
  display: none;
}

@media (max-width: 768px) {
  .hamburger {
    display: block;
  }
  .crm-nav {
    display: none;
  }
  .mobile-user-menu {
    display: block;
  }

  .info-grid {
    grid-template-columns: 1fr !important;
  }

  .print-parties {
    grid-template-columns: 1fr !important;
  }

  .header-container {
    flex-wrap: wrap;
  }
  .mobile-menu-open .crm-nav {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-top: 12px;
    gap: 4px;
  }
}

/* ── Esthétique de l'Estimateur connecté ────── */
.estimator-layout {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 28px;
}

@media (max-width: 992px) {
  .estimator-layout {
    grid-template-columns: 1fr;
  }
}

/* ── Print / Facture Devis ──────────────────── */
.print-wrap {
  background: var(--light);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 40px;
  box-shadow: var(--shadow-sm);
  max-width: 800px;
  margin: 0 auto;
}

.print-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid var(--primary-light);
  padding-bottom: 24px;
  margin-bottom: 32px;
}

.print-logo-area img {
  height: 60px;
}

.print-meta {
  text-align: right;
}

.print-meta h2 {
  margin: 0 0 8px 0;
  font-size: 1.8rem;
  color: var(--primary);
}

.print-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-bottom: 32px;
}

.party-box h4 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}

.party-box p {
  margin: 4px 0;
  font-size: 0.95rem;
}

.print-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 32px;
}

.print-table th {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 600;
  padding: 10px 14px;
  font-size: 0.85rem;
  text-transform: uppercase;
}

.print-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}

.print-totals {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin-top: 20px;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  width: 250px;
  padding: 6px 0;
  font-size: 0.95rem;
}

.totals-row.final {
  border-top: 2px solid var(--primary);
  font-family: 'DM Serif Display', serif;
  font-size: 1.6rem;
  color: var(--primary-dark);
  padding-top: 10px;
  margin-top: 6px;
}

.print-footer {
  text-align: center;
  color: var(--text-light);
  font-size: 0.8rem;
  margin-top: 60px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

@media print {
  body {
    background: white;
    color: black;
  }
  .crm-header, .page-header, .no-print {
    display: none !important;
  }
  .print-wrap {
    border: none;
    box-shadow: none;
    padding: 0;
  }
}
