/* ═══════════════════════════════════════════════
   DentalxPro – Fully Responsive Admin Dashboard
   Breakpoints:
     Mobile  : < 576px
     Phablet : 576px – 767px
     Tablet  : 768px – 991px
     Desktop : ≥ 992px
   ═══════════════════════════════════════════════ */

/* ── Reset & CSS Variables ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --sidebar-w: 230px;
  --sidebar-bg: #3EAEB0;
  --sidebar-radius: 32px;
  --topbar-h: 60px;
  /* mobile topbar height */
  --brand-color: #fff;
  --accent: #3EAEB0;
  --card-navy: #0d1257;
  --card-purple: #3EAEB0;
  --card-red: #e03c31;
  --card-cyan: #00b8d9;
  --text-main: #1a1a2e;
  --text-muted: #666;
  --border: #ececec;
  --bg-page: #f3f4f8;
  --bg-white: #fff;
  --shadow-card: 0 2px 16px rgba(60, 60, 120, 0.08);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', Inter, system-ui, -apple-system, sans-serif;
  background: var(--bg-page);
  color: var(--text-main);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ══════════════════════════════════════
   OVERLAY (mobile sidebar backdrop)
   ══════════════════════════════════════ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 199;
  opacity: 0;
  transition: opacity var(--transition);
  backdrop-filter: blur(2px);
}

.sidebar-overlay.overlay-visible {
  display: block;
  opacity: 1;
}

/* ══════════════════════════════════════
   APP SHELL
   ══════════════════════════════════════ */
.app {
  display: flex;
  min-height: 94vh;
}

/* ══════════════════════════════════════
   SIDEBAR
   ══════════════════════════════════════ */
.sidebar {

  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: #fff;
  border-top-right-radius: var(--sidebar-radius);
  border-bottom-right-radius: var(--sidebar-radius);
  min-height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: 0px;
  z-index: 200;
  transition: width var(--transition), transform var(--transition), box-shadow var(--transition);
  will-change: width, transform;
  overflow-y: hidden;
  overflow-x: hidden;
}

.sidebar.collapsed {
  width: 76px;
  min-width: 76px;
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-item span {
  display: none;
}

.sidebar.collapsed .brand {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

.sidebar.collapsed .brand-icon {
  margin: 0;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

.sidebar.collapsed {
  width: 76px;
  min-width: 76px;
}

.sidebar.collapsed~.main-content {
  margin-left: 76px;
}

.sidebar.collapsed:hover {
  width: var(--sidebar-w);
}

.sidebar.collapsed:hover~.main-content {
  margin-left: var(--sidebar-w);
}

.sidebar.collapsed:hover .brand-text,
.sidebar.collapsed:hover .nav-item span {
  display: inline;
}


/* ── Sidebar User Profile (bottom) ── */
.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px 20px;
  margin-top: auto;
  flex-shrink: 0;
}

.profile-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.35);
  flex-shrink: 0;
}

.profile-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.profile-info,
a {
  text-decoration: none;
}

.profile-name {
  font-size: 14px;
  font-weight: 700;
  color: #fff;

}

.profile-role {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.65);
  margin-top: 1px;
}


/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 30px 24px 26px;
  flex-shrink: 0;
}

.brand-icon {
  font-size: 22px;
  color: rgba(255, 255, 255, 0.9);
}

.brand-text {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #fff;
  white-space: nowrap;
}

/* Close button — hidden on desktop */
.sidebar-close-btn {
  display: none;
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 8px;
  color: #fff;
  width: 34px;
  height: 34px;
  font-size: 16px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  z-index: 1;
}

.sidebar-close-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* Nav */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 14px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-radius: 12px;
  color: #FFFFFF;
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 500;
  transition: background 0.18s, color 0.18s;
  -webkit-tap-highlight-color: transparent;
}

.nav-item:hover,
.nav-item:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  color: #FFFFFF;
  outline: none;
}

.nav-item.active {
  background: #FFFFFF;
  color: #3EAEB0;
  font-weight: 700;
}

.nav-icon {
  font-size: 17px;
  flex-shrink: 0;
}

/* ══════════════════════════════════════
   MAIN CONTENT
   ══════════════════════════════════════ */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  padding: 26px 44px 17px;
  transition: margin-left var(--transition);
}

/* ══════════════════════════════════════
   MOBILE TOPBAR  (hidden on desktop)
   ══════════════════════════════════════ */
