/* ----------------------------------------- */
/*  Post Item Chat Card                      */
/* ----------------------------------------- */

.bol-post-item {
  color: #191813;

  .bpi-header {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
    padding-bottom: 6px;
    border-bottom: 2px solid #8b7355;
    margin-bottom: 8px;

    .bpi-img {
      width: 52px;
      height: 52px;
      border: 1px outset lightgray;
      box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.5);
      object-fit: cover;
      flex: 0 0 52px;
    }

    .bpi-title-block {
      flex: 1;

      .bpi-name {
        margin: 0 0 2px 0;
        font-family: "Wolfsbane2Expanded", cursive;
        font-size: 1.1em;
        color: #4b4a44;
        line-height: 1.2;
        border: none;
      }

      .bpi-type {
        font-family: "IMFellDWPicaSC-Regular", serif;
        font-size: 0.8em;
        color: #7a7060;
        font-style: italic;
      }
    }
  }

  .bpi-stats-row {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 3px 12px;
    margin: 4px 0;
    padding: 4px 6px;
    background: rgba(139, 115, 85, 0.08);
    border: 1px solid rgba(139, 115, 85, 0.25);
    border-radius: 3px;

    .bpi-stat {
      display: flex;
      flex-direction: row;
      align-items: baseline;
      gap: 4px;

      .bpi-sl {
        font-family: "IMFellDWPicaSC-Regular", serif;
        font-size: 0.72em;
        color: #7a7060;
        font-style: italic;
      }

      .bpi-sv {
        font-weight: bold;
        font-size: 0.88em;
        color: #191813;
      }
    }
  }

  .bpi-tags {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 3px;
    margin: 3px 0;

    .bpi-tag {
      padding: 1px 7px;
      border: 1px solid #8b7355;
      border-radius: 10px;
      font-size: 0.7em;
      color: #4b4a44;
      background: rgba(139, 115, 85, 0.12);
      font-family: "IMFellDWPicaSC-Regular", serif;
    }

    .bpi-tag-magic {
      border-color: #6a4a9c;
      color: #5a3a8c;
      background: rgba(106, 74, 156, 0.1);
    }

    .bpi-tag-bonus {
      border-color: #2d7a2d;
      color: #1a5a1a;
      background: rgba(45, 122, 45, 0.1);
    }

    .bpi-tag-malus {
      border-color: #8b2020;
      color: #6a1a1a;
      background: rgba(139, 32, 32, 0.1);
    }
  }

  .bpi-conditions {
    margin: 3px 0;

    .bpi-cond-label {
      font-family: "IMFellDWPicaSC-Regular", serif;
      font-size: 0.75em;
      font-style: italic;
      color: #7a7060;
    }

    .bpi-condition {
      display: inline-block;
      margin: 1px 2px;
      padding: 1px 6px;
      border-radius: 3px;
      font-size: 0.8em;
    }

    .bpi-cond-req {
      border: 1px solid #8b2020;
      background: rgba(139, 32, 32, 0.08);
      color: #6a1a1a;
    }

    .bpi-cond-opt {
      border: 1px solid #6a7a30;
      background: rgba(106, 122, 48, 0.08);
      color: #4a5a20;
    }
  }

  .bpi-description {
    margin-top: 7px;
    padding-top: 6px;
    border-top: 1px dashed #c4a882;

    .bpi-desc-content {
      font-size: 0.85em;
      color: #191813;
      line-height: 1.45;

      p {
        margin: 0 0 4px 0;
      }
    }
  }
}

/* ----------------------------------------- */
/*  Chat Messages                            */
/* ----------------------------------------- */

.message-header {
  h2.damage {
    color: orangered;
    font-weight: bold;
  }

  h2.critical {
    font-family: "Wolfsbane2Expanded", cursive;
    color: #1a7a1a;
    font-weight: bold;
    font-size: 1.1rem;
    text-shadow: 0 1px 2px rgba(0,0,0,0.15);
  }

  h2.fumble {
    font-family: "Wolfsbane2Expanded", cursive;
    color: #8b0000;
    font-weight: bold;
    font-size: 1.1rem;
    text-shadow: 0 1px 2px rgba(0,0,0,0.15);
  }

  h2.success {
    font-family: "Wolfsbane2Expanded", cursive;
    color: #1a5c1a;
    font-weight: bold;
    font-size: 1.05rem;
  }

  h2.failure {
    font-family: "Wolfsbane2Expanded", cursive;
    color: darkred;
    font-weight: bold;
    font-size: 1.05rem;
  }

  h2.roll {
    color: darkslategrey;
    font-weight: bold;
  }
}

