@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --primary:        #1F3BB3;
  --primary-light:  rgba(31, 59, 179, 0.08);
  --primary-border: rgba(31, 59, 179, 0.20);
  --danger:         #F95F53;
  --danger-light:   rgba(249, 95, 83, 0.08);
  --success:        #34B1AA;

  --body-bg:        #f0f3f8;
  --sidebar-bg:     #ffffff;
  --navbar-bg:      #ffffff;
  --card-bg:        #ffffff;

  --text-dark:      #1a2332;
  --text-body:      #4a5568;
  --text-muted:     #8e9ab0;

  --border-color:   #e4e9f2;
  --border-radius:  8px;
  --border-radius-sm: 5px;

  --sidebar-width:  255px;
  --navbar-height:  63px;

  --shadow-sm:  0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow:     0 4px 20px rgba(0, 0, 0, 0.09);
}

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

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

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/* ── Layout shell ───────────────────────────────────────────── */
.container-scroller {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-body-wrapper {
  display: flex;
  padding-top: var(--navbar-height);
  min-height: 100vh;
}

/* ── Navbar ─────────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--navbar-height);
  background: var(--navbar-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: stretch;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.navbar-brand-wrapper {
  width: var(--sidebar-width);
  display: flex;
  align-items: center;
  padding: 0 24px;
  border-right: 1px solid var(--border-color);
  flex-shrink: 0;
}

.navbar-brand {
  font-size: 17px;
  font-weight: 800;
  color: var(--primary);
  text-decoration: none;
  letter-spacing: -0.3px;
}
.navbar-brand:hover { text-decoration: none; }

.navbar-menu-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 8px;
}

.navbar-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.navbar-nav.ms-auto { margin-left: auto; }

.navbar-user {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
  padding: 6px 12px;
}

.navbar-nav .nav-link {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  color: var(--text-body);
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--border-radius-sm);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.navbar-nav .nav-link:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: var(--navbar-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 99;
  padding: 20px 0 32px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

.sidebar .nav {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar .nav-item {
  position: relative;
}

.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: #4a5568;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

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

.sidebar .nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
  border-right: 3px solid var(--primary);
}

.sidebar .menu-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.75;
}

.sidebar .menu-icon svg {
  width: 18px;
  height: 18px;
}

.sidebar .nav-link:hover .menu-icon,
.sidebar .nav-link.active .menu-icon {
  opacity: 1;
}

.sidebar .nav-category {
  padding: 20px 20px 7px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

/* ── Main panel ─────────────────────────────────────────────── */
.main-panel {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.content-wrapper {
  padding: 28px 30px;
  flex: 1;
}

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

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
}

/* ── Card ───────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.card-body {
  padding: 24px;
}

.card-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border: 1px solid transparent;
  border-radius: var(--border-radius);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s, box-shadow 0.15s;
  line-height: 1;
}

.btn:hover { opacity: 0.88; text-decoration: none; }
.btn:focus { outline: none; box-shadow: 0 0 0 3px rgba(31, 59, 179, 0.18); }

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:focus { box-shadow: 0 0 0 3px rgba(249, 95, 83, 0.20); }

.btn-outline {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-body);
}

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

/* ── Stat cards ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 22px 24px;
}

.stat-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.stat-card__label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.stat-card__icon {
  width: 38px;
  height: 38px;
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card__icon svg { width: 18px; height: 18px; }

.stat-card__icon--blue   { background: var(--primary-light); color: var(--primary); }
.stat-card__icon--purple { background: rgba(124, 77, 255, 0.08); color: #7c4dff; }
.stat-card__icon--green  { background: rgba(52, 177, 170, 0.10); color: var(--success); }
.stat-card__icon--orange { background: rgba(249, 115, 22, 0.10); color: #f97316; }

.stat-card__value {
  font-size: 30px;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1;
  margin-bottom: 12px;
}

.stat-card__revenue {
  font-size: 14px;
  font-weight: 600;
  color: #f97316;
  margin-bottom: 8px;
}

.stat-card__trend {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
}

.stat-card__trend--up      { color: var(--success); }
.stat-card__trend--down    { color: var(--danger); }
.stat-card__trend--neutral { color: var(--text-muted); }

.stat-card__trend-label {
  font-weight: 400;
  color: var(--text-muted);
}

/* ── Data card (table + future filters/pagination) ──────────── */
.data-card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.data-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  gap: 12px;
}