.mobile-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-white);
  padding: 0 16px;
  height: var(--topbar-h);
  border-radius: 14px;
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
}

.mobile-brand {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.4px;
  flex: 1;
  text-align: center;
}

/* Hamburger */
.hamburger-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 38px;
  height: 38px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  flex-shrink: 0;
  transition: background 0.18s;
  -webkit-tap-highlight-color: transparent;
}

.hamburger-btn:hover,
.hamburger-btn:focus-visible {
  background: #f0eeff;
  outline: none;
}

.hamburger-line {
  display: block;
  width: 22px;
  height: 2.5px;
  background: var(--accent);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

/* ── Desktop Topbar ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 17px;
  gap: 15px;
  border-bottom: 1px solid #C5C9CA;
  padding-bottom: 10px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.topbar-right {
  margin-left: auto;
}

.page-title {
  margin: 0;
  color: #3EAEB0;
  font-size: 24px;
}

/* ── Logout Button ── */
.btn-logout {
  background: #F53A43;
  color: #FFFFFF;
  border: none;
  border-radius: 5px;
  padding: 10px 26px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, transform 0.12s;
  white-space: nowrap;
  text-decoration: none;
}

.btn-logout:hover {
  background: #c62828;
}

.btn-logout:active {
  transform: scale(0.97);
}

.btn-logout-sm {
  padding: 7px 16px;
  font-size: 13px;
  border-radius: 8px;
  flex-shrink: 0;
}


.btn-active-btn {
  background: #00A65A;
  color: #FFFFFF;
  border: none;
  border-radius: 5px;
  padding: 10px 26px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, transform 0.12s;
  white-space: nowrap;
  text-decoration: none;
}

.btn-active-btn:hover {
  background: #00A65A;
}

.btn-active-btn:active {
  transform: scale(0.97);
}


/* ══════════════════════════════════════
   STAT CARDS
   ══════════════════════════════════════ */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  border-radius: 18px;
  padding: 22px 18px 20px;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-height: 136px;
  justify-content: center;
  transition: transform 0.18s, box-shadow 0.18s;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.card-icon-wrap {
  margin-bottom: 8px;
}

.card-icon {
  font-size: 30px;
  opacity: 0.95;
}

.card-label {
  font-size: 14px;
  font-weight: 600;
  opacity: 0.95;
  margin-bottom: 4px;
  line-height: 1.3;
}

.card-value {
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
}

.card-sub-name {
  font-size: 14.5px;
  font-weight: 700;
  margin-top: 3px;
  line-height: 1.3;
}

.card-sub-phone {
  font-size: 12.5px;
  opacity: 0.88;
  margin-top: 2px;
}

/* Card colour variants */
.card-navy {
  background: var(--card-navy);
}

.card-purple {
  background: var(--card-purple);
}

.card-red {
  background: var(--card-red);
}

.card-cyan {
  background: var(--card-cyan);
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  background: transparent;
  margin-bottom: 24px;
  box-sizing: border-box;
  flex-wrap: wrap;

}

/* ── Individual Input Wrappers ── */
.filter-field {
  position: relative;

  /* Distributes width evenly among the inputs */
  min-width: 150px;
}

/* ── Styled Inputs ── */
.filter-field input {
  box-sizing: border-box;
  width: 100%;
  height: 56px;
  /* Matches standard premium UI element height */
  padding: 0 16px;
  background: #FFFFFF;
  border: 1.5px solid #D6D6D6;
  /* Soft gray border like the mockup */
  border-radius: 10px;
  font-size: 15px;
  color: #333;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.filter-field select {
  box-sizing: border-box;
  width: 100%;
  height: 56px;
  /* Matches standard premium UI element height */
  padding: 0 16px;
  background: #FFFFFF;
  border: 1.5px solid #0000002B;

  border-radius: 10px;
  font-size: 15px;
  color: #333;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

/* Right padding adjustment for fields containing calendar icons */
.filter-field.date-field input {
  padding-right: 44px;
}

/* Focus state */
.filter-field input:focus {
  border-color: #3EAEB0;
  box-shadow: 0 0 0 3px rgba(62, 174, 176, 0.15);
}

/* Placeholder Styling */
.filter-field input::placeholder {
  color: #8A94A6;
  font-weight: 400;
}

/* ── Calendar Icons Positioning ── */
.filter-field .filter-icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748B;
  font-size: 18px;
  pointer-events: none;
  /* Allows clicking through the icon onto the input */
}

/* ── Search Button ── */
.btn-search {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #3EAEB0;
  /* Exact branding color from image */
  border-radius: 5px;
  color: #ffffff;
  border: none;
  padding: 0 32px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  height: 44px;
  /* Matches input heights perfectly */
  transition: background 0.2s, transform 0.1s;

}

.btn-search:hover {
  background: #35989A;
}

.btn-search:active {
  transform: scale(0.98);
}

/* ── Footer ── */
.page-footer {
  position: relative;
  bottom: 0;
  left: 0;
  width: 100%;
  text-align: center;
  font-size: 13px;
  color: #aaa;
  padding: 11px 0 7px;


}

.page-footer a {
  color: #2ab3a3;
  text-decoration: none;
  font-weight: 500;
}

/* Back Button */
.back-btn {


  font-size: 25px;
  line-height: 29px;
  display: flex;
  align-items: center;
  color: #2b8f91;
  text-decoration: none;
  font-weight: 600;
  margin-left: -11px;
  margin-top: -4px;
}

/* Hover effect (optional but recommended) */
.back-btn:hover {
  color: #2b8f91;
  text-decoration: none;
}

.patient-tabs {
  width: 100%;
  /* Figma fixed width */
  display: flex;
  gap: 22px;
  /* derived from Figma spacing */
  align-items: center;
  flex-wrap: wrap;
  border-bottom: 1px solid #C5C9CA;
  padding-bottom: 10px;
  /* prevent uneven gaps */
}

/* Figma button */
.patient-tabs .tab-btn {
  width: 200px;
  /* fixed like Figma */
  height: 51px;

  display: flex;
  align-items: center;
  justify-content: center;

  background: #ffffff;
  border: 1px solid #D6D6D6;
  border-radius: 10px;

  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 400;
  color: #4E545F;

  text-decoration: none;

  transition: all 0.2s ease;
}

/* hover */
.patient-tabs .tab-btn:hover {
  background: #f1fbfb;
}

/* active (Figma teal) */
.patient-tabs .tab-btn.active {
  background: #3EAEB0;
  border-color: rgba(0, 0, 0, 0.17);
  color: #fff;
}

/* ── Report type radio selector ── */
.report-selector {
  background: #f3f9f9;
  border-radius: 12px;
  padding: 20px 18px;
  min-width: 180px;
  flex-shrink: 0;
}

.report-selector h6 {
  font-size: 16px;
  font-weight: 700;
  color: #3EAEB0;
  margin-bottom: 14px;
}

.report-radio-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 500;
  color: #444;
  cursor: pointer;
  padding: 10px 0;
  user-select: none;
}

