/* MediShop Admin — MedC-inspired light SaaS UI */

:root {
  --blue: #2b63d9;
  --blue-hover: #2456c2;
  --blue-soft: #eaf0fc;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --text: #1e2430;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border: #e8ecf2;
  --border-soft: #eef1f6;
  --success: #22c55e;
  --danger: #ef4444;
  --shadow: 0 2px 12px rgba(30, 36, 48, 0.05);
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-w: 220px;
  --font: "Inter", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

ul {
  list-style: none;
}

img {
  display: block;
  max-width: 100%;
}

/* Layout */

.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 28px 18px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Sidebar */

.logo {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--blue);
  letter-spacing: -0.03em;
  padding: 0 10px 32px;
}

.logo span {
  color: var(--text);
  font-weight: 600;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-bottom {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
  margin-top: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 10px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.95rem;
  transition: background 0.15s, color 0.15s;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-item:hover {
  background: var(--bg);
  color: var(--text);
}

.nav-item.active {
  color: var(--blue);
  background: var(--blue-soft);
}

/* Top bar */

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 18px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.search {
  display: flex;
  align-items: stretch;
  max-width: 420px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid transparent;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search:focus-within {
  border-color: #c5d4f5;
  box-shadow: 0 0 0 3px rgba(43, 99, 217, 0.12);
}

.search input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 11px 18px;
  font: inherit;
  color: var(--text);
  outline: none;
  min-width: 0;
}

.search input::placeholder {
  color: var(--text-muted);
}

.search button {
  width: 44px;
  background: var(--blue);
  color: #fff;
  display: grid;
  place-items: center;
  transition: background 0.15s;
  flex-shrink: 0;
}

.search button:hover {
  background: var(--blue-hover);
}

.search button svg {
  width: 18px;
  height: 18px;
}

.datetime {
  justify-self: center;
  padding: 8px 18px;
  background: var(--bg);
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
}

.topbar-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover {
  background: var(--bg);
  color: var(--text);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.icon-btn .dot {
  position: absolute;
  top: 9px;
  right: 10px;
  width: 7px;
  height: 7px;
  background: var(--blue);
  border-radius: 50%;
  border: 2px solid var(--surface);
}

.icon-btn .badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--blue);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 999px;
  display: grid;
  place-items: center;
  line-height: 1;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  margin-left: 6px;
}

/* Content */

.content {
  padding: 24px 32px 40px;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.breadcrumb a:hover {
  color: var(--blue);
}

.breadcrumb .current {
  color: var(--text);
  font-weight: 600;
}

.page-actions {
  display: flex;
  gap: 10px;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.875rem;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: var(--blue);
  color: #fff;
}

.btn-primary:hover {
  background: var(--blue-hover);
}

.btn-outline {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  border-color: #d0d7e3;
  color: var(--text);
  background: var(--bg);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.8125rem;
}

/* Cards & grid */

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.card-head h2 {
  font-size: 1rem;
  font-weight: 700;
}

.card-head a {
  color: var(--blue);
  font-size: 0.8125rem;
  font-weight: 500;
}

.card-head a:hover {
  text-decoration: underline;
}

.grid {
  display: grid;
  grid-template-columns: 260px 1.35fr 1fr 280px;
  grid-template-areas:
    "profile details notes files"
    "orders orders orders payments";
  gap: 18px;
  align-items: start;
}

.profile-card { grid-area: profile; }
.details-card { grid-area: details; }
.notes-card { grid-area: notes; }
.files-card { grid-area: files; }
.orders-card { grid-area: orders; }
.payments-card { grid-area: payments; }

/* Profile */

.profile-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  margin-bottom: 22px;
}

.profile-photo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
}

.profile-top h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.profile-top .email {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.profile-top .email:hover {
  color: var(--blue);
}

.profile-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 20px;
  padding: 14px 0;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}

.profile-stats > div:not(.divider) {
  text-align: center;
}

