/* 
  Glucko Web Dashboard Styles
*/

:root {
  --lb: #FFF8F6;
  --db: #2D0101;
  --a1: #81011F;
  --a1-db: #810155;
  --gray: #8F8C8B;
  --light-gray: #DDDCDC;
  --font-family: 'Plus Jakarta Sans', sans-serif;
  --border-radius: 12px;
  --transition: all 0.2s ease-in-out;
  --spacing-4: 4px;
  --spacing-8: 8px;
  --spacing-16: 16px;
  --spacing-24: 24px;
  --spacing-32: 32px;
  --spacing-48: 48px;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--lb);
  color: var(--db);
  line-height: 1.5;
}

/* ==================================
   TYPOGRAPHY
   ================================== */
h1 {
  font-size: 32px;
}

h2 {
  font-size: 24px;
}

h3 {
  font-size: 20px;
}

h4 {
  font-size: 18px;
}

.text-small {
  font-size: 14px;
}

.caption {
  font-size: 12px;
}

h1,
h2,
h3,
h4 {
  font-weight: 600;
  color: var(--db);
}

.subtitle {
  color: var(--gray);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.margin-bottom-sm {
  margin-bottom: 1rem;
}

/* ==================================
   COMMON UTILITIES
   ================================== */
.hidden {
  display: none !important;
}

.card {
  background-color: #fff;
  border-radius: var(--border-radius);
  padding: var(--spacing-24);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  /* subtle shadow, low elevation */
  margin-bottom: var(--spacing-16);
  border: 1px solid var(--light-gray);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.divider {
  border: 0;
  border-top: 1px solid var(--light-gray);
  margin: 1.5rem 0;
}

.row-flex {
  display: flex;
  gap: 1rem;
  align-items: center;
}

/* ==================================
   BUTTONS AND INPUTS
   ================================== */
.input-field {
  width: 100%;
  height: 48px;
  padding: 12px 16px;
  border: 1px solid var(--light-gray);
  border-radius: 8px;
  font-size: 16px;
  font-family: var(--font-family);
  outline: none;
  transition: var(--transition);
}

.input-field:focus {
  border-color: var(--a1);
  box-shadow: 0 0 0 3px rgba(129, 1, 31, 0.1);
}

select.input-field {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232D0101' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 24px;
  padding-right: 48px;
}

textarea.auto-resize {
  height: auto;
  min-height: 48px;
  resize: none;
  overflow: hidden;
}

.btn-primary,
.btn-secondary,
.btn-logout,
.btn-text {
  padding: 16px 25px;
  border-radius: 8px;
  border: none;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-family);
}

.btn-primary {
  background-color: var(--a1);
  color: #fff;
}

.btn-primary:hover {
  background-color: var(--a1-db);
}

.btn-secondary {
  background-color: #fff;
  color: var(--a1);
  border: 1px solid var(--a1);
  white-space: nowrap;
}

.btn-secondary:hover {
  background-color: var(--lb);
}

.btn-secondary.clicked-state {
  background-color: var(--a1);
  color: #fff;
}

.btn-text {
  background-color: transparent;
  color: var(--a1);
  padding: 0;
}

.btn-text:hover {
  text-decoration: underline;
}

.btn-logout {
  width: 100%;
  background-color: transparent;
  color: var(--db);
  padding: 0.75rem;
  justify-content: center;
  border: 1px solid var(--light-gray);
}

.btn-logout:hover {
  background-color: var(--light-gray);
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--db);
}

.required {
  color: var(--a1);
}

/* ==================================
   LOGIN PAGE
   ================================== */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background-color: var(--lb);
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 1rem;
}

.login-card {
  background-color: #fff;
  border-radius: var(--border-radius);
  padding: 2.5rem 2rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--light-gray);
}

.logo {
  text-align: center;
  margin-bottom: 2rem;
}

.logo h1 {
  font-size: 2.5rem;
  color: var(--a1);
  letter-spacing: -1px;
}

.logo p {
  color: var(--gray);
  font-size: 0.9rem;
}

.role-fields {
  display: none;
}

.role-fields.active {
  display: block;
}

.error-msg {
  color: var(--a1);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  min-height: 1.2rem;
}

.login-card .btn-primary {
  width: 100%;
  justify-content: center;
}

/* ==================================
   DASHBOARD LAYOUT
   ================================== */
.layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar follows the branding from mobile reference:
   User wanted light background for sidebar */
.sidebar {
  width: 250px;
  background-color: var(--lb);
  border-right: 1px solid var(--light-gray);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--light-gray);
}

