/*
 * Components — cards, badges, tables, status pills, modal, drawer, toast,
 * timeline. Shared by public, portal and admin surfaces.
 * Requires tokens.css + base.css to be loaded first.
 */

.grid { display: grid; gap: 15px }
.cards { grid-template-columns: repeat(4, minmax(0, 1fr)) }

.card {
  background: linear-gradient(180deg, #151515, #101010);
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 17px;
  box-shadow: 0 10px 35px rgba(0, 0, 0, .15);
}
.card.interactive { cursor: pointer; transition: .2s }
.card.interactive:hover { transform: translateY(-2px); border-color: #40392c }
.card .label { color: var(--muted); font-size: 12px }
.card .value { font-size: 27px; font-weight: 800; margin-top: 7px; letter-spacing: -.8px }
.card .trend { margin-top: 7px; font-size: 11px; color: var(--green) }
.metric-foot { margin-top: 9px; color: #7e786e; font-size: 11px }

.section-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 13px; gap: 10px }
.section-title h3 { margin: 0; font-size: 16px }

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 999px;
  background: rgba(198, 162, 75, .11); color: var(--gold2); font-size: 10px; border: 1px solid rgba(198, 162, 75, .12);
}
.badge.green { background: rgba(87, 201, 149, .1); color: var(--green); border-color: rgba(87, 201, 149, .15) }
.badge.red { background: rgba(238, 113, 113, .09); color: var(--red); border-color: rgba(238, 113, 113, .16) }
.badge.blue { background: rgba(119, 168, 255, .1); color: var(--blue); border-color: rgba(119, 168, 255, .15) }

table { width: 100%; border-collapse: collapse }
th, td { padding: 12px 9px; border-bottom: 1px solid var(--line); font-size: 12px; text-align: left; vertical-align: middle }
th { color: var(--muted); font-weight: 600 }
tr[data-client], tr.clickable-row { cursor: pointer }
tr[data-client]:hover, tr.clickable-row:hover { background: #16130d }

.status { padding: 5px 8px; border-radius: 999px; font-size: 10px; font-weight: 800; display: inline-block }
.status.confirmed { background: rgba(87, 201, 149, .12); color: var(--green) }
.status.pending { background: rgba(232, 181, 95, .12); color: var(--amber) }
.status.cancelled { background: rgba(238, 113, 113, .12); color: var(--red) }
.status.neutral { background: rgba(255, 255, 255, .07); color: #ccc }

.progress { height: 7px; background: #282722; border-radius: 999px; overflow: hidden; margin-top: 7px; min-width: 130px }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold2)) }

.client-link {
  color: var(--gold2); font-weight: 800; cursor: pointer; text-decoration: none;
  border-bottom: 1px dashed rgba(234, 214, 141, .45);
}
.client-link:hover { color: #fff }

.credit-pill { padding: 8px 10px; border-radius: 10px; background: #0d0d0d; border: 1px solid var(--line); font-size: 11px }

.timeline { border-left: 1px solid #403725; margin-left: 6px; padding-left: 14px }
.timeline-item { position: relative; padding: 0 0 14px }
.timeline-item:before { content: ""; position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); left: -18px; top: 5px }
.timeline-item b { font-size: 12px }
.timeline-item span { display: block; color: var(--muted); font-size: 10px; margin-top: 2px }

.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px }
.info-box { background: #0d0d0d; border: 1px solid var(--line); border-radius: 12px; padding: 11px }
.info-box span { display: block; color: var(--muted); font-size: 10px; margin-bottom: 5px }
.info-box b { font-size: 12px }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px }

.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px }
.photo-placeholder {
  aspect-ratio: 4/5; border: 1px dashed #4a4338; border-radius: 14px; background: #0d0d0d;
  display: grid; place-items: center; color: var(--muted); font-size: 11px; text-align: center; padding: 10px;
}
.photo-placeholder img { width: 100%; height: 100%; object-fit: cover; border-radius: 13px }

.form-row { display: flex; justify-content: space-between; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 11px }
.note-box { background: #0d0d0d; border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 8px; font-size: 11px; line-height: 1.5; color: #d8d1c6 }

/* Modal */
.modal {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .72); backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal.open { display: flex }
.modal-panel {
  width: min(760px, 96vw); max-height: 92vh; overflow: auto; background: #111;
  border: 1px solid #3b3427; border-radius: 20px; box-shadow: 0 40px 100px rgba(0, 0, 0, .6);
}
.modal-panel.xl { width: min(1280px, 98vw); max-height: 94vh }
.modal-head {
  padding: 17px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between;
  align-items: center; position: sticky; top: 0; background: #111; z-index: 2;
}
.modal-body { padding: 18px }
.modal-foot { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px }

/* Drawer */
.drawer {
  position: fixed; top: 0; right: -720px; width: min(680px, 96vw); height: 100vh; z-index: 140;
  background: #0f0f0f; border-left: 1px solid #3b3427; box-shadow: -30px 0 80px rgba(0, 0, 0, .55);
  transition: right .28s ease; overflow: auto;
}
.drawer.open { right: 0 }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); backdrop-filter: blur(4px); z-index: 130; display: none }
.drawer-backdrop.open { display: block }
.drawer-head {
  position: sticky; top: 0; z-index: 3; background: #101010; border-bottom: 1px solid var(--line);
  padding: 16px 18px; display: flex; justify-content: space-between; align-items: center;
}
.drawer-body { padding: 18px }
.drawer-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 12px }
.drawer-actions .btn { width: 100% }

/* Toast */
.toast {
  position: fixed; right: 20px; bottom: 20px; background: #15130f; border: 1px solid #4a3d25; color: #f2eadb;
  padding: 12px 14px; border-radius: 12px; box-shadow: var(--shadow); z-index: 150; opacity: 0;
  transform: translateY(12px); pointer-events: none; transition: .25s; font-size: 12px;
}
.toast.show { opacity: 1; transform: translateY(0) }

@media (max-width: 1100px) {
  .cards { grid-template-columns: repeat(2, 1fr) }
}
@media (max-width: 800px) {
  .drawer-actions { grid-template-columns: 1fr }
}
@media (max-width: 700px) {
  .info-grid, .two-col, .photo-grid { grid-template-columns: 1fr }
}
@media (max-width: 540px) {
  .cards { grid-template-columns: 1fr }
}
