/* =====================================================
   Case of the Week – Styles (theme matches long-cases)
   ===================================================== */

:root {
  --primary:      #c54b52;
  --primary-dark: #bd4550;
  --text-dark:    #162726;
  --text-light:   #6c706f;
  --bg-light:     #f8f9fa;
  --iframe-bg:    #ececec;
  --border:       #e9ecef;
  --radius:       8px;
  --shadow:       0 4px 6px rgba(0,0,0,.1);
  --success:      #28a745;
}

* { box-sizing: border-box; }

body {
  font-family: 'Poppins', sans-serif;
  margin: 0;
  padding: 0;
  background: var(--bg-light);
  color: var(--text-dark);
  line-height: 1.6;
}

/* ── Page wrapper & heading ── */
.page-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 16px 20px !important;
  gap: 12px;
}

.cotw-heading {
  font-family: 'Poppins', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
  text-align: center;
  letter-spacing: .3px;
  line-height: 1.2;
}

/* ── Split-screen layout ── */
.case-layout {
  display: grid;
  grid-template-columns: 7fr 3fr;
  gap: 20px;
  flex: 1;
  min-height: 0;
}

.dicom-viewer {
  background: var(--iframe-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  height: 100%;
}

.dicom-viewer iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* ── Right sidebar ── */
.case-sidebar {
  background: #fff;
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}


.clinical-history {
  background: var(--bg-light);
  padding: 14px;
  border-radius: var(--radius);
  border-left: 4px solid var(--primary);
}

.clinical-history h3 {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 16px;
}

.clinical-history p {
  margin: 0;
  font-size: 14px;
  color: var(--text-dark);
}

/* ── Form ── */
.case-form {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
}

.form-group small {
  font-size: 12px;
  color: var(--text-light);
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  transition: border-color .25s;
  resize: vertical;
}

.form-control:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(197,75,82,.12);
}

.form-control.is-invalid {
  border-color: #dc3545;
}

textarea.form-control { min-height: 80px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .25s;
}

.btn-primary {
  background: var(--primary);
  color: #fff !important;
  width: 100%;
  margin-top: auto;
}

.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary {
  background: #6c757d;
  color: #fff !important;
}

.btn-secondary:hover { background: #5a6268; }

/* ── Modal overlay ── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-backdrop.active {
  display: flex;
}

.cotw-modal {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 520px;
  padding: 32px 36px 28px;
  box-shadow: 0 20px 40px rgba(0,0,0,.2);
  animation: slideUp .25s ease;
}

@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.cotw-modal-header {
  text-align: center;
  margin-bottom: 20px;
}

.cotw-modal-header h3 {
  color: var(--primary);
  margin: 8px 0 4px;
  font-size: 20px;
}

.cotw-modal-header p {
  color: var(--text-light);
  font-size: 14px;
  margin: 0;
}

.cotw-modal-body .form-group { margin-bottom: 16px; }

.cotw-modal-footer {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.cotw-modal-footer .btn { flex: 1; width: auto; margin: 0; }

.field-error {
  display: none;
  color: #dc3545;
  font-size: 12px;
  margin-top: 2px;
}

/* ── Result page ── */
.result-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 30px 20px 60px;
}

.thankyou-banner {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--primary);
  color: #fff;
  padding: 20px 28px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.thankyou-banner .fa-trophy {
  font-size: 2.4rem;
  color: #ffc107;
  flex-shrink: 0;
}

.thankyou-banner h2 {
  margin: 0 0 4px;
  font-size: 1.3rem;
}

.thankyou-banner p {
  margin: 0;
  font-size: 0.9rem;
  opacity: .9;
}

.result-card {
  background: #fff;
  padding: 30px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.result-case-title {
  margin-bottom: 24px;
}

.result-case-title h2 {
  margin: 8px 0 0;
  color: var(--text-dark);
  font-size: 1.4rem;
}

.comparison-section {
  margin-bottom: 28px;
}

.comparison-section h3 {
  font-size: 1rem;
  color: var(--primary);
  border-bottom: 2px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.answer-box h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.answer-content {
  background: var(--bg-light);
  padding: 14px;
  border-radius: var(--radius);
  min-height: 70px;
  border: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.6;
}

.answer-box.user .answer-content {
  border-left: 4px solid var(--primary);
}

.answer-box.correct .answer-content {
  border-left: 4px solid var(--success);
  background: #d4edda;
  color: #155724;
}

.nav-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.nav-buttons .btn { width: auto; }

/* ── Responsive ── */
@media (max-width: 992px) {
  .page-wrapper { height: auto; }
  .case-layout {
    grid-template-columns: 1fr;
    flex: none;
  }
  .dicom-viewer { height: 50vh; }
  .comparison-grid { grid-template-columns: 1fr; }
}

@media (max-width: 576px) {
  .cotw-modal { margin: 16px; padding: 24px 20px 20px; }
  .cotw-modal-footer { flex-direction: column-reverse; }
  .cotw-modal-footer .btn { width: 100%; }
  .nav-buttons { flex-direction: column; }
  .nav-buttons .btn { width: 100%; }
}
