/* Clinic Portal Specific Styling */

.portal-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Grid Layout */
.sidebar {
  width: 260px;
  background-color: var(--primary);
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 32px 24px;
  position: fixed;
  height: 100vh;
  left: 0;
  top: 0;
  z-index: 10;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
}

.sidebar-brand h2 {
  color: #FFFFFF;
  font-size: 18px;
  font-family: var(--font-serif);
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.menu-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  color: var(--text-light);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  gap: 12px;
}

.menu-item:hover, .menu-item.active {
  background-color: rgba(20, 184, 166, 0.15);
  color: var(--accent);
}

.menu-icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 24px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--secondary);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

/* Main Content Area */
.main-content {
  flex: 1;
  margin-left: 260px;
  padding: 40px 48px;
  background-color: var(--bg-color);
  min-height: 100vh;
}

.top-nav {
  margin-bottom: 40px;
}

/* Consultation Bell & Dropdown */
.notification-bell {
  position: relative;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  background-color: #FFFFFF;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
}

.bell-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background-color: var(--danger);
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.intake-dropdown {
  position: absolute;
  top: 48px;
  right: 0;
  width: 320px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  padding: 16px;
  z-index: 50;
  display: none;
}

.intake-dropdown.active {
  display: block;
}

.intake-dropdown h4 {
  font-size: 14px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.intake-empty {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 12px 0;
}

.intake-list {
  list-style: none;
  max-height: 250px;
  overflow-y: auto;
}

.intake-item {
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  border-bottom: 1px solid var(--border-color);
  font-size: 12px;
  transition: var(--transition);
}

.intake-item:hover {
  background-color: var(--bg-color);
}

.intake-item p {
  margin-top: 4px;
  font-size: 11px;
}

/* Views & Dynamic Tabs */
.tab-view {
  display: none;
}

.tab-view.active {
  display: block;
}

/* Dashboard KPIs */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-bottom: 32px;
}

.metric-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.metric-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.metric-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.metric-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.metric-icon svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.metric-trend {
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.metric-trend.success { color: var(--success); }
.metric-trend.warning { color: var(--warning); }

/* Charts container */
.portal-charts-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 32px;
  margin-bottom: 32px;
}

.chart-container {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  height: 380px; /* Constrain container height to prevent expansion */
  position: relative;
  display: flex;
  flex-direction: column;
}

.chart-container h3 {
  font-size: 16px;
  margin-bottom: 24px;
}

.chart-container canvas {
  max-height: 270px !important;
  width: 100% !important;
}

/* Cards & Lists */
.portal-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

.schedule-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.schedule-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background-color: var(--bg-color);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--secondary);
}

.schedule-time-badge {
  background: var(--primary);
  color: #FFFFFF;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
}

.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 260px;
  overflow-y: auto;
}

.activity-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
}

.activity-time {
  font-size: 11px;
  color: var(--text-light);
  display: block;
  margin-bottom: 2px;
}

/* Tables */
.portal-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.portal-table th {
  padding: 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-color);
  background-color: var(--bg-color);
}

.portal-table td {
  padding: 16px;
  font-size: 14px;
  color: var(--text-dark);
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.portal-table tbody tr:hover {
  background-color: rgba(244, 240, 235, 0.2);
}

/* Custom Interactive Calendar */
.calendar-days-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding: 8px 0;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.calendar-day {
  aspect-ratio: 1.2;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dark);
  background: var(--card-bg);
  cursor: pointer;
  position: relative;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.calendar-day:hover {
  background-color: var(--bg-color);
  border-color: var(--accent);
}

.calendar-day.empty {
  background: transparent;
  border: none;
  cursor: default;
}

.calendar-day.today {
  background-color: var(--accent-light);
  border-color: var(--accent);
  color: var(--secondary);
  font-weight: 700;
}

.calendar-day.selected {
  background-color: var(--secondary);
  color: #FFFFFF;
  border-color: var(--secondary);
}

.calendar-day-dots {
  display: flex;
  justify-content: center;
  gap: 3px;
  margin-top: 4px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.dot-completed { background-color: var(--success); }
.dot-scheduled { background-color: var(--accent); }
.dot-cancelled { background-color: var(--danger); }

/* Switch Toggle Buttons */
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #CBD5E1;
  transition: .4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--secondary);
}

input:checked + .slider:before {
  transform: translateX(24px);
}

/* Reminder Console Logs */
.reminder-log-console {
  background-color: #0F172A;
  border-radius: var(--radius-md);
  padding: 20px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  color: #10B981; /* Green console text */
}

.console-line {
  margin-bottom: 8px;
  border-left: 2px solid var(--accent);
  padding-left: 8px;
}

.console-time {
  color: var(--text-light);
  margin-right: 8px;
}

/* Packages Page Styling */
.package-summary-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.package-summary-card.active-theme {
  border-color: var(--secondary);
  background: linear-gradient(180deg, var(--card-bg) 0%, var(--accent-light) 100%);
}

.package-summary-card h4 {
  font-size: 16px;
  margin-bottom: 8px;
}

.package-summary-card .metric {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
}

.package-summary-card p {
  font-size: 13px;
  margin-bottom: 16px;
}

.package-summary-card .count {
  font-weight: 600;
  font-size: 12px;
  color: var(--secondary);
}

/* Profile Modal Layout */
.profile-modal-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 32px;
}

.profile-sidebar-panel {
  border-right: 1px solid var(--border-color);
  padding-right: 24px;
}

.profile-details-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 13px;
}

.profile-detail-item {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.profile-tab-header {
  display: flex;
  gap: 16px;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 20px;
}

.profile-tab-btn {
  background: none;
  border: none;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  padding: 10px 4px;
  position: relative;
}

.profile-tab-btn.active {
  color: var(--secondary);
}

.profile-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--secondary);
}

.profile-subtab-view {
  display: none;
}

.profile-subtab-view.active {
  display: block;
}

.notes-timeline {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 250px;
  overflow-y: auto;
}

.timeline-note {
  background-color: var(--bg-color);
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  font-size: 13px;
}

.timeline-date {
  font-size: 11px;
  color: var(--text-light);
  margin-bottom: 4px;
  display: block;
  font-weight: 600;
}

/* Financial statement formatting */
.financial-statement {
  background-color: var(--bg-color);
  padding: 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.statement-row {
  margin-bottom: 12px;
  font-size: 14px;
}

.statement-row .value {
  font-weight: 600;
}

/* Printing logic */
@media print {
  body * {
    visibility: hidden;
  }
  #invoiceReceiptModal, #invoiceReceiptModal * {
    visibility: visible;
  }
  #invoiceReceiptModal {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: auto;
    background: white !important;
    backdrop-filter: none !important;
    padding: 0 !important;
    box-shadow: none !important;
  }
  /* Hide print buttons */
  #invoiceReceiptModal button {
    display: none;
  }
}