.data-card__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
}

.data-card__toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.data-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Table ──────────────────────────────────────────────────── */
.table-responsive {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-card .table-responsive {
  border-radius: 0;
}

.table thead th {
  padding: 12px 20px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  background: #f7f9fc;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}

.table tbody td {
  padding: 13px 20px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-body);
  vertical-align: middle;
}

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

.table tbody tr:hover td {
  background: #fafbfd;
}

.table .col-actions {
  text-align: right;
  white-space: nowrap;
  width: 1%;
}

.table-empty {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-muted);
}

/* ── Total hours badge ──────────────────────────────────────── */
.total-hours-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  border-radius: var(--border-radius-sm);
  padding: 5px 12px;
  font-size: 13px;
}
.total-hours-badge--billable {
  background: rgba(249, 115, 22, 0.08);
  color: #f97316;
  border-color: rgba(249, 115, 22, 0.20);
}

/* ── Badge ──────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}
.badge--green   { background: rgba(52, 177, 170, 0.12); color: var(--success); }
.badge--neutral { background: var(--bg-subtle); color: var(--text-muted); }

/* ── Hours tags ─────────────────────────────────────────────── */
.hours-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  vertical-align: middle;
}
.hours-tag--billed {
  background: #dcfce7;
  color: #166534;
  text-decoration: none;
}
.hours-tag--billed:hover {
  background: #bbf7d0;
  text-decoration: underline;
}
.hours-tag--unbilled {
  background: #fee2e2;
  color: #991b1b;
}
.hours-tag--neutral {
  background: #f1f5f9;
  color: #64748b;
}

/* ── Billing status filter ──────────────────────────────────── */
.billing-filter {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.billing-filter__option {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 2px solid transparent;
  opacity: 0.45;
  transition: opacity 0.15s, border-color 0.15s;
  user-select: none;
}
.billing-filter__option input[type="checkbox"] {
  display: none;
}
.billing-filter__option:has(input:checked) {
  opacity: 1;
  border-color: currentColor;
}
.billing-filter__option--neutral  { background: #f1f5f9; color: #64748b; }
.billing-filter__option--billed   { background: #dcfce7; color: #166534; }
.billing-filter__option--unbilled { background: #fee2e2; color: #991b1b; }

/* ── Home toolbar ───────────────────────────────────────────── */
.home-billable-toggle {
  margin-left: auto;
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
}

/* ── Chart card ─────────────────────────────────────────────── */
.chart-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  margin-top: 24px;
  padding: 20px 24px;
}
.chart-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.chart-card__toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}
.chart-card__title {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}
.chart-wrapper {
  position: relative;
  height: 280px;
}

/* ── Period toggle ──────────────────────────────────────────── */
.period-toggle {
  display: flex;
  gap: 4px;
}
.period-btn {
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.period-btn:hover { background: var(--bg-subtle); color: var(--text-main); }
.period-btn--active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ── Filters ────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.filter-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.filter-control {
  width: auto;
  min-width: 160px;
}

.filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 1px;
}

/* ── Pagination ──────────────────────────────────────────────── */
.pagination {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-body);
  text-decoration: none;
  background: #fff;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  cursor: pointer;
}

.page-link:hover {
  background: var(--primary-light);
  border-color: var(--primary-border);
  color: var(--primary);
  text-decoration: none;
}

.page-item.active .page-link {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.page-item.disabled .page-link {
  opacity: 0.4;
  pointer-events: none;
}

.pagination-info {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text-muted);
  font-size: 13px;
}

.page-size-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}

.page-size-select {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 4px 8px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-body);
  background: #fff;
  cursor: pointer;
}

.page-size-select:focus {
  outline: none;
  border-color: var(--primary);
}

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

