/* main content boxes, fix here then reimport to index.css */
#app-content {
  display: flex;
  height: 100vh; /* Full viewport height */
}

#main-operations {
  height: 100vh;
}

.container {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.container h1 {
  margin-top: 0;
}

.main-operations-header-container {
  padding-top: 1rem;
}
/* Helper for tab switching */
.hidden-tab {
  display: none !important;
}

.mobile-header {
  display: none;
}
.main-content {
  background-color: var(--white);
  margin-left: var(--sidebar-width); /* Match sidebar width */
  width: calc(100% - var(--sidebar-width));
  box-sizing: border-box;

  /* position: relative; */
  display: flex;

  position: relative;
  z-index: 0;

  transition: margin 0.3s ease;
}

.main-content-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;

  /* padding-top: 1rem; */
  /* padding-bottom: 1rem; */
}

body.sidebar-collapsed .main-content {
  margin-left: var(--sidebar-collapsed-width);
  width: calc(100% - var(--sidebar-collapsed-width));
}
body.sidebar-hidden .main-content {
  margin-left: 0;
}

.main-operations-btn-container {
  padding: 0;
  padding-left: 0px;
  position: relative;

  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-x: hidden;
}

.info-field {
  display: flex;
  align-items: center;
}

.info-field label {
  display: flex;
  margin-bottom: 5px;
}

.info-field select {
  padding: 8px;
  box-sizing: border-box;
}

.mobile-view-controls {
  display: none;
}

/* sidebar stuff */

/* Buttons: to be moved to index.css or styles.css at a later date */
.btn-general {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  padding: 10px 1rem;
  font-size: 1rem;
  height: 44px;
  padding: 0 16px;
  gap: 8px;
  border-radius: 8px;
  width: 172px;

  cursor: pointer;
}

.btn-small {
  height: 2rem;
  width: 140px;
  font-size: 14px;
  padding: 6px 0.75rem;
}

.btn-general > i {
  position: static;
  flex-shrink: 0;
  font-size: 16px;
}

.btn-general > span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 1 auto;
}

.btn-primary {
  background-color: var(--primaryAccent);
  color: var(--primaryTextInverse);
  border: none;
}

.btn-primary:hover {
  background-color: var(--primaryAccentHover);
}
.btn-primary:active {
  background-color: var(--primaryAccentActive);
}

.btn-secondary {
  background-color: transparent;
  color: var(--primaryText);
  border: 2px solid rgb(209, 213, 219);
}
.btn-secondary:hover {
  background-color: var(--baseColorHover);
}
.btn-secondary:active {
  background-color: var(--baseColorActive);
}

.transcript-btns,
.note-tabs-generated-notes-container {
  height: 100%;
}

.btn-tab-note,
.btn-tab-transcript {
  display: flex;
  align-items: center;
  gap: 4px;
  background-color: transparent;
  border: none;
  height: 100%;
  justify-content: center;
  /* padding: 10px 24px; */
}

.btn-tab-note:hover,
.btn-tab-transcript:hover {
  background-color: var(--baseColorHover);
}
.btn-tab-note:active,
.btn-tab-transcript:active {
  background-color: var(--baseColorActive);
}

.btn-tab-note {
  min-width: 100px;
}

.btn-tab-transcript {
  min-width: 72px;
}

.btn-tab-note span,
.btn-tab-note i,
.btn-tab-transcript span,
.btn-tab-transcript i {
  font-size: 14px;
  color: var(--secondaryText);
}

/* 2. Add this NEW specific rule for the text span */
.btn-tab-note span {
  /* Layout & Sizing */
  display: -webkit-box; /* Required for clamping to work */
  max-width: 110px; /* Adjust this width to trigger wrapping earlier/later */
  line-height: 1.2; /* Keeps multi-line compact */

  /* Text Wrapping */
  white-space: normal; /* Overrides any default nowrap */
  /* word-break: break-word; */

  /* The Clamping Logic */
  -webkit-box-orient: vertical; /* Required: Defines flow direction */
  -webkit-line-clamp: 2; /* Vendor prefix: Supported by Chrome, Edge, Safari, Firefox */
  line-clamp: 2; /* Standard property: For future compatibility */

  /* Hiding the excess */
  overflow: hidden;
  text-overflow: ellipsis;

  /* Alignment */
  text-align: center; /* Looks better for multi-line tabs */
}

.btn-tab-note.active,
.btn-tab-note[data-state='active'],
.btn-tab-transcript[data-state='active'] {
  border-bottom: 2px solid var(--primaryAccent);
}

/* Add visual state indicators */
#encounterBtn[data-state='recording'] {
  background-color: var(--dangerColor);
}

#encounterBtn[data-state='paused'] {
  background-color: var(--primaryAccent);
}
#encounterBtn[data-state='paused']:hover {
  background-color: var(--primaryAccentHover);
}
#encounterBtn[data-state='paused']:active {
  background-color: var(--primaryAccentActive);
}

