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

:root{
  --bg: #f6f7fb;
  --bg-2: #f0f4ff;
  --panel: #ffffff;
  --panel-2: #f7f7fb;
  --text: #0f172a;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #0ea5a4;
  --accent-2: #22c55e;
  --accent-warm: #f97316;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #22c55e;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}
*{box-sizing:border-box}
body{
  margin:0;
  font-family: "Space Grotesk", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background:
    radial-gradient(800px 400px at 10% 0%, #e9f7ff 0%, transparent 60%),
    radial-gradient(900px 500px at 90% 10%, #fff1e8 0%, transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}
a{color: var(--text); text-decoration:none}
a:hover{color: var(--accent)}

.app{min-height:100vh; display:flex; flex-direction:column}
.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
  padding:16px 24px;
  background: rgba(255,255,255,0.9);
  border-bottom:1px solid var(--line);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand a{font-weight:700; letter-spacing:0.2px}
.brand-link{display:flex; align-items:center; gap:10px}
.brand-logo{height:34px; width:auto; display:block}
.nav{display:flex; gap:10px; flex-wrap:wrap}
.nav a{
  color: var(--muted);
  padding:6px 10px;
  border-radius:999px;
  background: transparent;
}
.nav a:hover{
  color: var(--text);
  background: #f3f4f6;
}
.search-form{display:flex; align-items:center; gap:8px}
.search-form .input{min-width:240px}
.user{display:flex; gap:12px; align-items:center; color: var(--muted)}

.content{flex:1; padding:24px; max-width:1200px; width:100%; margin:0 auto}
.footer{padding:16px 24px; color: var(--muted); border-top:1px solid var(--line)}

.grid{display:grid; gap:16px}
.grid-3{grid-template-columns: repeat(auto-fit, minmax(240px, 1fr))}
.grid-2{grid-template-columns: repeat(auto-fit, minmax(320px, 1fr))}

.card{
  background: var(--panel);
  border:1px solid var(--line);
  border-radius:14px;
  padding:16px;
  box-shadow: var(--shadow);
  animation: fadeUp 0.35s ease;
}
.card h3{margin:0 0 8px 0}

.table{width:100%; border-collapse:collapse; font-size:14px}
.table th, .table td{padding:10px 8px; border-bottom:1px solid var(--line); text-align:left}
.table th{color: var(--muted); font-weight:600}
.table tr:hover{background: #f8fafc}

.form{display:grid; gap:12px}
.form label{font-size:13px; color: var(--muted)}
.input, select, textarea{
  width:100%; padding:10px 12px; background: var(--panel-2); border:1px solid var(--line); color: var(--text); border-radius:10px;
}
textarea{min-height:90px}

.date-range{
  padding:12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border:1px solid #dbeafe;
  border-radius:14px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}
.input-date{
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border:1px solid #cbd5f5;
  box-shadow: 0 10px 24px rgba(14, 165, 164, 0.12);
  font-weight:600;
  letter-spacing:0.2px;
  border-radius:12px;
}
.input-date:focus{
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 165, 164, 0.18), 0 12px 26px rgba(14, 165, 164, 0.18);
}
.date-range label{
  color:#0f172a;
  font-weight:600;
}
input[type="date"].input-date::-webkit-calendar-picker-indicator{
  opacity:0.75;
  cursor:pointer;
}
.flatpickr-calendar{
  border-radius:16px !important;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18) !important;
  border:1px solid #e2e8f0 !important;
  font-family: "Space Grotesk", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}
.flatpickr-months{
  padding:8px 10px 4px;
}
.flatpickr-current-month{
  font-weight:700;
}
.flatpickr-weekday{
  font-weight:600;
  color:#64748b;
}
.flatpickr-day{
  border-radius:10px !important;
  font-weight:600;
}
.flatpickr-day.today{
  border-color: var(--accent) !important;
}
.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.inRange{
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color:#fff !important;
  box-shadow: 0 8px 16px rgba(14, 165, 164, 0.25);
}
.flatpickr-day:hover{
  background:#ecfeff !important;
  border-color:#99f6e4 !important;
}
.search-results{
  position: relative;
}
.search-results-list{
  position:absolute;
  top:6px;
  left:0;
  right:0;
  background:#ffffff;
  border:1px solid #e2e8f0;
  border-radius:12px;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.12);
  z-index: 10;
  max-height:220px;
  overflow:auto;
}
.search-results-item{
  width:100%;
  text-align:left;
  padding:10px 12px;
  background:#fff;
  border:none;
  border-bottom:1px solid #f1f5f9;
  cursor:pointer;
  font-weight:600;
}
.search-results-item:hover{
  background:#f8fafc;
}
.search-results-item.is-selected{
  background:#ecfeff;
  border-left:3px solid var(--accent);
}
.search-results-meta{
  display:block;
  color:#64748b;
  font-size:12px;
  font-weight:500;
  margin-top:2px;
}
.modal-backdrop{
  position:fixed;
  inset:0;
  background: rgba(15, 23, 42, 0.45);
  display:none;
  align-items:center;
  justify-content:center;
  z-index: 60;
  padding:20px;
}
.modal-card{
  background:#ffffff;
  border-radius:16px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
  border:1px solid #e2e8f0;
  max-width:520px;
  width:100%;
  padding:16px;
}
.modal-title{
  font-weight:700;
  font-size:18px;
}
.modal-body{
  margin-top:8px;
  color:#0f172a;
}
.modal-actions{
  display:flex;
  gap:8px;
  justify-content:flex-end;
  flex-wrap:wrap;
  margin-top:14px;
}

.btn{
  display:inline-block; padding:8px 12px; border-radius:10px; border:1px solid transparent;
  background: var(--accent); color:#ffffff; font-weight:600; cursor:pointer;
  box-shadow: 0 6px 16px rgba(14, 165, 164, 0.25);
}
.btn:hover{filter:brightness(1.03); color:#ffffff}
.btn-ghost{background: #f3f4f6; color: var(--text); border:1px solid var(--line); box-shadow:none}
.btn-ghost:hover{color: var(--text)}
.btn-danger{background: var(--danger); color: #fff; box-shadow: 0 6px 16px rgba(239, 68, 68, 0.25)}
.btn-warning{background: var(--warning); color:#111827; box-shadow: 0 6px 16px rgba(245, 158, 11, 0.25)}
.btn-success{background: var(--success); color:#0b1220; box-shadow: 0 6px 16px rgba(34, 197, 94, 0.25)}

.actions{display:flex; gap:8px; flex-wrap:wrap}
.action-row{align-items:center; justify-content:flex-end; flex-wrap:nowrap}
.action-row form{margin:0; display:inline-flex}
.action-row a, .action-row button{display:inline-flex; align-items:center}
.btn-small{padding:6px 10px; font-size:12px; box-shadow:none}
.segmented .btn-ghost.is-active{background: var(--accent); color:#fff; border-color: var(--accent)}
.bar-track{height:8px; width:140px; background:#e2e8f0; border-radius:999px; overflow:hidden}
.bar-fill{height:8px; background: var(--accent); border-radius:999px}
.chart{display:flex; align-items:flex-end; gap:8px; height:140px; padding:12px; background:#f8fafc; border:1px dashed var(--line); border-radius:12px; margin-bottom:10px}
.chart-bar{flex:1; min-width:28px; display:flex; flex-direction:column; align-items:center; justify-content:flex-end; gap:6px}
.chart-fill{width:100%; background: var(--accent); border-radius:10px 10px 4px 4px; min-height:6px}
.chart-bar.is-muted .chart-fill{background: #94a3b8}
.chart-label{font-size:11px; color: var(--muted)}

.badge{
  display:inline-block; padding:3px 8px; border-radius:999px; font-size:12px;
  background: #ecfeff; border:1px solid #c7f9f7; color: #0f766e;
}

.stat-card{
  border:1px dashed var(--line);
  background: #f8fafc;
  padding:12px;
  border-radius:12px;
}
.stat-label{font-size:12px; color: var(--muted); text-transform:uppercase; letter-spacing:0.04em}
.stat-value{font-size:20px; font-weight:700}

.pill{
  display:inline-flex; align-items:center; padding:2px 8px; border-radius:999px; font-size:12px;
  background:#eef2ff; color:#3730a3; border:1px solid #e0e7ff;
}
.pill-muted{background:#f3f4f6; color:#475569; border-color:#e2e8f0}
.pill-success{background:#ecfdf3; color:#166534; border-color:#bbf7d0}
.pill-warning{background:#fffbeb; color:#92400e; border-color:#fde68a}
.pill-danger{background:#fef2f2; color:#991b1b; border-color:#fecaca}

.subtext{display:block; color: var(--muted); font-size:12px; margin-top:2px}
.table-compact th, .table-compact td{padding:12px 10px}
.row-highlight{background:#f8fffb}

.alert{
  padding:10px 12px; border-radius:10px; margin-bottom:16px; border:1px solid var(--line)
}
.alert-success{background:#ecfdf3; color:#166534; border-color:#bbf7d0}
.alert-error{background:#fef2f2; color:#991b1b; border-color:#fecaca}
.alert-warning{background:#fffbeb; color:#92400e; border-color:#fde68a}

.kpi{font-size:22px; font-weight:700}
.muted{color: var(--muted)}

.login-wrap{max-width:420px; margin:60px auto}

/* FullCalendar light theme */
.fc{
  --fc-border-color: var(--line);
  --fc-page-bg-color: transparent;
  --fc-neutral-bg-color: #f8fafc;
  --fc-today-bg-color: #ecfeff;
  --fc-button-bg-color: #f3f4f6;
  --fc-button-border-color: var(--line);
  --fc-button-text-color: var(--text);
  --fc-button-active-bg-color: var(--accent);
  --fc-button-active-border-color: var(--accent);
  --fc-button-active-text-color: #fff;
}
.fc .fc-toolbar-title{font-weight:700}
.fc .fc-button{border-radius:10px; box-shadow:none}
.fc .fc-button-primary:focus{box-shadow:none}
.fc .fc-daygrid-day-number{color: var(--muted)}
.fc .fc-daygrid-day.fc-day-today .fc-daygrid-day-number{color: var(--text); font-weight:700}
.fc .fc-scrollgrid, .fc .fc-scrollgrid-section-liquid > td{border-radius:12px}

/* Calendrier: alertes visuelles */
.fc-event.option-expired{
  background:#e5e7eb !important;
  border-color:#cbd5e1 !important;
  color:#334155 !important;
  text-decoration: line-through;
  opacity:0.9;
}
.fc-event.option-expired .fc-event-title{
  text-decoration: line-through;
}
.fc-event.option-warning{
  box-shadow: 0 0 0 2px #f59e0b inset;
}
.fc-event.overlap-error{
  box-shadow: 0 0 0 2px #ef4444 inset;
  border-color:#ef4444 !important;
}
.fc-event.annulee{
  background:#e5e7eb !important;
  border-color:#cbd5e1 !important;
  color:#475569 !important;
  text-decoration: line-through;
  opacity:0.8;
}
.fc-event.annulee .fc-event-title{
  text-decoration: line-through;
}
.fc-event.type-caveau{
  border-left: 6px solid #7c3aed !important;
}
.fc-event.type-salle{
  border-left: 6px solid #0ea5a4 !important;
}
.fc-event.payee::after,
.fc-event.acompte::after{
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: middle;
}
.fc-event.payee::after{
  background:#16a34a;
}
.fc-event.acompte::after{
  background:#f59e0b;
}

@keyframes fadeUp{
  from{opacity:0; transform: translateY(6px)}
  to{opacity:1; transform: translateY(0)}
}
@media (prefers-reduced-motion: reduce){
  .card{animation:none}
}

@media (max-width: 720px){
  .topbar{flex-direction:column; align-items:flex-start}
  .user{width:100%; justify-content:space-between}
  .search-form{width:100%}
  .search-form .input{width:100%}
}
