/**
 * Styles pour le générateur de PNJ Traveller
 * Aligné avec les styles des dialogues /commerce et /pnj du module
 * Compatible avec Foundry VTT v13 et v14
 */

/* ==========================================================================
   Conteneur principal - Aligné sur mgt2-npc-dialog et mgt2-commerce-dialog
   ======================================================================== */

.mgt2-traveller-npc-dialog .window-header {
  background: linear-gradient(180deg, rgba(44, 44, 62, 0.96) 0%, rgba(30, 30, 43, 0.96) 100%);
  border-bottom: 1px solid #c9a227;
}

.mgt2-traveller-npc-dialog .window-title {
  color: #d9b24c;
  text-shadow: none;
}

.mgt2-traveller-npc-dialog .window-content,
#mgt2-traveller-npc .window-content {
  padding: 0;
  overflow-y: auto;
  background: #f5f0e8;
}

/* ==========================================================================
   Formulaire principal - Aligné sur mgt2-npc-form et mgt2-commerce-form
   ======================================================================== */

.mgt2-traveller-npc-form {
  display: flex;
  flex-direction: column;
  background: #f5f0e8;
  color: #222;
  min-width: 0;
}

.mgt2-traveller-npc-form h3,
.mgt2-npc-dialog .mgt2-traveller-npc-form h3 {
  margin: 0 0 12px;
  color: #5f4300 !important;
  font-size: 1em;
  font-weight: bold;
  border-bottom: 1px solid #b78f26 !important;
  padding-bottom: 5px;
  text-shadow: none !important;
}

.mgt2-traveller-npc-form h3 i {
  margin-right: 8px;
}

.mgt2-traveller-npc-form .traveller-npc-intro {
  margin: 0 0 10px;
  color: #555;
  font-size: 0.87em;
  line-height: 1.5;
}

/* ==========================================================================
   Champs de formulaire - Aligné sur mgt2-npc-form
   ======================================================================== */

.mgt2-traveller-npc-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 0;
}

.mgt2-traveller-npc-form .form-group-row {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
}

.mgt2-traveller-npc-form .form-group-row .form-group {
  flex: 1;
}

.mgt2-traveller-npc-form label {
  font-size: 0.8em;
  font-weight: bold;
  color: #444;
  display: block;
  margin-bottom: 3px;
}

.mgt2-traveller-npc-form input[type="text"],
.mgt2-traveller-npc-form select {
  width: 100%;
  box-sizing: border-box;
  padding: 5px 7px;
  font-size: 0.85em;
  background: #fff;
  color: #222;
  border: 1px solid #bbb;
  border-radius: 3px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
  height: 28px;
}

.mgt2-traveller-npc-form input[type="text"]:focus,
.mgt2-traveller-npc-form select:focus {
  border-color: #c9a227;
  outline: none;
  box-shadow: 0 0 0 2px rgba(201, 162, 39, 0.22);
}

.mgt2-traveller-npc-form select option {
  background: #fff;
  color: #222;
}

/* ==========================================================================
   Fieldset - Aligné sur mgt2-npc-form
   ======================================================================== */

.mgt2-traveller-npc-form fieldset {
  border: 1px solid #c9a227;
  border-radius: 5px;
  padding: 10px 12px 8px;
  margin: 10px 0;
  background: rgba(201, 162, 39, 0.04);
}