#encounterBtn[data-state='recording'] {
  animation: recording-pulse 2s infinite;
}

/* elements */

.integration-status-container {
  height: 24px;
}
/* Integration status badge */
.integration-badge {
  display: flex;
  justify-content: center;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  margin-left: 15px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.integration-badge.connected {
  color: var(--secondaryAccent);
}

.integration-badge i {
  font-size: 7px;
  color: var(--secondaryAccent);
}

.integration-badge.disconnected {
  color: rgba(255, 255, 255, 0.7);
}

.integration-badge.error {
  color: #ef4444;
}

.info-field input {
  /* padding: 8px; */
  box-sizing: border-box;
}

#patientName {
  width: 226px;
  border: none;
  box-sizing: border-box;
  /* margin-left: 1rem; */
  text-align: start;
  font-weight: 700;
  color: var(--black);
  font-size: 20px;
  padding: 0;
}

.encounter-date {
  font-size: 14px;
  color: var(--tertiaryText);
}

.status-container {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  margin-right: auto;
}

/* layout */

.patient-info {
  display: flex;
  flex-direction: column;
  align-items: start;

  border-bottom: 1px solid var(--grey);
  box-sizing: border-box;
  padding: 8px;
  padding-left: 24px;
  margin: 0;
  gap: 4px;
  padding-bottom: 0.75rem;
}

/* .patient-info.loaded-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--grey);
} */
.transcript-btns {
  display: flex;
  /* justify-content: space-between; */
  /* width: 100%; */
  /* max-width: calc((100vw - var(--sidebar-width)) / 2); */
}

.encounter-note-container {
  display: flex;
  flex: 1;
  min-height: 0;
}

.transcript-tabs,
.note-tabs {
  border-bottom: 1px solid var(--grey);
  background-color: var(--baseColor);
  display: flex;
  align-items: center;
  height: 56px;
  flex-shrink: 0;
}

.note-tabs {
  justify-content: flex-start;
  padding-right: 0.5rem;
  width: 100%;
  max-width: 100%;
  flex-wrap: nowrap;
}

.splash-btn {
  width: 100%;
  height: 48px;
}

/* --- STATE: EMPTY (Splash Screen) --- */

/* 1. Hide the specific controls we don't want yet (Dropdowns + Mobile Toggle) */
/* We keep .active-transcript-panel VISIBLE because the splash screen lives inside it now */
#mainOperationsContainer.state-empty .js-dropdown-container,
#mainOperationsContainer.state-empty .mobile-view-controls {
  display: none;
}

/* 2. Hide ONLY the Note Section (Right side) when empty */
/* We DO NOT hide .active-transcript-panel anymore */
#mainOperationsContainer.state-empty .note-section {
  display: none;
}

/* 2. Force the Transcript Wrapper (Left Column) to take full width */
#mainOperationsContainer.state-empty .active-transcript-panel {
  flex: 0 0 100%;
}

.active-note-panel,
.active-transcript-panel {
  display: flex;
  flex-direction: column;
}
.active-note-panel {
  flex: 1;
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 3. Ensure Splash Container is flexible and centered */
.splash-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 60vh;
  background-color: #fff;
  text-align: center;
}

/* --- Splash Content Styling --- */
.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 480px; /* Slightly wider for desktop readability */
}

.splash-icon {
  width: 80px;
  height: 80px;
  background-color: #f3f4f6;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.splash-icon i {
  font-size: 32px;
  color: #9ca3af;
}

.splash-content h3 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--black);
}

.splash-content p {
  margin: 0;
  font-size: 1rem;
  color: var(--secondaryText);
  line-height: 1.5;
  margin-bottom: 24px;
}

.splash-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 360px; /* Limit button width on desktop */
}

/* Tip Box Styling (New from screenshot) */
.splash-tip {
  margin-top: 32px;
  background-color: #eff6ff; /* Light blue background */
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 12px 16px;
  color: #1e40af;
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  max-width: 500px;
}

.splash-tip i {
  margin-top: 3px; /* Align icon with text */
}

/* NOTE Tabs */

/* Helper for Healthie links */
.healthie-link-container {
  margin-top: 10px;
  padding: 10px;
  background: #f9fafb;
  border-radius: 8px;
  font-size: 0.9em;
  color: #666;
}

/* Ensure panels are hidden unless they have the active class */
.note-content-panel {
  display: none !important;
  animation: fadeIn 0.3s ease-in-out;
}

.note-content-panel.active {
  display: flex !important;
  flex-direction: column;
  height: 100%;
  animation: fadeIn 0.3s ease-in-out;
}