.profile-stats strong {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.profile-stats span {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.profile-stats .divider {
  width: 1px;
  height: 32px;
  background: var(--border);
}

/* Details */

.details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 24px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-wide {
  grid-column: 1 / -1;
}

.field .label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.field .value {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

/* Notes */

.notes-box {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 16px;
  min-height: 180px;
  display: flex;
  flex-direction: column;
}

.notes-box ul {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.notes-box li {
  position: relative;
  padding-left: 14px;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.notes-box li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--text-muted);
}

.notes-box .btn {
  align-self: flex-end;
}

/* Files */

.file-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-radius: 10px;
  transition: background 0.15s;
}

.file-item:hover {
  background: var(--bg);
}

.file-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #fef2f2;
  color: #dc2626;
  font-size: 0.625rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.file-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.file-name {
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.file-actions {
  display: flex;
  gap: 2px;
  opacity: 0.5;
  transition: opacity 0.15s;
}

.file-item:hover .file-actions {
  opacity: 1;
}

.file-actions button {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--text-secondary);
}

.file-actions button:hover {
  background: var(--surface);
  color: var(--text);
}

.file-actions button:last-child:hover {
  color: var(--danger);
}

.file-actions svg {
  width: 15px;
  height: 15px;
}

/* Orders / timeline */

.tabs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-soft);
  flex-wrap: wrap;
}

.tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.tab {
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s;
}

.tab:hover {
  background: var(--bg);
  color: var(--text);
}

.tab.active {
  color: var(--blue);
  background: var(--blue-soft);
  font-weight: 600;
}

.timeline {
  padding: 8px 0 0;
}

.timeline-item {
  display: grid;
  grid-template-columns: 18px 100px 1fr 140px auto;
  gap: 16px;
  align-items: center;
  padding: 16px 0 16px 4px;
  position: relative;
}

.timeline-item:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 11px;
  top: 36px;
  bottom: 0;
  width: 2px;
  background: var(--blue-soft);
}

.timeline-marker {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--blue);
  border: 3px solid var(--blue-soft);
  box-sizing: content-box;
  margin-left: -2px;
  position: relative;
  z-index: 1;
}

.timeline-date strong {
  display: block;
  font-size: 0.875rem;
  font-weight: 700;
}

.timeline-date span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.timeline-body strong {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.timeline-body span {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.timeline-person {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.timeline-notes {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--blue);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background 0.15s;
}

.timeline-notes:hover {
  background: var(--blue-soft);
}

.timeline-notes svg {
  width: 15px;
  height: 15px;
}

/* Payments */

.payment-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.payment-list li {
  display: grid;
  grid-template-columns: 10px 1fr 16px auto;
  align-items: center;
  gap: 10px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border-soft);
}

.pay-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

.pay-name {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.pay-arrow {
  width: 14px;
  height: 14px;
  color: var(--blue);
}

.pay-amount {
  font-size: 0.875rem;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

.pay-neg {
  color: var(--danger);
}

.payment-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  margin-top: 4px;
}

.payment-total span {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.payment-total strong {
  font-size: 1.05rem;
  font-weight: 700;
}

/* Responsive */

@media (max-width: 1280px) {
  .grid {
    grid-template-columns: 240px 1fr 1fr;
    grid-template-areas:
      "profile details details"
      "notes notes files"
      "orders orders payments";
  }
}

@media (max-width: 1024px) {
  .sidebar {
    width: 72px;
    padding: 20px 12px;
  }

  .logo {
    font-size: 0;
    padding: 0 0 24px;
    text-align: center;
  }

  .logo::first-letter {
    font-size: 1.4rem;
  }

  .logo span {
    display: none;
  }

  .nav-item {
    justify-content: center;
    padding: 12px;
  }

  .nav-item svg {
    margin: 0;
  }

  .nav-item {
    font-size: 0;
    gap: 0;
  }

  .topbar {
    grid-template-columns: 1fr auto;
    padding: 14px 20px;
  }

  .datetime {
    display: none;
  }

  .content {
    padding: 20px;
  }

  .grid {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "profile details"
      "notes files"
      "orders orders"
      "payments payments";
  }

  .timeline-item {
    grid-template-columns: 18px 90px 1fr;
    gap: 12px;
  }

  .timeline-person,
  .timeline-notes {
    grid-column: 3;
  }

  .timeline-person {
    margin-top: -4px;
  }
}

@media (max-width: 720px) {
  .sidebar {
    display: none;
  }

  .grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "profile"
      "details"
      "notes"
      "files"
      "orders"
      "payments";
  }

  .page-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .search {
    max-width: none;
  }

  .topbar {
    grid-template-columns: 1fr auto;
  }
}
