/* ECHO Simulator - Complete CSS Stylesheet */

/* CSS Variables for consistent theming */
:root {
  --primary-color: #0891b2;
  --accent-color: #155e75;
  --background-color: #ffffff;
  --text-color: #334155;
  --border-color: #dbe1e8;
  --light-background: #f7f9fc;
  --error-color: #dc2626;
  --success-color: #059669;
  --warning-color: #d97706;
}

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Roboto', sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: #f8fafc;
}

/* Global logo sizing */
.logo-image {
  height: 60px;
  width: auto;
}

/* App Container - Main wrapper for both SimulationPage and HelpPage */
.app-container {
  font-family: 'Roboto', sans-serif;
  max-width: 1200px;
  width: 98%;
  margin: 30px auto;
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(21, 48, 74, 0.08);
  background-color: var(--background-color);
  display: flex;
  flex-direction: column;
  height: 98vh;
  overflow: hidden;
  min-height: 600px;
}

/* Header styles */
.header {
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border-color);
  padding: 15px 20px;
  background-color: var(--light-background);
  text-align: center;
  flex-shrink: 0;
}

.header-content {
  display: flex;
  align-items: center;
}

.icon {
  width: 32px;
  height: 32px;
  margin-right: 12px;
  color: var(--primary-color);
  flex-shrink: 0;
}

