/* Risk Evaluation Guide - Specific Styles */

:root {
  --p1: #e8f5e9;
  --p2: #c8e6c9;
  --p3: #fff9c4;
  --p4: #ffe0b2;
  --p5: #ffccbc;
  --p6: #ffcdd2;

  --i1: #e1f5fe;
  --i2: #b3e5fc;
  --i3: #81d4fa;
  --i4: #4fc3f7;
  --i5: #29b6f6;
  --i6: #039be5;
  --i7: #0277bd;
}

.risk-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.risk-section {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
}

.risk-section.active {
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  transform: translateY(-2px);
}

.risk-section.completed {
  opacity: 0.8;
}

.risk-section h2 {
  margin-top: 0;
  margin-bottom: 1rem;
}

.hint {
  color: var(--color-gray-medium);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.btn-opt {
  background: var(--color-gray-light);
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  position: relative;
  display: block;
  height: auto !important;
  min-height: auto !important;
  grid-column: auto !important;
  width: 100%;
}

.btn-opt:hover {
  background: white;
  border-color: var(--color-ming-light);
  transform: translateX(4px);
}

.btn-opt.selected {
  background: white;
  border-color: var(--color-orange);
  box-shadow: 0 2px 8px rgba(241, 154, 62, 0.2);
}

.btn-opt .lbl {
  font-weight: 600;
  color: var(--color-ming-dark);
  margin-bottom: 0.25rem;
}

.btn-opt .short {
  font-size: 0.9rem;
  color: var(--color-gray-dark);
}

/* Tooltip styling for option buttons */
.btn-opt {
  position: relative;
}

.btn-opt .tooltip-text {
  visibility: hidden;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 8px;
  padding: 8px 12px;
  background-color: var(--color-gray-dark);
  color: white;
  text-align: center;
  border-radius: 6px;
  font-size: 0.85rem;
  width: 250px;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s;
}

.btn-opt:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

.btn-opt .tooltip-text::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: var(--color-gray-dark) transparent transparent transparent;
}

section + h1:first-child,
h2:first-child,
h3:first-child {
    transform: translate(0, -36px);
}

.nav {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-top: 2rem;
}

/* Override apalala button height issue */
.risk-container button {
  height: auto !important;
  grid-column: auto !important;
}

.btn {
  height: auto !important;
  min-height: 2.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  border: 1px solid var(--color-orange);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--color-orange);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  grid-column: auto !important;
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
  background: var(--color-orange);
  filter: brightness(1.1);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-ghost {
  background: white;
  color: var(--color-ming-dark);
  border: 1px solid var(--color-gray-medium);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--color-gray-light);
  color: var(--color-ming-dark);
}

.summary {
  padding: 1rem;
  background: var(--color-gray-light);
  border-radius: 8px;
  margin-top: 1rem;
}

.tag {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.9rem;
}

.tag.p1 { background: var(--p1); color: #2e7d32; }
.tag.p2 { background: var(--p2); color: #388e3c; }
.tag.p3 { background: var(--p3); color: #f57f17; }
.tag.p4 { background: var(--p4); color: #ef6c00; }
.tag.p5 { background: var(--p5); color: #d84315; }
.tag.p6 { background: var(--p6); color: #c62828; }

.tag.i1 { background: var(--i1); color: #01579b; }
.tag.i2 { background: var(--i2); color: #0277bd; }
.tag.i3 { background: var(--i3); color: #0288d1; }
.tag.i4 { background: var(--i4); color: #039be5; }
.tag.i5 { background: var(--i5); color: #0277bd; }
.tag.i6 { background: var(--i6); color: #01579b; }
.tag.i7 { background: var(--i7); color: white; }

/* Risk Matrix */
.matrix {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
}

.matrix th,
.matrix td {
  padding: 0.75rem;
  text-align: center;
  border: 1px solid var(--color-gray-medium);
  font-size: 0.85rem;
}

.matrix thead th {
  background: var(--color-ming-light);
  color: white;
  font-weight: 600;
}

.matrix tbody th {
  background: var(--color-ming-verylight);
  font-weight: 600;
}

.cell-risk {
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.cell-risk.risk-faible,
.risk-faible {
  background-color: #4caf50 !important;
  color: white;
}

.cell-risk.risk-modere,
.risk-modere {
  background-color: #ffc107 !important;
  color: var(--color-gray-dark);
}

.cell-risk.risk-eleve,
.risk-eleve {
  background-color: #ff9800 !important;
  color: white;
}

.cell-risk.risk-critique,
.risk-critique {
  background-color: #f44336 !important;
  color: white;
}

.big-risk {
  text-align: center;
  margin-top: 2rem;
  font-size: 1.5rem;
}

.big-risk span {
  padding: 1rem 2rem;
  border-radius: 12px;
  display: inline-block;
}

/* Responsive Design */
@media (min-width: 768px) {
  .risk-container {
    grid-template-columns: repeat(2, 1fr);
  }

  .risk-section.active {
    grid-column: span 2;
  }
}

@media (min-width: 1024px) {
  .risk-container {
    grid-template-columns: repeat(3, 1fr);
  }

  .risk-section.active {
    grid-column: span 3;
  }

  .options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
  }
}