.mgt2-traveller-npc-dialog .mgt2-traveller-npc-form legend,
.mgt2-traveller-npc-form legend {
  color: #7a5c00 !important;
  font-size: 0.78em;
  font-weight: bold;
  padding: 0 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ==========================================================================
   Champs de nom
   ======================================================================== */

.mgt2-traveller-npc-form .name-fields {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.mgt2-traveller-npc-form .name-fields.hidden {
  display: none;
}

.mgt2-traveller-npc-form .name-fields .form-group {
  flex: 1;
}

.mgt2-traveller-npc-form .name-fields .btn-small {
  padding: 5px 10px;
  background: #2c2c3e;
  color: #e1bc57;
  border: 1px solid #c9a227;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85em;
  min-width: 36px;
  transition: background 0.2s;
}

.mgt2-traveller-npc-form .name-fields .btn-small:hover {
  background: #243852;
  color: #f2d27a;
}

/* ==========================================================================
   Checkbox
   ======================================================================== */

.mgt2-traveller-npc-form .checkbox-group {
  margin: 10px 0;
}

.mgt2-traveller-npc-form .checkbox-group label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.85em;
  color: #333;
  cursor: pointer;
}

.mgt2-traveller-npc-form .checkbox-group input[type="checkbox"] {
  accent-color: #c9a227;
  width: 14px;
  height: 14px;
  margin: 0;
}

/* ==========================================================================
   Hint
   ======================================================================== */

.mgt2-traveller-npc-form .hint {
  font-weight: normal;
  font-size: 0.85em;
  color: #777;
  margin-top: 4px;
}

/* ==========================================================================
   Required field indicator
   ======================================================================== */

.mgt2-traveller-npc-form .required {
  color: #ff6b6b;
}

/* ==========================================================================
   Pied de formulaire - Aligné sur mgt2-npc-form
   ======================================================================== */

.mgt2-traveller-npc-form .form-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

button.btn-calculate,
.mgt2-traveller-npc-form .btn-calculate {
  background: #2c2c3e;
  color: #e1bc57;
  border: 1px solid #c9a227;
  border-radius: 4px;
  padding: 7px 18px;
  font-size: 0.85em;
  font-weight: bold;
  cursor: pointer;
  text-shadow: none;
}

button.btn-calculate:hover,
.mgt2-traveller-npc-form .btn-calculate:hover {
  background: #243852;
  color: #f2d27a;
}

button.btn-calculate:disabled,
.mgt2-traveller-npc-form .btn-calculate:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.mgt2-traveller-npc-form .btn-calculate i {
  margin-right: 8px;
}

/* ==========================================================================
   Résultat - Aligné sur mgt2-npc-result
   ======================================================================== */

.mgt2-npc-result,
.traveller-npc-result {
  font-size: 0.85em;
  color: #222;
}

.traveller-npc-result .npc-header {
  text-align: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 2px solid #c9a227;
}

.traveller-npc-result .npc-header h3 {
  color: #5f4300 !important;
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 8px;
  font-size: 1em;
  text-shadow: none !important;
}

.traveller-npc-result .npc-header h3 i {
  margin-right: 8px;
}

.traveller-npc-result .npc-name {
  font-size: 1.3em;
  font-weight: bold;
  color: #222;
}

.traveller-npc-result .npc-notice {
  padding: 8px 12px;
  margin-bottom: 15px;
  border-radius: 4px;
  font-size: 0.9em;
  text-align: center;
}

.traveller-npc-result .npc-notice.success {
  background: #eef8ee;
  border: 1px solid #a9d0a9;
  color: #2a6a2a;
}

.traveller-npc-result .npc-notice.success i {
  margin-right: 8px;
}

.traveller-npc-result .npc-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px;
  margin-bottom: 15px;
}

.traveller-npc-result .npc-detail {
  background: #fbf8f1;
  padding: 6px 8px;
  border-radius: 3px;
  text-align: center;
  border: 1px solid #d7ccb0;
}

.traveller-npc-result .npc-detail-label {
  font-size: 0.75em;
  color: #7a5c00;
  margin-bottom: 3px;
  font-weight: bold;
}

.traveller-npc-result .npc-detail-value {
  font-weight: bold;
  color: #222;
  font-size: 0.9em;
}

.traveller-npc-result .npc-section {
  margin-bottom: 15px;
}

.traveller-npc-result .npc-section h4 {
  color: #5f4300 !important;
  font-size: 0.85em;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
  border-bottom: 1px solid #d7ccb0;
  padding-bottom: 5px;
}

.traveller-npc-result .npc-section h4 i {
  margin-right: 6px;
}

.traveller-npc-result .npc-characteristics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.traveller-npc-result .npc-characteristic {
  background: #fbf8f1;
  padding: 5px 8px;
  border-radius: 3px;
  min-width: 70px;
  text-align: center;
  border: 1px solid #d7ccb0;
}

.traveller-npc-result .npc-char-key {
  font-size: 0.7em;
  color: #7a5c00;
  text-transform: uppercase;
  margin-bottom: 2px;
  font-weight: bold;
}

.traveller-npc-result .npc-char-value {
  font-size: 1.1em;
  font-weight: bold;
  color: #222;
}

.traveller-npc-result .npc-char-dm {
  font-size: 0.7em;
  color: #c9a227;
  font-weight: bold;
}

.traveller-npc-result .npc-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.traveller-npc-result .npc-skill {
  background: #fbf8f1;
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 0.85em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid #d7ccb0;
}

.traveller-npc-result .npc-skill-name {
  color: #222;
}

.traveller-npc-result .npc-skill-level {
  color: #c9a227;
  font-weight: bold;
}