.title-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.title {
  color: var(--accent-color);
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

.subtitle {
  color: #64748b;
  margin: 4px 0 0 0;
  font-size: 12px;
  font-weight: 400;
}

/* Navigation styles */
.nav-container {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 10px 20px;
  background-color: #eef2f7;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.nav-link {
  text-decoration: none;
  color: var(--primary-color);
  font-weight: bold;
  font-size: 1.1em;
  padding: 5px 10px;
  border-radius: 8px;
  transition: background-color 0.2s;
}

.nav-link:hover {
  background-color: #d1f7f5;
}

/* Simulation Page Styles */
.simulation-container {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  overflow: hidden;
}

.main-content-wrapper {
  display: flex;
  flex-grow: 1;
  overflow: hidden;
}

.chat-and-input-container {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  width: 85%;
}

.patient-info-panel {
  width: 15%;
  background-color: #f0f4f8;
  border-left: 1px solid var(--border-color);
  padding: 20px;
  overflow-y: auto;
  flex-shrink: 0;
}

.patient-info-title {
  font-size: 1.2em;
  font-weight: bold;
  color: var(--accent-color);
  margin-bottom: 10px;
}

.patient-info-details {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.patient-info-detail {
  font-size: 0.9em;
  margin-bottom: 5px;
  color: var(--text-color);
  line-height: 1.4;
}

.patient-info-label {
  font-weight: bold;
  margin-right: 5px;
  color: #475569;
}

/* Phase indicator */
.phase-indicator {
  text-align: center;
  font-weight: bold;
  color: var(--primary-color);
  margin-bottom: 10px;
  font-size: 1.1em;
}

/* Chat window styles */
.chat-window {
  padding: 20px;
  flex-grow: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  padding: 12px 18px;
  border-radius: 20px;
  max-width: 75%;
  line-height: 1.5;
  word-break: break-word;
  font-size: 16px;
}

.message p {
  margin: 0;
  white-space: pre-wrap;
}

.patient-message {
  background-color: #eef2f7;
  color: var(--text-color);
  align-self: flex-start;
  border-bottom-left-radius: 5px;
}

.provider-message {
  background-color: var(--primary-color);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 5px;
}

.coach-message {
  background-color: #fffbeb;
  color: #b45309;
  align-self: center;
  border: 1px solid #fde68a;
  width: 90%;
  text-align: center;
  font-style: italic;
}

/* Input container */
.input-container {
  display: flex;
  padding: 15px 20px;
  border-top: 1px solid var(--border-color);
  background-color: var(--light-background);
  flex-shrink: 0;
}

.input-box {
  flex-grow: 1;
  padding: 12px 15px;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 25px;
  outline: none;
  transition: border-color 0.2s;
}

.input-box:focus {
  border-color: var(--primary-color);
}

.send-button {
  padding: 10px 20px;
  font-size: 16px;
  border: none;
  background-color: var(--primary-color);
  color: white;
  cursor: pointer;
  border-radius: 25px;
  margin-left: 10px;
  transition: background-color 0.2s;
}

.send-button:hover:not(:disabled) {
  background-color: #0891b2;
}

.send-button:disabled {
  background-color: #9ca3af;
  cursor: not-allowed;
}

/* Final score container */
.final-score-container {
  text-align: center;
  padding: 40px 20px;
  flex-shrink: 0;
}

.final-score-value {
  font-size: 52px;
  font-weight: bold;
  color: var(--primary-color);
  margin: 20px 0;
}

.overall-feedback-box {
  background-color: #eef2f7;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 15px;
  margin-top: 20px;
  margin-bottom: 20px;
  text-align: left;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--text-color);
  font-size: 0.95em;
}

/* Controls container */
.controls-container {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 10px 20px;
  background-color: var(--light-background);
  border-top: 1px solid #eef2f7;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.control-button {
  padding: 8px 16px;
  font-size: 14px;
  border: 1px solid #9ca3af;
  background-color: #f9fafb;
  color: #374151;
  cursor: pointer;
  border-radius: 20px;
  transition: background-color 0.2s;
  white-space: nowrap;
}

.control-button:hover:not(:disabled) {
  background-color: #e5e7eb;
}

.control-button:disabled {
  background-color: #f3f4f6;
  color: #9ca3af;
  cursor: not-allowed;
}

.download-button {
  margin-top: 20px;
}

.scoring-button {
  margin-left: 15px;
}

.dropdown {
  padding: 8px 16px;
  font-size: 14px;
  border: 1px solid #9ca3af;
  background-color: #f9fafb;
  color: #374151;
  border-radius: 20px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' 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 10px center;
  background-size: 16px;
  padding-right: 30px;
}

/* Compact score summary */
.compact-score-summary {
  text-align: center;
  padding: 10px 20px;
  background-color: var(--light-background);
  border-top: 1px solid var(--border-color);
  font-size: 1.1em;
  font-weight: bold;
  color: var(--accent-color);
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
}

.compact-score-category {
  font-size: 0.9em;
  color: var(--text-color);
  white-space: nowrap;
}

/* Modal styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background-color: white;
  padding: 30px;
  border-radius: 16px;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  position: relative;
}

.modal-close-button {
  position: absolute;
  top: 15px;
  right: 15px;
  background-color: transparent;
  border: none;
  font-size: 1.5em;
  cursor: pointer;
  color: #64748b;
  padding: 5px;
}

.modal-title {
  color: var(--accent-color);
  font-size: 24px;
  font-weight: 700;
  margin-top: 0;
  margin-bottom: 15px;
  text-align: center;
}

.modal-text {
  color: var(--text-color);
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 10px;
}

.modal-text-bold {
  font-weight: bold;
}

.modal-text-center {
  text-align: center;
  margin-top: 20px;
}

.modal-list {
  list-style-type: disc;
  margin-left: 20px;
  margin-bottom: 10px;
}

.modal-list-item {
  margin-bottom: 5px;
}

.modal-divider {
  border-top: 1px solid #eee;
  margin: 15px 0;
}

/* Score card styles */
.score-card-title {
  color: var(--accent-color);
  text-align: left;
  font-size: 16px;
  margin: 0 0 8px 0;
  font-weight: 700;
}

.score-category-row {
  display: flex;
  justify-content: space-between;
  margin: 2px 0;
  font-size: 14px;
}

.score-category-row-modal {
  display: flex;
  flex-direction: column;
  margin: 2px 0;
  font-size: 14px;
}

.score-category-header {
  display: flex;
  justify-content: space-between;
  width: 100%;
}

.score-category-name {
  text-transform: capitalize;
}

.phase-header {
  font-weight: bold;
  margin-top: 10px;
}

.total-score {
  font-weight: bold;
  border-top: 1px solid var(--border-color);
  padding-top: 10px;
  margin-top: 10px;
}

.justification-text {
  font-size: 0.85em;
  color: #64748b;
  font-style: italic;
  margin-top: 2px;
  margin-left: 15px;
  flex-basis: 100%;
  display: block;
  white-space: pre-wrap;
}

/* Loading and error messages */
.loading-message {
  font-style: italic;
  color: #64748b;
  text-align: center;
  padding: 20px;
}

.error-message {
  color: var(--error-color);
  text-align: center;
  margin-top: 10px;
  font-weight: bold;
}

/* Help Page Styles */
.help-container {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  padding: 20px;
  overflow-y: auto;
  background-color: #f8fafc;
  gap: 20px;
}

.help-section {
  background-color: var(--background-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 4px 12px rgba(21, 48, 74, 0.05);
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.section-title {
  font-size: 1.4em;
  font-weight: bold;
  color: var(--accent-color);
  margin-bottom: 10px;
  border-bottom: 1px solid #eef2f7;
  padding-bottom: 10px;
}

.form-label {
  font-weight: bold;
  color: var(--text-color);
  margin-bottom: 5px;
  display: block;
}

.text-area {
  width: 100%;
  padding: 12px;
  font-size: 1em;
  border: 1px solid #ccc;
  border-radius: 8px;
  min-height: 100px;
  resize: vertical;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.text-area:focus {
  border-color: var(--primary-color);
}

.submit-button {
  padding: 12px 25px;
  font-size: 1em;
  font-weight: bold;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
}

.submit-button:hover:not(:disabled) {
  background-color: #0a7a6e;
  transform: translateY(-1px);
}

.submit-button:disabled {
  background-color: #9ca3af;
  cursor: not-allowed;
}

.advice-box {
  background-color: #eef2f7;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  margin-top: 20px;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--text-color);
  font-size: 1em;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
  .app-container {
    margin: 0;
    height: auto;
    min-height: 100vh;
    border-radius: 0;
    border: none;
    width: 100%;
    max-width: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .header {
    padding: 10px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }

  .header-content {
    flex-direction: column;
  }

  .icon {
    margin-right: 0;
    margin-bottom: 5px;
  }

  .title {
    font-size: 20px;
  }

  .subtitle {
    font-size: 10px;
    text-align: center;
  }

  .nav-container {
    flex-direction: column;
    gap: 10px;
    padding: 8px 10px;
  }

  .nav-link {
    font-size: 1em;
    padding: 10px;
    text-align: center;
    border: 1px solid var(--primary-color);
  }

  .main-content-wrapper {
    flex-direction: column;
    height: auto;
    overflow-y: visible;
  }

  .chat-and-input-container {
    width: 100%;
    height: auto;
    min-height: 40vh;
    overflow-y: auto;
  }

  .patient-info-panel {
    display: none;
  }

  .phase-indicator {
    font-size: 0.9em;
  }

  .chat-window {
    padding: 10px;
  }

  .message {
    max-width: 90%;
    font-size: 14px;
  }

  .coach-message {
    width: 95%;
    padding: 8px 12px;
    font-size: 13px;