/* ==========================================================================
   O07 : CODEX PHARMACEUTICUS (ANSM)
   Prefixe : opharma-
   ========================================================================== */

/* ---------- MISE EN PAGE GLOBALE ---------- */

.opharma-screen {
  display: flex;
  gap: 0;
  align-items: flex-start;
  background: #FFFFFF;
  border: 1px solid #E4E6E2;
  border-radius: 12px;
  overflow: hidden;
  opacity: 0;
  animation: opharma-fade-in 320ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ---------- PANNEAU GAUCHE ---------- */

.opharma-left {
  width: 300px;
  flex-shrink: 0;
  border-right: 1px solid #E4E6E2;
  display: flex;
  flex-direction: column;
  background: #FAFAFA;
}

.opharma-search-area {
  padding: 16px 14px 12px;
  border-bottom: 1px solid #E4E6E2;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #FFFFFF;
}

.opharma-search-wrap {
  position: relative;
}

.opharma-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #9CA09A;
  pointer-events: none;
  display: flex;
  align-items: center;
}

.opharma-search-input {
  width: 100%;
  height: 36px;
  padding: 0 10px 0 34px;
  background: #F8F9FA;
  border: 1px solid #E4E6E2;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  color: #3A3E38;
  box-sizing: border-box;
  transition: all 150ms ease;
}

.opharma-search-input::placeholder {
  color: #9CA09A;
}

.opharma-search-input:focus {
  background: #FFFFFF;
  border-color: #2D8A6B;
  outline: none;
  box-shadow: 0 0 0 3px #E3F5EF;
}

.opharma-filters {
  display: flex;
  gap: 6px;
}

.opharma-select {
  flex: 1;
  height: 32px;
  padding: 0 8px;
  border: 1px solid #E4E6E2;
  border-radius: 7px;
  font-size: 11px;
  font-family: inherit;
  color: #64695F;
  background: #F8F9FA;
  cursor: pointer;
  transition: border-color 150ms ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%239CA09A' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 7px center;
  padding-right: 22px;
}

.opharma-select:focus {
  border-color: #2D8A6B;
  outline: none;
}

.opharma-results-count {
  font-size: 10px;
  color: #9CA09A;
  font-weight: 500;
  padding: 0 2px;
  letter-spacing: 0.3px;
}

/* Liste des medicaments */

.opharma-list {
  flex: 1;
  overflow-y: auto;
  max-height: 500px;
  padding: 6px 0;
}

.opharma-list::-webkit-scrollbar {
  width: 4px;
}

.opharma-list::-webkit-scrollbar-track {
  background: transparent;
}

.opharma-list::-webkit-scrollbar-thumb {
  background: #E4E6E2;
  border-radius: 2px;
}

.opharma-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 120ms ease;
  border-left: 3px solid transparent;
  opacity: 0;
  animation: opharma-fade-in 350ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.opharma-list-item:hover {
  background: #F2F3F5;
}

.opharma-list-item.is-selected {
  background: #E8F5F1;
  border-left-color: #2D8A6B;
}

.opharma-list-item__main {
  flex: 1;
  min-width: 0;
}

.opharma-list-item__name {
  font-size: 12px;
  font-weight: 600;
  color: #3A3E38;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.opharma-list-item.is-selected .opharma-list-item__name {
  color: #1A6E54;
}

.opharma-list-item__dci {
  font-size: 10px;
  color: #9CA09A;
  font-weight: 500;
  margin-top: 2px;
  font-style: italic;
}

.opharma-list-item__badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.opharma-list-empty {
  padding: 32px 20px;
  text-align: center;
  color: #9CA09A;
  font-size: 13px;
}

/* ---------- PANNEAU DROIT (DETAIL) ---------- */

.opharma-right {
  flex: 1;
  min-width: 0;
  min-height: 560px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.opharma-detail {
  padding: 24px 28px;
  flex: 1;
}

.opharma-detail.is-entering {
  animation: opharma-detail-in 280ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* En-tete detail */

.opharma-detail__header {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #F2F2F2;
}

.opharma-detail__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.opharma-detail__title {
  font-family: 'Prompt', sans-serif;
  font-size: 20px;
  font-weight: 600;
  color: #3A3E38;
  line-height: 1.25;
  margin: 0;
}

.opharma-detail__action {
  flex-shrink: 0;
}

.opharma-detail__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.opharma-code-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  letter-spacing: 0.3px;
  background: #E3F5EF;
  color: #1A6E54;
}

.opharma-code-badge__label {
  font-family: inherit;
  font-size: 9px;
  font-weight: 600;
  opacity: 0.75;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.opharma-cat-badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.opharma-voie-badge {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  background: #F2F3F5;
  color: #64695F;
}

.opharma-featured-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  background: #E3F5EF;
  color: #2D8A6B;
  border: 1px solid #2D8A6B;
}

/* Description */

.opharma-detail__desc {
  font-size: 13px;
  color: #64695F;
  line-height: 1.6;
  margin-bottom: 0;
}

/* Sections */

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

.opharma-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.opharma-section--full {
  grid-column: 1 / -1;
}

.opharma-section__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #9CA09A;
  padding-bottom: 6px;
  border-bottom: 1px solid #F2F2F2;
}

.opharma-section__icon {
  color: currentColor;
  display: flex;
  align-items: center;
}

/* Contre-indications (chips) */

.opharma-ci-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.opharma-ci-chip {
  padding: 4px 10px;
  background: #FBE9E1;
  color: #BB3A0A;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  opacity: 0;
  animation: opharma-fade-in 350ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Items numerotes */

.opharma-item-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.opharma-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  opacity: 0;
  animation: opharma-fade-in 350ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.opharma-item__num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #E3F5EF;
  color: #2D8A6B;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.opharma-item__body {
  flex: 1;
  min-width: 0;
}

.opharma-item__label {
  font-size: 12px;
  font-weight: 600;
  color: #3A3E38;
  line-height: 1.35;
}

.opharma-item__note {
  font-size: 11px;
  color: #9CA09A;
  margin-top: 2px;
  line-height: 1.4;
}

/* Grossesse / Allaitement */

.opharma-ga-row {
  display: flex;
  gap: 10px;
}

.opharma-ga-box {
  flex: 1;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #F2F2F2;
  background: #FAFAFA;
  opacity: 0;
  animation: opharma-fade-in 350ms cubic-bezier(0.16, 1, 0.3, 1) 100ms forwards;
}

.opharma-ga-box__label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #9CA09A;
  margin-bottom: 4px;
}

.opharma-ga-box__text {
  font-size: 12px;
  color: #3A3E38;
  line-height: 1.4;
}

/* Placeholder si pas de detail */

.opharma-no-detail {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 300px;
  gap: 12px;
  color: #9CA09A;
}

.opharma-no-detail__icon {
  width: 48px;
  height: 48px;
  background: #F2F2F2;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9CA09A;
}

.opharma-no-detail__text {
  font-size: 13px;
  text-align: center;
  line-height: 1.5;
}

/* ---------- ANIMATIONS ---------- */

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

@keyframes opharma-detail-in {
  from { opacity: 0; transform: translateX(8px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ---------- TABLETTE (defaut) ---------- */

.frame--tablet .opharma-left {
  width: 240px;
}

.frame--tablet .opharma-detail {
  padding: 18px 20px;
}

.frame--tablet .opharma-detail__title {
  font-size: 17px;
}

.frame--tablet .opharma-sections {
  grid-template-columns: 1fr;
}

.frame--tablet .opharma-section--full {
  grid-column: 1;
}

.frame--tablet .opharma-list {
  max-height: 600px;
}