.report-radio-label input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #b0d8d3;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: border-color .18s;
}

.report-radio-label input[type="radio"]::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3EAEB0;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  transition: transform .15s;
}

.report-radio-label input[type="radio"]:checked {
  border-color: #3EAEB0;
}

.report-radio-label input[type="radio"]:checked::after {
  transform: translate(-50%, -50%) scale(1);
}

.report-radio-label:has(input:checked) {
  color: #3EAEB0;
  font-weight: 600;
}

/* ── Upload form panel ── */
.upload-panel {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .06);
  margin-bottom: 24px;
  display: none;
}

.upload-panel.active {
  display: block;
}

.upload-panel .form-label {
  font-size: 15px;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
  display: block;
}

.upload-panel .form-control {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1.5px solid #dde0ea;
  border-radius: 10px;
  font-size: 15px;
  color: #2d2d3a;
  background: #fff;
  outline: none;
  font-family: inherit;
  transition: border-color .18s, box-shadow .18s;
}

.upload-panel .form-control:focus {
  border-color: #3EAEB0;
  box-shadow: 0 0 0 3px rgba(62, 174, 176, .12);
}

.upload-panel .file-input-wrap {
  height: 46px;
  border: 1.5px solid #dde0ea;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  display: flex;
  align-items: center;
  transition: border-color .18s;
}

.upload-panel .file-input-wrap:focus-within {
  border-color: #3EAEB0;
  box-shadow: 0 0 0 3px rgba(62, 174, 176, .12);
}

.upload-panel .file-input-wrap input[type="file"] {
  width: 100%;
  height: 100%;
  cursor: pointer;
  font-size: 13px;
  padding: 10px 12px;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  color: #888;
}

