/* ==================== Item Sheet Styles ==================== */

/* Item header with image and name */
.fvtt-mournblade.item {
  /* Background pour toute la fiche d'item */
  background: url("../assets/ui/pc_sheet_bg.webp") repeat;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0;
  margin: 0;

  /* AppV2 - Remove window content padding */
  .window-content {
    padding: 0;
    margin: 0;
  }

  /* AppV2 - Main section structure */
  section {
    background: url("../assets/ui/pc_sheet_bg.webp") repeat-y;
    color: black;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    padding: 0;
    margin: 0;
  }

  /* AppV2 Item Sheets - Disabled inputs readability */
  input:disabled,
  select:disabled {
    color: #000000;
    opacity: 0.8;
    background-color: rgba(255, 255, 255, 0.5);
  }

  /* Inputs and selects styling */
  input[type="text"],
  input[type="number"],
  select {
    color: #000000;
    background-color: rgba(255, 255, 255, 0.7);
    border: 1px solid #999999;
    margin: 0;
    padding: 2px 4px;
    font-family: "CentaurMT", serif;
    font-size: 0.85rem;
  }

  textarea {
    margin: 0;
    padding: 2px 4px;
  }

  input[type="checkbox"] {
    width: auto;
    height: auto;
    margin: 0 4px;
    align-self: center;
  }

  .header {
    flex: 0 0 auto;
    border-bottom: 1px solid #999;
    margin: 0;
  }

  .sheet-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
    background: url("../assets/ui/pc_sheet_bg.webp") repeat;
    flex: 0 0 auto;
  }

  .item-sheet-img {
    flex: 0 0 64px;
    width: 64px;
    height: 64px;
    object-fit: cover;
    border: 1px solid #999;
    border-radius: 4px;
    cursor: pointer;

    &:hover {
      box-shadow: 0 0 8px rgba(255, 102, 0, 0.8);
    }
  }

  .header-fields {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
  }

  .header-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;

    button {
      background: rgba(0, 0, 0, 0.1);
      border: 1px solid #999;
      padding: 0.25rem 0.5rem;
      cursor: pointer;
      font-family: "CentaurMT", serif;

      &:hover {
        background: rgba(255, 102, 0, 0.2);
        box-shadow: 0 0 5px rgba(255, 102, 0, 0.5);
      }
    }

  }

  .chat-card-button {
    background: linear-gradient(to bottom, #21374afc 5%, #152833ab 100%);
    border: 2px ridge #846109;
    color: #d4b5a8;
    padding: 0.3rem 0.5rem;
    transition: all 0.2s ease;
    cursor: pointer;

    i {
      font-size: 0.9rem;
    }

    &:hover {
      background: linear-gradient(to bottom, #800000 5%, #3e0101 100%);
      color: #ffffff;
      box-shadow: 0 0 8px rgba(128, 0, 0, 0.6);
    }

    &:active {
      position: relative;
      top: 1px;
    }
  }

  .sheet-header h1.charname {
    height: 50px;
    padding: 0;
    margin: 5px 0;
    border-bottom: 0;
    font-weight: bold;
    font-size: 2rem;
    font-family: "CentaurMT";
  }

  .sheet-header h1.charname input {
    width: 100%;
    height: 100%;
    margin: 0;
    font-weight: bold;
    font-family: "CentaurMT";
    font-size: 2rem;
    text-align: left;
    border: 0 none;

    &:focus {
      outline: 1px solid #ff6600;
    }
  }

  /* Tabs - Modern style matching actor sheets */
  nav.tabs {
    display: flex;
    border-bottom: 1px solid #7a7971;
    margin: 0;
    padding: 4px;
    background-color: #1c1c1c;
    flex: 0 0 auto;
  }

  nav.tabs a.item {
    padding: 6px 12px;
    color: #d4af37;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 4px 4px 0 0;
    margin-right: 4px;
    transition: all 0.2s;

    i {
      display: none; // Hide icons to match actor sheets
    }

    &:hover {
      background-color: rgba(212, 175, 55, 0.1);
    }

    &.active {
      background-color: #2a2a2a;
      border-bottom-color: #d4af37;
      color: #f5f5f5;
    }
  }

  /* Tab content */
  .tab {
    display: none;
    padding: 4px 8px;
    overflow-y: auto;
    flex: 1 1 auto;

    &.active {
      display: block;
    }
  }

  /* Item list in details tab */
  .item-list {
    list-style: none;
    margin: 0;
    padding: 0;

    li.item {
      display: flex;
      align-items: center;
      margin-bottom: 2px;
      padding: 2px 4px;
      min-height: 24px;
      border-bottom: none;

      &.flexrow {
        display: flex;
        flex-direction: row;
        align-items: flex-start;
        gap: 4px;

        input[type="checkbox"] {
          margin-top: 3px;
          flex-shrink: 0;
        }
      }

      h3 {
        color: #2a1a0a;
        font-size: 1rem;
        font-weight: bold;
        margin: 0;
        text-shadow: none;
      }
    }
  }

  /* Labels */
  .generic-label {
    display: inline-block;
    white-space: nowrap;
    font-weight: 700;
    color: #464331c4;
    font-size: 0.9rem;
    font-family: "CentaurMT", serif;
    margin: 0;
    padding: 0 4px 0 0;
  }

  /* Field labels */
  .item-field-label-short {
    flex: 0 0 60px;
    max-width: 60px;
  }

  .item-field-label-medium {
    flex: 0 0 100px;
    max-width: 100px;
  }

  .item-field-label-long {
    flex: 1;
    min-width: 150px;
  }

  .item-field-label-long1 {
    flex: 1;
    min-width: 200px;
  }

  .item-field-label-long2 {
    flex: 1;
    min-width: 250px;
    max-width: 250px;
  }
  .item-field-label-long3 {
    flex: 1;
    min-width: 250px;
    white-space: normal;
    line-height: 1.3;
  }

  .numeric-input {
    text-align: center;
    width: 60px;
  }

  /* Editor fields */
  .editor {
    height: 300px;
    border: 1px solid #999;
    background: rgba(255, 255, 255, 0.9);

    .editor-content {
      height: 100%;
      padding: 0.5rem;
      color: #000;
    }
  }
}

/* ============================================= */
/* Potion Item Sheet */
/* ============================================= */
.potion-content {
  .potion-header-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem;
    background: rgba(139, 0, 0, 0.08);
    border-radius: 4px;
    border: 1px solid rgba(139, 0, 0, 0.2);
    margin-bottom: 0.5rem;
  }

  .potion-statut-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: bold;

    &.statut-efficace { background: rgba(0,128,0,0.15); color: #155215; border: 1px solid #4a904a; }
    &.statut-heroique { background: rgba(180,120,0,0.15); color: #7a5000; border: 1px solid #c89000; }
    &.statut-inefficace { background: rgba(100,100,100,0.15); color: #555; border: 1px solid #888; }
    &.statut-poison { background: rgba(100,0,100,0.15); color: #4a004a; border: 1px solid #880088; }
    &.statut-inconnue { background: rgba(50,50,50,0.1); color: #666; border: 1px solid #aaa; }
  }
}

/* Potion in chat */
.potion-rune-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.4rem;
  background: rgba(0,0,0,0.04);
  border-radius: 4px;
  margin-bottom: 0.35rem;

  .potion-rune-name { font-weight: bold; }
  .potion-rune-seuil { font-size: 0.85rem; color: #666; }
  .potion-haut-parler { font-size: 0.85rem; color: #555; font-style: italic; }
}

.potion-result-gm {
  border: 1px dashed rgba(139,0,0,0.4);
  background: rgba(139,0,0,0.05);
  border-radius: 4px;
  padding: 0.4rem;

  .potion-result-title {
    font-size: 0.95rem;
    margin: 0 0 0.3rem;
  }
  .potion-heroique { color: #8B6900; }
  .potion-efficace { color: #155215; }
  .potion-inefficace { color: #555; }
  .potion-poison { color: #660066; }
}

.potion-result-player {
  font-style: italic;
  color: #666;
  font-size: 0.9rem;
}

/* Potion dialog */
.potion-dialog {
  .potion-dialog-section {
    margin-bottom: 0.75rem;
  }

  .potion-dialog-title {
    font-size: 0.9rem;
    font-weight: bold;
    border-bottom: 1px solid rgba(0,0,0,0.15);
    padding-bottom: 0.2rem;
    margin-bottom: 0.4rem;
  }

  .potion-runes-table {
    width: 100%;
    font-size: 0.85rem;
    border-collapse: collapse;
    margin-bottom: 0.5rem;

    th, td {
      padding: 0.2rem 0.4rem;
      border-bottom: 1px solid rgba(0,0,0,0.08);
    }

    .potion-rune-row:hover { background: rgba(0,0,0,0.04); }
    .potion-rune-radio { cursor: pointer; }

    .rune-mini-img {
      width: 20px;
      height: 20px;
      vertical-align: middle;
      margin-right: 4px;
      border-radius: 2px;
      border: 1px solid rgba(139, 69, 19, 0.5);
      object-fit: cover;
    }
  }

  .potion-summary {
    background: rgba(0,0,0,0.05);
    border-radius: 4px;
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;

    .summary-row { margin-bottom: 0.2rem; }
    .summary-label { font-weight: bold; min-width: 150px; }
  }

  .potion-info-note {
    color: #888;
    font-style: italic;
    gap: 0.4rem;
    align-items: center;
  }
}

/* Enchantement de la Loi */
.enchantement-section {
  margin-top: 0.6rem;
  padding: 0.5rem 0.6rem;
  background: rgba(255, 215, 0, 0.05);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 4px;

  .section-title-small {
    font-size: 0.9rem;
    margin: 0 0 0.4rem 0;
    color: #a07800;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
    padding-bottom: 0.2rem;
  }

  .enchant-badge {
    display: inline-block;
    background: gold;
    color: #333;
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 8px;
    margin-left: 0.5rem;
  }

  .enchant-none {
    color: #888;
    font-size: 0.85rem;
    margin: 0;
    padding: 0.2rem 0;
  }
}
