/**
 * opros.css — Стили модалки медицинского опросника
 */

/* Dialog sizing */
.opros-dialog {
  margin: .5rem auto;
  width: min(720px, calc(100% - 1rem));
  max-width: 100%;
}

.opros-content {
  height: auto !important;
  max-height: calc(100dvh - 2rem);
  display: flex;
  flex-direction: column;
  border-radius: 1rem;
  overflow: hidden;
}

/* Header */
.opros-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fff;
  border-bottom: 1px solid rgba(0,0,0,.08);
  padding: 14px 20px;
  flex-shrink: 0;
}

/* Body */
.opros-body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px;
  max-height: calc(100dvh - 2rem - 140px);
}

/* Footer */
.opros-footer {
  position: sticky;
  bottom: 0;
  z-index: 10;
  background: #fff;
  border-top: 1px solid rgba(0,0,0,.08);
  padding: 12px 20px;
  flex-shrink: 0;
}

/* Screens */
.opros-screen {
  display: none;
}
.opros-screen.is-active {
  display: block;
  animation: opros-fade-in 0.2s ease-out;
}

@keyframes opros-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Category header */
.opros-category-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: .5rem;
  color: #1a1a2e;
}

.opros-category-desc {
  font-size: .85rem;
  color: #6c757d;
  margin-bottom: 1.5rem;
}

/* Question card */
.opros-question {
  background: #f8f9fa;
  border-radius: .75rem;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid transparent;
  transition: border-color .15s, background-color .15s;
}

.opros-question:hover {
  border-color: #dee2e6;
}

.opros-question.has-risk {
  background: #fff8f0;
  border-color: #ffe0b2;
}

.opros-question.answered {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.opros-question.answered.risk-triggered {
  background: #fef2f2;
  border-color: #fecaca;
}

.opros-question-text {
  font-size: .95rem;
  font-weight: 500;
  margin-bottom: 10px;
  color: #1a1a2e;
}

.opros-question-text .required-mark {
  color: #dc3545;
  margin-left: 2px;
}

.opros-question-text .risk-badge {
  display: inline-block;
  font-size: .7rem;
  font-weight: 600;
  background: #fff3cd;
  color: #856404;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 8px;
  vertical-align: middle;
}

/* Options */
.opros-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.opros-option {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  cursor: pointer;
  font-size: .875rem;
  transition: all .15s;
  background: #fff;
  user-select: none;
}

.opros-option:hover {
  border-color: #0d6efd;
  background: #f0f7ff;
}

.opros-option input[type="radio"] {
  margin-right: 8px;
  cursor: pointer;
}

.opros-option.selected {
  border-color: #0d6efd;
  background: #e7f1ff;
  font-weight: 500;
}

.opros-option.selected.risk-option {
  border-color: #dc3545;
  background: #fef2f2;
  color: #991b1b;
}

/* Progress indicator in questions */
.opros-progress-text {
  font-size: .8rem;
  color: #6c757d;
  margin-bottom: 1rem;
}

/* Summary screen */
.opros-summary {
  background: #f8f9fa;
  border-radius: .75rem;
  padding: 20px;
}

.opros-summary-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #e9ecef;
}

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

/* Risk panel styles */
#opros-risk-panel {
  min-width: 160px;
}

/* Responsive */
@media (max-width: 576px) {
  .opros-dialog {
    margin: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
  }

  .opros-content {
    border-radius: 0;
    max-height: 100dvh;
  }

  .opros-body {
    max-height: calc(100dvh - 130px);
  }

  .opros-options {
    flex-direction: column;
  }

  .opros-option {
    width: 100%;
    justify-content: flex-start;
  }

  .opros-footer .d-flex {
    flex-direction: column-reverse;
    gap: 12px !important;
  }

  .opros-footer .d-flex > div:first-child {
    text-align: center;
  }

  .opros-footer .d-flex > div:last-child {
    display: flex;
    gap: 8px;
  }

  .opros-footer .d-flex > div:last-child .btn {
    flex: 1;
  }
}

/* Hide elements helper */
.opros-hidden {
  display: none !important;
}