.traveller-npc-result .npc-footer {
  margin-top: 15px;
  padding-top: 10px;
  border-top: 1px solid #d7ccb0;
  text-align: center;
  font-size: 0.75em;
  color: #666;
}

/* ==========================================================================
   Niveaux de compétence
   ======================================================================== */

.traveller-npc-result .skillLevelSymbol {
  font-size: 0.85em;
}

/* ==========================================================================
   Onglets personnalisés pour le dialogue
   ======================================================================== */

.mgt2-traveller-npc-dialog .mgt2-traveller-npc-form .tabs {
  display: flex;
  background: #2c2c3e;
  border-bottom: 3px solid #c9a227;
  margin: 0;
  padding: 0;
}

.mgt2-traveller-npc-dialog .mgt2-traveller-npc-form .tabs .item {
  flex: 1;
  padding: 9px 8px;
  text-align: center;
  color: #d8c79a !important;
  font-size: 0.82em;
  font-weight: bold;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -3px;
  transition: color 0.18s, border-color 0.18s, background 0.18s;
  text-shadow: none !important;
}

.mgt2-traveller-npc-dialog .mgt2-traveller-npc-form .tabs .item:hover {
  color: #f3e3b1 !important;
  background: rgba(201, 162, 39, 0.16) !important;
}

.mgt2-traveller-npc-dialog .mgt2-traveller-npc-form .tabs .item.active {
  color: #d9b24c !important;
  border-bottom-color: #c9a227 !important;
  background: rgba(201, 162, 39, 0.18) !important;
}

/* ==========================================================================
   Accessibilité
   ======================================================================== */

/* Focus visible pour la navigation clavier */
.mgt2-traveller-npc-form select:focus-visible,
.mgt2-traveller-npc-form input:focus-visible,
.mgt2-traveller-npc-form button:focus-visible {
  outline: 2px solid #c9a227;
  outline-offset: 2px;
}

/* Contraste amélioré pour l'accessibilité */
@media (prefers-contrast: high) {
  .mgt2-traveller-npc-form label {
    color: #000;
  }
  
  .mgt2-traveller-npc-form input,
  .mgt2-traveller-npc-form select {
    background: #fff;
    border-width: 2px;
  }
}

/* ==========================================================================
   Design réactif
   ======================================================================== */

/* Écran large */
@media (min-width: 900px) {
  .mgt2-traveller-npc-dialog {
    min-width: 700px;
  }
  
  .mgt2-traveller-npc-form .form-group-row {
    flex-wrap: nowrap;
  }
  
  .traveller-npc-result .npc-details-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Écran moyen */
@media (max-width: 899px) {
  .mgt2-traveller-npc-dialog {
    width: 90vw;
    max-width: 700px;
  }
  
  .mgt2-traveller-npc-form {
    padding: 0 10px;
  }
  
  .traveller-npc-result .npc-details-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile */
@media (max-width: 600px) {
  .mgt2-traveller-npc-dialog {
    width: 95vw;
  }
  
  .mgt2-traveller-npc-form .form-group-row {
    flex-direction: column;
    gap: 8px;
  }
  
  .mgt2-traveller-npc-form .name-fields {
    flex-direction: column;
    gap: 8px;
  }
  
  .traveller-npc-result .npc-characteristics {
    flex-direction: column;
    align-items: center;
  }
  
  .traveller-npc-result .npc-characteristic {
    min-width: 100px;
  }
  
  .traveller-npc-result .npc-skills {
    flex-direction: column;
    align-items: center;
  }
}

/* Très petit écran */
@media (max-width: 400px) {
  .mgt2-traveller-npc-form .btn-calculate {
    width: 100%;
    min-width: auto;
  }
  
  .traveller-npc-result .npc-details-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Impression
   ======================================================================== */

@media print {
  .mgt2-traveller-npc-dialog .window-header,
  .mgt2-traveller-npc-dialog .window-content {
    background: white;
    color: black;
  }
  
  .mgt2-traveller-npc-form {
    color: black;
    background: white;
  }
  
  .mgt2-traveller-npc-form input,
  .mgt2-traveller-npc-form select {
    background: white;
    color: black;
    border: 1px solid #ccc;
  }
  
  .traveller-npc-result {
    background: white;
    color: black;
    border: 1px solid #ccc;
    page-break-inside: avoid;
  }
  
  .traveller-npc-result .npc-detail,
  .traveller-npc-result .npc-characteristic,
  .traveller-npc-result .npc-skill {
    background: #f9f9f9;
    border-color: #ccc;
    color: black;
  }
}
