/* ArtiGest — démo IM Services */

:root {
  --navy-900: #12161c;
  --navy-800: #1c222b;
  --navy-700: #272f39;
  --blue-600: #2c7aa6;
  --blue-500: #3793c3;
  --cyan-400: #6cc0e6;
  --white: #ffffff;
  --gray-50: #f4f7fb;
  --gray-100: #e9eef5;
  --gray-300: #c4cfdc;
  --gray-600: #5b6b7c;
  --gray-900: #101823;
  --green: #1a9d63;
  --red: #d0433f;
  --amber: #c98a1c;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 2px 10px rgba(7, 28, 51, 0.08);
  --shadow-md: 0 10px 30px rgba(7, 28, 51, 0.14);
  --shadow-lg: 0 20px 50px rgba(7, 28, 51, 0.22);

  --topbar-h: 60px;
  --bottomnav-h: 64px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { display: block; }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; }
ul { list-style: none; }

/* ===== App shell ===== */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--navy-900);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.05rem; }
.topbar .brand-mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--blue-500), var(--cyan-400));
  display: flex; align-items: center; justify-content: center;
}
.topbar .brand-mark svg { width: 18px; height: 18px; color: var(--white); }
.topbar .brand small { display: block; font-size: 0.62rem; font-weight: 500; color: var(--gray-300); }

.install-btn {
  display: none;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--blue-500), var(--cyan-400));
  color: var(--white);
  border: none;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}
.install-btn.visible { display: inline-flex; }
.install-btn svg { width: 15px; height: 15px; }

.demo-banner {
  position: fixed;
  top: var(--topbar-h);
  left: 0; right: 0;
  background: #fff6e0;
  color: #7a5a12;
  font-size: 0.78rem;
  text-align: center;
  padding: 7px 14px;
  z-index: 99;
  border-bottom: 1px solid #f0dca3;
}
.demo-banner a { font-weight: 700; text-decoration: underline; }

main.view-container {
  flex: 1;
  padding: calc(var(--topbar-h) + 40px) 18px calc(var(--bottomnav-h) + 32px);
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}

/* ===== Bottom nav (mobile) / side nav (desktop) ===== */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottomnav-h);
  background: var(--white);
  border-top: 1px solid var(--gray-100);
  display: flex;
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(7,28,51,0.06);
}
.bottom-nav button {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--gray-600);
  font-size: 0.68rem;
  font-weight: 600;
}
.bottom-nav button svg { width: 21px; height: 21px; }
.bottom-nav button.active { color: var(--blue-500); }

/* ===== Section header ===== */
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 12px;
}
.view-header h1 { font-size: 1.4rem; font-weight: 800; color: var(--navy-900); }
.view-header p { color: var(--gray-600); font-size: 0.88rem; margin-top: 2px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.88rem;
  border: 2px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: linear-gradient(135deg, var(--blue-500), var(--cyan-400)); color: var(--white); box-shadow: var(--shadow-sm); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-ghost { background: var(--white); color: var(--navy-900); border-color: var(--gray-100); }
.btn-ghost:hover { border-color: var(--blue-500); color: var(--blue-500); }
.btn-danger { background: #fdecec; color: var(--red); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 0.8rem; }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: 12px; }

/* ===== Cards ===== */
.card {
  background: var(--white);
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-100);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}

/* Dashboard */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 26px; }
.stat-card {
  background: var(--white);
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-100);
  padding: 16px 14px;
  text-align: center;
}
.stat-card strong { display: block; font-size: 1.5rem; font-weight: 800; color: var(--navy-900); }
.stat-card span { font-size: 0.72rem; color: var(--gray-600); font-weight: 600; }
.stat-card.accent { background: linear-gradient(160deg, var(--navy-900), var(--navy-700)); border: none; }
.stat-card.accent strong, .stat-card.accent span { color: var(--white); }
.stat-card.accent span { color: var(--gray-300); }

.section-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--navy-900);
  margin: 26px 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.section-title .link { font-size: 0.8rem; font-weight: 700; color: var(--blue-500); }

.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }

/* List items (appointments / clients) */
.item-list { display: flex; flex-direction: column; gap: 10px; }

.appt-item, .client-item {
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.appt-item:hover, .client-item:hover { border-color: var(--blue-500); transform: translateX(2px); }

.appt-time {
  flex-shrink: 0;
  width: 54px;
  text-align: center;
}
.appt-time strong { display: block; font-size: 1rem; font-weight: 800; color: var(--navy-900); }
.appt-time span { font-size: 0.68rem; color: var(--gray-600); }

.appt-body, .client-body { flex: 1; min-width: 0; }
.appt-body h4, .client-body h4 { font-size: 0.95rem; font-weight: 700; color: var(--navy-900); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt-body p, .client-body p { font-size: 0.82rem; color: var(--gray-600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.avatar {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-500), var(--cyan-400));
  color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
}

.chip {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(55,147,195,0.1);
  color: var(--blue-500);
}
.chip.today { background: rgba(26,157,99,0.12); color: var(--green); }
.chip.past { background: var(--gray-100); color: var(--gray-600); }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray-600);
}
.empty-state svg { width: 44px; height: 44px; margin: 0 auto 14px; color: var(--gray-300); }
.empty-state p { font-size: 0.9rem; margin-bottom: 16px; }

/* Search */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 18px;
}
.search-bar svg { width: 17px; height: 17px; color: var(--gray-600); flex-shrink: 0; }
.search-bar input { border: none; outline: none; width: 100%; font-size: 0.9rem; background: transparent; }

/* Agenda date groups */
.date-group { margin-bottom: 22px; }
.date-group-label {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-600);
  margin-bottom: 10px;
  padding-left: 2px;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 28, 51, 0.55);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--white);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 20px 20px 0 0;
  padding: 24px 22px calc(24px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s ease;
}
@media (min-width: 560px) {
  .modal-overlay { align-items: center; }
  .modal { border-radius: var(--radius-lg); }
}
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h3 { font-size: 1.15rem; font-weight: 800; color: var(--navy-900); }
.modal-close { background: var(--gray-50); border: none; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--gray-600); }
.modal-close svg { width: 16px; height: 16px; }

.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 0.82rem; font-weight: 700; color: var(--navy-900); margin-bottom: 5px; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.92rem;
  background: var(--gray-50);
  resize: vertical;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(55,147,195,0.15);
  background: var(--white);
}
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.modal-actions { display: flex; gap: 10px; margin-top: 6px; }

/* Client detail */
.detail-header { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.detail-header .avatar { width: 56px; height: 56px; font-size: 1.2rem; }
.detail-header h3 { font-size: 1.2rem; font-weight: 800; color: var(--navy-900); }
.detail-header p { font-size: 0.85rem; color: var(--gray-600); }
.detail-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--gray-100); }
.detail-row:last-of-type { border-bottom: none; }
.detail-row svg { width: 18px; height: 18px; color: var(--blue-500); flex-shrink: 0; margin-top: 2px; }
.detail-row div span { display: block; font-size: 0.72rem; color: var(--gray-600); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 2px; }
.detail-row div p { font-size: 0.9rem; color: var(--gray-900); }

/* Toast */
.toast {
  position: fixed;
  bottom: calc(var(--bottomnav-h) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--navy-900);
  color: var(--white);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 300;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Fab (mobile quick add) */
.view[data-view] { display: none; }
.view[data-view].active { display: block; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@media (min-width: 720px) {
  main.view-container { max-width: 900px; padding-left: 32px; padding-right: 32px; }
  .quick-actions { grid-template-columns: repeat(4, auto); justify-content: start; }
}