.form-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.form-group--sm       { flex: 0 0 200px; }
.form-group--checkbox { flex: 0 0 auto; justify-content: flex-end; padding-bottom: 2px; }

.form-check { display: flex; align-items: center; gap: 8px; cursor: pointer; height: 38px; }
.form-check-input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--primary); }
.form-check-label { font-size: 14px; }

.form-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dark);
}

.form-control {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 10px 14px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-body);
  background: #ffffff;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-border);
}

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

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

/* ── Login page ─────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--body-bg);
  padding: 24px;
}

.auth-form-light {
  background: #ffffff;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  padding: 40px 48px;
  width: 100%;
  max-width: 440px;
}

.auth-brand-logo {
  margin-bottom: 2rem;
}

.auth-brand-name {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.3px;
}

.auth-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0 0 4px;
}

.auth-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
  margin: 0 0 24px;
}

.auth-form .form-group {
  margin-bottom: 1.5rem;
}

.auth-form .form-control {
  background: transparent;
  border-radius: 0;
  border: 1px solid var(--border-color);
  font-size: 0.9375rem;
  padding: 0.875rem 0.75rem;
  color: var(--text-body);
  width: 100%;
}

.auth-form .form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: none;
  background: transparent;
}

.auth-form .form-control::placeholder {
  color: #b0bac9;
}

.btn-auth {
  display: block;
  width: 100%;
  padding: 1rem 2rem;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.02em;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: opacity 0.15s;
}

.btn-auth:hover { opacity: 0.88; }

.btn-auth-primary {
  background: var(--primary);
  color: #fff;
}

.auth-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1rem 0;
  font-size: 13px;
}

.auth-check {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  cursor: pointer;
}

.auth-check input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--primary);
}

.auth-link {
  font-size: 0.812rem;
  color: var(--text-dark);
  text-decoration: none;
}

.auth-link:hover { color: var(--text-dark); text-decoration: none; }

.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 300;
}

.auth-footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.auth-error {
  background: rgba(249, 95, 83, 0.08);
  border: 1px solid rgba(249, 95, 83, 0.25);
  border-radius: var(--border-radius-sm);
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 14px;
  margin-bottom: 1.5rem;
}

/* ── Hamburger button (mobile only) ────────────────────────── */
.navbar-toggler {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-body);
  border-radius: var(--border-radius-sm);
  flex-shrink: 0;
}
.navbar-toggler:hover { background: var(--primary-light); color: var(--primary); }
.navbar-toggler svg { width: 20px; height: 20px; }

/* ── Sidebar overlay backdrop (mobile only) ─────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 98;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.sidebar-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Navbar */
  .navbar-toggler { display: flex; }
  .navbar-brand-wrapper {
    width: auto;
    border-right: none;
    padding: 0 12px 0 16px;
  }
  .navbar-menu-wrapper { padding: 0 12px; }
  .navbar-user { display: none; }

  /* Sidebar: masquée par défaut, glisse depuis la gauche */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 99;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { display: block; }

  /* Main panel: pleine largeur */
  .main-panel { margin-left: 0; }

  /* Contenu */
  .content-wrapper { padding: 16px; }

  /* Page header : empiler si peu de place */
  .page-header { flex-wrap: wrap; gap: 10px; }

  /* Stats : 1 colonne */
  .stats-grid { grid-template-columns: 1fr; gap: 12px; }

  /* Filtres : chaque groupe occupe toute la largeur */
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-group { width: 100%; }
  .filter-control { min-width: 0; width: 100%; }
  .filter-actions { width: 100%; }

  /* Data card header : permettre retour à la ligne */
  .data-card__header { flex-wrap: wrap; gap: 8px; }
  .data-card__toolbar { flex-wrap: wrap; margin-left: 0; }

  /* Footer de la data-card : empiler */
  .data-card__footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  /* Formulaire login */
  .auth-form-light { padding: 28px 20px; }

  /* Chart */
  .chart-wrapper { height: 200px; }
  .chart-card__header { flex-wrap: wrap; gap: 10px; }
}