h2.good {
  color: darkgreen;
  font-weight: bold;
}

h2.bad {
  color: darkred;
  font-weight: bold;
}

.chat-message {
  margin: 3px;
  padding: 6px 8px;
  font-size: 13px;
  border-radius: 3px;
  background-color: #faf7f2;
  border: 1px solid #d4c8b0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);

  .message-header {
    .flavor-text {
      font-family: "IMFellDWPicaSC-Regular", serif;
      font-size: 14px;

      h2 {
        font-family: "Wolfsbane2Expanded", cursive;
        font-size: 1.1rem;
        margin: 2px 0;
      }
    }
  }

  // Status banner (success/failure h2)
  h2.success, h2.failure, h2.critical, h2.fumble {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 4px;
    margin: 0 0 6px 0;
    font-size: 1rem;
    letter-spacing: 0.5px;

    i { font-size: 0.9em; }
  }

  h2.success, h2.critical {
    background: linear-gradient(135deg, #1a5c1a20, #2d7a2d15);
    border: 1px solid #4caf5040;
    color: #1a5c1a;
  }

  h2.critical {
    background: linear-gradient(135deg, #1a5c1a30, #2d7a2d25);
    border-color: #4caf5070;
  }

  h2.failure {
    background: linear-gradient(135deg, #7a000015, #8b000010);
    border: 1px solid #8b000030;
    color: #8b0000;
  }

  h2.fumble {
    background: linear-gradient(135deg, #7a000025, #8b000020);
    border: 1px solid #8b000060;
    color: #6b0000;
  }

  h3 {
    font-family: "Wolfsbane2Expanded", cursive;
    font-size: 0.95rem;
    color: #191813;
    margin: 2px 0 5px 0;
    border-bottom: 1px solid #d4c8b0;
    padding-bottom: 3px;
    letter-spacing: 0.3px;
  }

  .chat-icon {
    float: right;
    border: 1px solid #c4a882;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.25);
    border-radius: 3px;
    margin: 0 0 4px 6px;
    width: 52px;
    height: 52px;
    object-fit: cover;
  }

  .actions-section {
    font-size: 0.82rem;
    color: #4b4a44;
    line-height: 1.4;

    & > div {
      margin: 2px 0;
    }
  }

  .chat-button,
  .chat-damage-roll,
  .chat-damage-apply,
  .damage-handling,
  .recup-vitalite {
    display: block;
    width: 100%;
    margin: 3px 0;
    padding: 4px 10px;
    background: linear-gradient(135deg, #2a2a2a, #4b4a44);
    color: #e8e0d0;
    border: 1px solid #2a2a2a;
    border-radius: 4px;
    font-family: "Wolfsbane2Expanded", cursive;
    font-size: 0.82rem;
    letter-spacing: 0.4px;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s;

    &:hover { background: linear-gradient(135deg, #3a3a3a, #5b5a54); }

    &.hero-reroll {
      background: linear-gradient(135deg, #7a5500, #a07000);
      border-color: #6a4500;
      &:hover { background: linear-gradient(135deg, #9a6500, #c08000); }
    }

    &.transform-heroic-roll, &.transform-legendary-roll {
      background: linear-gradient(135deg, #7a0000, darkred);
      border-color: #6b0000;
      &:hover { background: linear-gradient(135deg, #9b0000, #c00000); }
    }
  }

  // Dommages normaux
  .chat-damage-roll[data-damage-mode="normal-damage"] {
    background: linear-gradient(135deg, #7a0000, darkred);
    border-color: #6b0000;
    &:hover { background: linear-gradient(135deg, #9b0000, #c00000); }
  }

  // Dommages +6 / +12 (critique)
  .chat-damage-roll[data-damage-mode^="damage-plus"] {
    background: linear-gradient(135deg, #5a0070, #7a00a0);
    border-color: #4a0060;
    &:hover { background: linear-gradient(135deg, #7a0090, #9a00c0); }
  }

  // Appliquer dommages
  .chat-damage-apply {
    background: linear-gradient(135deg, #7a0000, darkred);
    border-color: #6b0000;
    &:hover { background: linear-gradient(135deg, #9b0000, #c00000); }
  }

  // Récupération
  .recup-vitalite {
    background: linear-gradient(135deg, #1a5c1a, #2d7a2d);
    border-color: #1a4a1a;
    &:hover { background: linear-gradient(135deg, #2a7a2a, #3d9a3d); }
  }

  // Défense/gestion dommages
  .damage-handling {
    background: linear-gradient(135deg, #7a5500, #a07000);
    border-color: #6a4500;
    &:hover { background: linear-gradient(135deg, #9a6500, #c08000); }

    &[data-defense-mode="damage-not-applied"] {
      background: linear-gradient(135deg, #1a5c1a, #2d7a2d);
      border-color: #1a4a1a;
      &:hover { background: linear-gradient(135deg, #2a7a2a, #3d9a3d); }
    }

    &[data-defense-mode="hero-in-extremis"], &[data-defense-mode="hero-reduce-damage"] {
      background: linear-gradient(135deg, #7a0000, darkred);
      border-color: #6b0000;
      &:hover { background: linear-gradient(135deg, #9b0000, #c00000); }
    }
  }

// Damage & defense cards
  .bol-damage-card, .bol-defense-card {
    .damage-card-header, .defense-card-header {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 6px;
      padding-bottom: 5px;
      border-bottom: 1px solid #d4c8b0;

      .damage-weapon-img {
        width: 44px;
        height: 44px;
        border: 1px solid #c4a882;
        border-radius: 3px;
        box-shadow: 1px 1px 3px rgba(0,0,0,0.25);
        object-fit: cover;
        flex: 0 0 44px;
      }

      .damage-card-title {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 2px;

        .damage-card-label {
          font-family: "Wolfsbane2Expanded", cursive;
          font-size: 0.75rem;
          color: #7a0000;
          letter-spacing: 0.5px;
          text-transform: uppercase;
        }

        .damage-weapon-name {
          font-family: "Wolfsbane2Expanded", cursive;
          font-size: 0.9rem;
          color: #191813;
          letter-spacing: 0.3px;
        }

        .damage-formula {
          font-size: 0.78rem;
          color: #6b6b5a;
          font-style: italic;
        }

        .damage-total-badge {
          display: inline-block;
          background: linear-gradient(135deg, #7a0000, darkred);
          color: #e8d890;
          font-family: "Wolfsbane2Expanded", cursive;
          font-size: 1.2rem;
          font-weight: bold;
          padding: 1px 10px;
          border-radius: 4px;
          letter-spacing: 1px;
          align-self: flex-start;

          &.damage-total-badge--hit {
            background: linear-gradient(135deg, #7a5500, #a07000);
          }
        }
      }
    }

    .damage-target {
      font-size: 0.8rem;
      color: #4b4a44;
      font-style: italic;
      margin-bottom: 4px;
    }

    .damage-target-select-label {
      font-size: 0.78rem;
      color: #7a0000;
      font-family: "Wolfsbane2Expanded", cursive;
      letter-spacing: 0.4px;
      margin-bottom: 4px;
    }

    .chat-target-select {
      display: flex;
      align-items: center;
      gap: 6px;
      width: 100%;
      margin-bottom: 2px;
      padding: 3px 8px;
      background: linear-gradient(135deg, #f5f0e8, #ede4d4);
      border: 1px solid #c4a882;
      border-radius: 4px;
      color: #191813;
      font-size: 0.85rem;
      cursor: pointer;
      text-align: left;

      &:hover {
        background: linear-gradient(135deg, #7a0000, darkred);
        color: #e8d890;
        border-color: #7a0000;

        .damage-target-icon { border-color: #e8d890; }
      }

      .damage-target-icon {
        width: 24px;
        height: 24px;
        border-radius: 3px;
        border: 1px solid #c4a882;
        object-fit: cover;
        flex: 0 0 24px;
      }
    }

    .damage-note {
      font-size: 0.78rem;
      color: #4b4a44;
      padding: 2px 6px;
      margin-bottom: 4px;
      border-left: 2px solid #c4a882;

      &.damage-note--warn {
        border-left-color: darkred;
        color: darkred;
      }
    }

    .defense-hero-separator {
      text-align: center;
      font-size: 0.72rem;
      color: #8b7355;
      font-family: "IMFellDWPicaSC-Regular", serif;
      font-style: italic;
      margin: 3px 0 1px;
    }

    .defense-footer-note {
      font-size: 0.72rem;
      color: #8b7355;
      font-style: italic;
      text-align: center;
      margin-top: 4px;
      padding-top: 3px;
      border-top: 1px dashed #d4c8b0;
    }
  }

  .bol-defense-summary-card {
    .defense-summary-header {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 6px;
      padding-bottom: 5px;
      border-bottom: 1px solid #d4c8b0;

      .damage-weapon-img {
        width: 44px;
        height: 44px;
        border: 1px solid #c4a882;
        border-radius: 3px;
        box-shadow: 1px 1px 3px rgba(0,0,0,0.25);
        object-fit: cover;
        flex: 0 0 44px;
      }
    }

    .defense-summary-details {
      display: flex;
      flex-direction: column;
      gap: 3px;
    }

    .defense-detail {
      font-size: 0.82rem;
      color: #4b4a44;
      padding: 1px 4px;
      border-left: 2px solid #c4a882;

      &.warning {
        border-left-color: darkred;
        color: darkred;
      }
    }

    .defense-final {
      margin-top: 5px;
      padding: 3px 8px;
      font-family: "Wolfsbane2Expanded", cursive;
      font-size: 0.9rem;
      color: #191813;
      background: #f0ece0;
      border-radius: 3px;
      border-left: 3px solid darkred;

      &.defense-final--safe {
        border-left-color: #4a7a4a;
        color: #2a5a2a;
        background: #e8f5e8;
      }
    }

    .damage-total-badge--none {
      background: linear-gradient(135deg, #4a7a4a, #2d5a2d) !important;
    }
  }

  // Vitality / death card
  .bol-vitality-card {
    .vitality-card-header {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 6px;
      padding-bottom: 5px;
      border-bottom: 2px solid #4b1010;

      .damage-weapon-img {
        width: 44px;
        height: 44px;
        border: 1px solid #c4a882;
        border-radius: 3px;
        box-shadow: 1px 1px 3px rgba(0,0,0,0.25);
        object-fit: cover;
        flex: 0 0 44px;
      }
    }

    .vitality-card-body {
      display: flex;
      flex-direction: column;
      gap: 3px;
    }

    .vitality-detail {
      font-size: 0.82rem;
      color: #4b4a44;
      padding: 1px 4px;
      border-left: 2px solid #c4a882;
    }

    .vitality-hint {
      font-size: 0.78rem;
      color: #6b6b5a;
      font-style: italic;
      padding-left: 6px;
    }

    .vitality-dead {
      margin-top: 4px;
      padding: 3px 8px;
      font-family: "Wolfsbane2Expanded", cursive;
      font-size: 0.9rem;
      color: #f0e8d0;
      background: linear-gradient(135deg, #4b1010, #7a0000);
      border-radius: 3px;
    }

    .vitality-epitaph {
      font-size: 0.78rem;
      color: #6b6b5a;
      font-style: italic;
      text-align: center;
      margin-top: 3px;
    }
  }

  // Spell card
  .bol-spell-card {
    margin: 6px 0;
    .spell-card-header {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 5px 0;
      border-bottom: 1px solid #d4c8b0;
      .spell-img {
        width: 40px; height: 40px;
        border: 1px solid #c4a882;
        border-radius: 3px;
        object-fit: cover;
        flex: 0 0 40px;
      }
      .spell-card-title {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 3px;
        .spell-name {
          font-family: "Wolfsbane2Expanded", cursive;
          font-size: 0.9rem;
          color: #191813;
        }
        .spell-stats {
          display: flex;
          flex-wrap: wrap;
          gap: 4px;
          .spell-stat-badge {
            display: inline-block;
            font-family: "Wolfsbane2Expanded", cursive;
            font-size: 0.72rem;
            padding: 1px 7px;
            border-radius: 3px;
            letter-spacing: 0.3px;
            &.cost {
              background: linear-gradient(135deg, #3a0080, #6a00c0);
              color: #e8d0ff;
              border: 1px solid #5a00a0;
            }
            &.remaining {
              background: linear-gradient(135deg, #1a4a6a, #2a6a9a);
              color: #d0e8ff;
              border: 1px solid #1a3a5a;
            }
          }
        }
      }
    }
  }

  // Alchemy card
  .bol-alchemy-card {
    margin: 6px 0;
    .alchemy-card-header {
      display: flex;
      align-items: center;
      gap: 8px;
      padding-bottom: 5px;
      border-bottom: 1px solid #d4c8b0;
      .alchemy-img {
        width: 40px; height: 40px;
        border: 1px solid #c4a882;
        border-radius: 3px;
        object-fit: cover;
        flex: 0 0 40px;
      }
      .alchemy-card-title {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 3px;
        .alchemy-name {
          font-family: "Wolfsbane2Expanded", cursive;
          font-size: 0.9rem;
          color: #191813;
        }
        .alchemy-stat-badge {
          display: inline-block;
          font-family: "Wolfsbane2Expanded", cursive;
          font-size: 0.72rem;
          padding: 1px 7px;
          border-radius: 3px;
          background: linear-gradient(135deg, #5a3a00, #8a6000);
          color: #ffe0a0;
          border: 1px solid #4a3000;
        }
      }
    }
    .alchemy-result {
      font-size: 0.78rem;
      font-style: italic;
      padding: 4px 6px;
      margin-top: 5px;
      border-radius: 3px;
      line-height: 1.4;
      &.success {
        color: #1a4a1a;
        background: #e8f5e8;
        border: 1px solid #a0d0a0;
      }
      &.failure {
        color: #4a1a1a;
        background: #f5e8e8;
        border: 1px solid #d0a0a0;
      }
    }
  }

  // Horoscope card
  .bol-horoscope-card {
    margin: 6px 0;
    .horoscope-card-header {
      display: flex;
      align-items: center;
      gap: 8px;
      padding-bottom: 5px;
      border-bottom: 1px solid #d4c8b0;
      .horoscope-icon {
        font-size: 1.6rem;
        color: #8a6500;
        flex: 0 0 auto;
      }
      .horoscope-card-title {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 3px;
        .horoscope-type {
          font-family: "Wolfsbane2Expanded", cursive;
          font-size: 0.9rem;
          color: #191813;
        }
        .horoscope-stat-badge {
          display: inline-block;
          font-family: "Wolfsbane2Expanded", cursive;
          font-size: 0.72rem;
          padding: 1px 7px;
          border-radius: 3px;
          background: linear-gradient(135deg, #6a5500, #a08000);
          color: #ffe890;
          border: 1px solid #5a4500;
        }
      }
    }
    .horoscope-result {
      .horoscope-text {
        display: block;
        font-size: 0.78rem;
        font-style: italic;
        padding: 4px 6px;
        margin-top: 5px;
        border-radius: 3px;
        line-height: 1.4;
        &.success {
          color: #1a4a1a;
          background: #e8f5e8;
          border: 1px solid #a0d0a0;
        }
        &.failure {
          color: #4a1a1a;
          background: #f5e8e8;
          border: 1px solid #d0a0a0;
        }
      }
    }
  }

  .message-content {
    .dice-roll {
      .dice-result {
        .dice-formula {
          border-radius: 4px;
          border: 1px solid #555;
          background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
          color: #d0c8b8;
          font-size: 0.8rem;
          padding: 2px 8px;
          text-align: center;
          margin-bottom: 3px;
        }

        .dice-tooltip {
          background: #1a1a1a;
          border: 1px solid #444;
          border-radius: 4px;

          .tooltip-part {
            .part-total {
              border-radius: 0;
              border: 1px inset #444;
              background-color: #2a2a2a;
              color: #d0c8b8;
            }
          }
        }

        .dice-total {
          border-radius: 4px;
          border: 2px solid #4b4a44;
          background: linear-gradient(135deg, #191813, #2a2a2a);
          color: #e8d890;
          font-family: "Wolfsbane2Expanded", cursive;
          font-size: 1.4rem;
          font-weight: bold;
          letter-spacing: 1px;
          padding: 2px 0;
          margin-top: 3px;
        }
      }
    }
  }
}

.bol-welcome-card {
  .welcome-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 2px solid darkred;

    .welcome-logo {
      width: 52px;
      height: 52px;
      object-fit: contain;
      flex: 0 0 52px;
    }
  }

  .welcome-body {
    font-size: 0.82rem;
    color: #191813;
    line-height: 1.4;

    p {
      margin: 4px 0;
      padding-left: 4px;
      border-left: 2px solid #d4c8b0;
    }

    a { color: darkred; }
  }

  .welcome-footer {
    margin-top: 8px;
    padding: 4px 10px;
    font-family: "Wolfsbane2Expanded", cursive;
    font-size: 0.95rem;
    color: #e8d890;
    background: linear-gradient(135deg, #7a0000, darkred);
    border-radius: 4px;
    letter-spacing: 0.5px;
  }

  .welcome-warning {
    margin-top: 6px;
    padding: 4px 8px;
    font-size: 0.8rem;
    color: #7a0000;
    background: #fff3f3;
    border: 1px solid #e57373;
    border-radius: 3px;
  }
}