.resizer {
  width: 8px;
  cursor: col-resize; /* Changes cursor to resize icon */
  user-select: none;
  background-color: transparent;
  transition: background-color 0.2s;
  height: 100%;
  border-right: 1px solid var(--grey);
  border-left: 1px solid var(--grey);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.resizer-visible {
  width: 4px;
  background-color: var(--grey);
  height: 100%;
}

.resizer:hover,
.resizing {
  background-color: #3b82f6; /* Highlight on hover/drag */
}

@media (max-width: 768px) {
  .resizer {
    display: none;
  }
  #app-content {
    height: 100svh;
    flex-direction: column;
  }
  #main-operations {
    height: 100%;
  }

  /* Main container sections */
  .container {
    width: 100% !important;
    min-width: 98% !important;
    max-width: 98% !important;
    box-sizing: border-box !important;
    padding: 0 !important;
    margin: 0 auto !important;
    overflow-x: hidden !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-bottom: 10px !important; /* matches the button margin for visual balance */
  }
  /* Main content container adjustments */
  .main-content {
    width: 100%;
    overflow-x: hidden;
    margin: 0 auto 0 auto;
    padding: 0;
    height: calc(100dvh - 60px);
    position: relative;
    padding-bottom: 10px; /* matches the button margin for visual balance */
    overflow: visible;
  }
  .mobile-header {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--baseColor);
    border-bottom: 1px solid var(--grey);
    height: 60px;
  }
  .mobile-header h1 {
    font-size: 20px;
    font-weight: 600;
  }

  /* On Desktop, we show the note section splash in active state */
  #mainOperationsContainer.state-active .note-section {
    display: none;
  }

  #mainOperationsContainer.state-active .mobile-view-controls {
    display: flex;
  }

  .encounter-note-container {
    flex-direction: column;
    flex: 1;
  }
  /* 1. Default State: Show Transcript Wrapper, Hide Note Wrapper */
  /* We use !important to override any desktop flex styles */
  .encounter-note-container .active-transcript-panel {
    display: flex;
    width: 100%;
    flex: 1;
  }

  .encounter-note-container .active-note-panel {
    display: none;
  }

  /* 2. Toggled State: Hide Transcript Wrapper, Show Note Wrapper */
  /* This activates when JS adds the 'show-note-view' class to the parent */

  .encounter-note-container.show-note-view .active-transcript-panel {
    display: none !important;
  }

  .encounter-note-container.show-note-view .active-note-panel {
    display: flex !important;
    flex-direction: column;
    width: 100%;
    flex: 1 1 auto; /* Allow it to grow and fill the remaining space */
    height: 100%;
  }

  .splash-container {
    padding: 1rem;
    padding-bottom: 0px;
    height: auto; /* Let it grow naturally on mobile */
    /* min-height: 60vh; */
  }

  .splash-content {
    gap: unset;
  }

  .splash-actions {
    max-width: 100%; /* Full width buttons on mobile */
  }
  .splash-btn {
    width: 260px;
  }

  .main-operations-btn-container,
  .main-operations-btn-container > div {
    width: 100%;
    margin: 0 auto;
    overflow-x: hidden;
  }

  .main-operations-header-container {
    display: flex;
    padding-bottom: 1rem;
    justify-content: space-between;
    padding: 1rem 24px;
  }

  .mobile-view-controls {
    display: flex;
    align-items: end;
  }

  .btn-view-note-transcript {
    height: 36px;
    width: auto;
    font-size: 14px;
  }

  .transcript-btns {
    overflow-x: auto;
  }

  .info-field {
    display: flex;
    flex-direction: column;
  }
  .info-field {
    width: 100%;
  }
  .integration-badge {
    margin-left: 0;
  }

  #patientName {
    width: 100%;
    font-size: 20px;
    height: 48px;
    border-radius: 8px;
    text-align: start;
  }

  #patientName::placeholder {
    color: #636c72;
    font-weight: 400;
  }

  /* html:not(.js) #patientName {
    width: 100% !important;
    height: 54px !important;
    min-height: 54px !important;
    margin-left: auto !important;
    margin-right: auto !important;
  } */

  .status-container {
    margin: 10px 0;
  }

  .status-container h2 {
    margin-bottom: 0;
    margin-top: 0;
    font-weight: 600;
    font-size: 1.25rem;
    margin-left: 15px;
  }

  /* Custom text container */
  .transcript-output {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  #encounterBtn,
  #uploadAudioBtnLabel {
    height: 64px;
  }

  #uploadAudioBtnLabel {
    max-width: 72px;
    min-width: 72px;
    width: 72px;
    flex: 1;
    margin: 0;
    padding: 0;
    font-size: 14px;
  }
  #uploadAudioBtnLabel > i {
    margin: 0;
    align-items: center;
    justify-content: center;
    font-size: 16px;
  }

  /* .btn-tab-note, */
  .btn-tab-transcript {
    min-width: 0px;
  }

  .btn-tab-note:hover,
  .btn-tab-transcript:hover,
  .btn-tab-note:active,
  .btn-tab-transcript:active {
    background-color: var(--baseColor);
  }

  .splash-icon {
    display: none;
  }
  .encounter-date-container {
    display: block !important;
  }
}