.sidebar-header h2 {
  color: var(--a1);
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}

.doctor-info {
  font-size: 0.85rem;
  color: var(--gray);
}

.doctor-info .doc-name {
  font-weight: 600;
  color: var(--db);
  display: block;
}

.sidebar-nav {
  flex: 1;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--db);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  transition: var(--transition);
}

.nav-item:hover {
  background-color: var(--light-gray);
}

.nav-item.active {
  background-color: var(--db);
  color: var(--lb);
}

.nav-item.active svg {
  stroke: var(--lb);
}

.sidebar-footer {
  padding: 1rem;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: #F8F9FA;
  /* slight contrast from sidebar */
}

.top-header {
  background-color: #fff;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--light-gray);
}

.content-container {
  padding: 2rem;
  flex: 1;
  overflow-y: auto;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==================================
   TABLES
   ================================== */
.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--light-gray);
}

.data-table th {
  color: var(--gray);
  font-weight: 500;
  font-size: 0.9rem;
}

/* ==================================
   SEARCH & LISTS (PATIENT SEARCH)
   ================================== */
.search-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
}

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 1.5rem;
}

.patient-card {
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border: 2px solid transparent;
}

.patient-card:hover {
  transform: translateY(-2px);
  border-color: var(--light-gray);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.pc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pc-id {
  color: var(--gray);
  font-size: 0.85rem;
}

.status-indicator {
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-stable {
  background-color: #E2F5E9;
  color: #15803D;
}

.status-high {
  background-color: #FEE2E2;
  color: #B91C1C;
}

/* ==================================
   PATIENT PROFILE
   ================================== */
.profile-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-top: 1rem;
}

.profile-stats {
  display: flex;
  gap: 1.5rem;
}

.stat-box {
  background-color: var(--lb);
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
  min-width: 120px;
}

.stat-label {
  display: block;
  font-size: 0.85rem;
  color: var(--gray);
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--a1);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}

.record-list {
  list-style: none;
}

.record-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--light-gray);
}

.record-item:last-child {
  border-bottom: none;
}

.ri-title {
  font-weight: 500;
  display: block;
}

.ri-detail {
  font-size: 0.85rem;
  color: var(--gray);
}

/* ==================================
   MODAL
   ================================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background-color: #fff;
  border-radius: var(--border-radius);
  width: 100%;
  max-width: 500px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--light-gray);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.close-modal {
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--gray);
}

.close-modal:hover {
  color: var(--db);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1.5rem;
  background-color: var(--lb);
  border-top: 1px solid var(--light-gray);
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

.checkbox-group label {
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

svg {
  stroke-width: 1.5px;
}

.icon-lg {
  width: 30px;
  height: 30px;
}

.icon-sm {
  width: 20px;
  height: 20px;
}

/* Custom autocomplete dropdown for Patient Search */
#autocomplete-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: #fff;
  color: var(--db);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  margin-top: 4px;
}

#autocomplete-results .autocomplete-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid #CCC;
}

#autocomplete-results .autocomplete-item:hover {
  background-color: #CCC;
}

/* ==================================
   APPOINTMENTS BOARD & BENTO CARDS
   ================================== */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 1.5rem;
}

.appointment-card {
  background-color: #fff;
  border-radius: var(--border-radius);
  padding: 1.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border: 1px solid var(--light-gray);
  transition: var(--transition);
}

.appointment-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.appointment-card h4 {
  margin-bottom: 0;
  font-size: 1.15rem;
}

.ac-time {
  color: var(--gray);
  font-weight: 400;
  font-size: 0.95rem;
}

.ac-date {
  color: var(--gray);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.ac-details {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--db);
  background-color: var(--lb);
  padding: 0.75rem;
  border-radius: 8px;
}

.ac-details strong {
  display: inline-block;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
  color: var(--gray);
}

.ac-actions {
  margin-top: auto;
  border-top: 1px solid var(--light-gray);
  padding-top: 1rem;
  display: flex;
  justify-content: flex-end;
}

.ac-actions .btn-secondary {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.small-tabs {
  display: flex;
  gap: 0.5rem;
  background-color: #ECECEC;
  padding: 0.25rem;
  border-radius: 8px;
}

.small-tabs .tab-btn {
  padding: 0.5rem 1.25rem;
  border-radius: 6px;
  color: var(--gray);
  font-weight: 600;
  font-size: 0.9rem;
}

.small-tabs .tab-btn.active {
  background-color: #fff;
  color: var(--db);
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}