/* ── Report card ── */
.report-card {
  background: #fff;
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .06);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.report-card-left {
  flex: 1;
}

.report-card-meta {
  font-size: 13px;
  font-weight: 600;
  color: #9B9FA6;
  margin-bottom: 6px;
}

.report-card-notes {
  font-size: 14px;
  color: #333;
  line-height: 1.5;
  word-break: break-word;
}

.report-card-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.report-card-icon {
  font-size: 38px;
}

.pdf-icon {
  color: #e74c3c;
}

.image-icon {
  color: #3498db;
}

.btn-view-report {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #555;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.btn-view-report:hover {
  color: #3EAEB0;
}

.btn-delete-report {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: #f4f4f4;
  color: #ff4d4f;
  cursor: pointer;
  transition: .3s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.btn-delete-report:hover {
  background: #ff4d4f;
  color: #fff;
}

/* ── field-error ── */
.field-error {
  display: block;
  color: #dc3545;
  font-size: 13px;
  margin-top: 4px;
  font-weight: 500;
}

.treatment-loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  /* dark overlay */
  z-index: 99999;

  display: flex;
  align-items: center;
  justify-content: center;
}

.loader-box {
  background: #fff;
  padding: 25px;
  border-radius: 10px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ══════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ══════════════════════════════════════ */

/* ── Large Tablet (≤ 1200px) ── */
@media (max-width: 1200px) {
  .main-content {
    padding: 28px 28px 27px;
  }
}

/* ── Tablet (≤ 1100px) – 2-col cards ── */
@media (max-width: 1100px) {
  .stat-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

/* ── Tablet Portrait (≤ 991px) – sidebar becomes off-canvas ── */
@media (max-width: 991px) {


  /* Sidebar goes off-screen by default */
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }

  /* When toggled open */
  .sidebar.sidebar-open {
    transform: translateX(0);
    box-shadow: 6px 0 40px rgba(0, 0, 0, 0.22);
  }

  .sidebar-close-btn {
    display: flex;
    /* show X button on mobile/tablet */
  }

  /* Main content takes full width */
  .main-content {
    margin-left: 0px;
    padding: 16px 20px 27px;
  }

  /* Show mobile topbar, hide desktop topbar */
  .mobile-topbar {
    display: flex;
  }

  .topbar {
    display: flex;
  }
}

/* ── Small Tablet / Large Phone (≤ 767px) ── */
@media (max-width: 767px) {
  .stat-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
  }

  .stat-card {
    min-height: 120px;
    padding: 18px 12px;
    border-radius: 14px;
  }

  .card-icon {
    font-size: 26px;
  }

  .card-label {
    font-size: 13px;
  }

  .card-value {
    font-size: 22px;
  }

  .card-sub-name {
    font-size: 13px;
  }

  .card-sub-phone {
    font-size: 12px;
  }

  .table-wrapper {
    border-radius: 12px;
  }

  .pagination-wrap {
    justify-content: center;
  }


  /* Responsive filter bar */

  .filter-bar {
    gap: 8px;
    padding: 12px 14px;
  }

  .filter-field {
    min-width: 120px;
    height: 38px;

  }

  .btn-search {
    height: 38px;
    padding: 8px 16px;
    font-size: 13px;
  }

  .page-topbar {
    gap: 8px;
  }

  .btn-add-patient {
    padding: 8px 14px;
    font-size: 13px;
  }
}

/* ── Mobile (≤ 575px) – 1-col cards, stacked table ── */
@media (max-width: 575px) {
  .main-content {
    padding: 12px 12px 27px;
  }

  /* Single column cards on small phones */
  .stat-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  /* Stack table rows as "cards" */
  .action-link {
    white-space: normal;
    text-align: right;
  }

  .pagination-wrap {
    justify-content: center;
    padding: 14px 12px 0;
  }

  .page-btn {
    min-width: 30px;
    height: 30px;
    font-size: 13px;
    padding: 0 8px;
  }

  /* Responsive filter bar */
  .filter-bar {
    flex-direction: column;
  }

  .filter-field {
    width: 100%;
    flex: none;
    margin: 10px 0px;
  }

  .btn-search {
    width: 100%;
    justify-content: center;
  }
}

/* ── Very Small Phones (≤ 380px) ── */
@media (max-width: 380px) {
  .stat-cards {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .brand-text {
    font-size: 19px;
  }

  .mobile-brand {
    font-size: 16px;
  }
}