/* Variáveis CSS */
:root {
  --primary-color: #722e2e;
  --secondary-color: #a05427;
  --accent-color: #c9a959;
  --background-color: #f5e9d7;
  --text-color: #42210b;
  --border-color: #8c6239;
  --white: #ffffff;
  --gray-light: #e5e5e5;
  --gray: #777777;
  --success: #2e7253;
  --danger: #8b3030;
  --font-header: 'Cinzel', serif;
  --font-body: 'Roboto', sans-serif;
}

/* Importação de fontes */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700&family=Roboto:wght@300;400;700&display=swap');

/* Reset e estilos globais */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
  background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAMAAAAp4XiDAAAAUVBMVEWFhYWDg4N3d3dtbW17e3t1dXWBgYGHh4d5eXlzc3OLi4ubm5uVlZWPj4+NjY19fX2JiYl/f39ra2uRkZGZmZlpaWmXl5dvb29xcXGTk5NnZ2c8TV1mAAAAG3RSTlNAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEAvEOwtAAAFVklEQVR4XpWWB67c2BUFb3g557T/hRo9/WUMZHlgr4Bg8Z4qQgQJlHI4A8SzFVrapvmTF9O7dmYRFZ60YiBhJRCgh1FYhiLAmdvX0CzTOpNE77ME0Zty/nWWzchDtiqrmQDeuv3powQ5ta2eN0FY0InkqDD73lT9c9lEzwUNqgFHs9VQce3TVClFCQrSTfOiYkVJQBmpbq2L6iZavPnAPcoU0dSw0SUTqz/GtrGuXfbyyBniKykOWQWGqwwMA7QiYAxi+IlPdqo+hYHnUt5ZPfnsHJyNiDtnpJyayNBkF6cWoYGAMY92U2hXHF/C1M8uP/ZtYdiuj26UdAdQQSXQErwSOMzt/XWRWAz5GuSBIkwG1H3FabJ2OsUOUhGC6tK4EMtJO0ttC6IBD3kM0ve0tJwMdSfjZo+EEISaeTr9P3wYrGjXqyC1krcKdhMp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f8XN+A5eeUKHWvJWJ2sgJ1Sop+wwhqFVijqWaJhwtD8MNlSBeWNNWTa5Z5kPZw5+LbVT99wqTdx29lMUH4OIG/D86ruKEauBjvH5xy6um/Sfj7ei6UUVk4AIl3MyD4MSSTOFgSwsH/QJWaQ5as7ZcmgBZkzjjU1UrQ74ci1gWBCSGHtuV1H2mhSnO3Wp/3fEV5a+4wz//6qy8JxjZsmxxy5+4w9CDNJY09T072iKG0EnOS0arEYgXqYnXcYHwjTtUNAcMelOd4xpkoqiTYICWFq0JSiPfPDQdnt+4/wuqcXY47QILbgAAAABJRU5ErkJggg==');
}

.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--border-color);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-header);
  color: var(--primary-color);
  margin-bottom: 10px;
}

h1 {
  font-size: 2.5em;
}

h2 {
  font-size: 2em;
}

h3 {
  font-size: 1.5em;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 5px;
  margin-bottom: 15px;
}

/* Layout principal */
main {
  display: flex;
  flex-direction: column;
}

.section {
  background-color: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Lista de Fichas */
.fichas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.ficha-card {
  background: linear-gradient(to bottom, #f8f0e3, #e6d7b8);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ficha-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.ficha-card-header {
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 10px;
  padding-bottom: 10px;
}

.ficha-card-nome {
  font-size: 1.3em;
  font-weight: bold;
  color: var(--accent-color);
}

.ficha-card-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.ficha-card-actions {
  margin-top: auto;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.ficha-vazia {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  color: var(--gray);
  font-style: italic;
}

/* Editor de Ficha */
.ficha-editor {
  position: absolute;
  width: 100%;
  top: 0;
  left: 0;
  background-color: rgba(255, 255, 255, 0.9);
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
}

.ficha-header {
  background-color: rgba(255, 255, 255, 0.9);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.ficha-actions {
  display: flex;
  gap: 10px;
}

.ficha-container {
  max-height: 80vh;
  overflow-y: auto;
  padding-right: 15px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
}

.form-group {
  margin-bottom: 15px;
}

label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
  color: var(--secondary-color);
}

input, select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: rgba(255, 255, 255, 0.8);
  color: var(--text-color);
  font-family: var(--font-body);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(201, 169, 89, 0.3);
}

textarea {
  resize: vertical;
}

/* Formulário de ficha */
.atributos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 20px;
}

.atributo {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.5);
}

.atributo label {
  font-size: 1.2em;
  text-align: center;
  margin-bottom: 8px;
}

.atributo-valor {
  font-size: 1.5em;
  width: 70px;
  text-align: center;
  font-weight: bold;
}

.atributo-mod {
  margin-top: 8px;
  font-size: 1.3em;
  font-weight: bold;
  color: var(--primary-color);
  background-color: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pv-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.resistencias-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.resistencia {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px;
  background-color: rgba(255, 255, 255, 0.5);
}

.resistencia label {
  font-size: 1.2em;
  margin-bottom: 8px;
  text-align: center;
}

.resistencia-campos {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.resistencia-total {
  font-size: 1.5em;
  font-weight: bold;
  color: var(--primary-color);
  margin-bottom: 8px;
}

.resistencia-detalhes {
  display: flex;
  gap: 10px;
  align-items: center;
}

.resistencia-base,
.resistencia-outros {
  width: 50px;
  text-align: center;
}

/* Perícias */
.tabela-pericias {
  width: 100%;
  border-collapse: collapse;
}

.tabela-pericias th,
.tabela-pericias td {
  border: 1px solid var(--border-color);
  padding: 8px;
  text-align: left;
}

.tabela-pericias th {
  background-color: rgba(201, 169, 89, 0.2);
}

.tabela-pericias tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.3);
}

.pericia-nome {
  font-weight: bold;
}

.input-pontos {
  width: 50px;
  text-align: center;
}

.checkbox-classe {
  width: auto;
}

/* Equipamentos */
.tabela-armas,
.tabela-armaduras {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 10px;
}

.tabela-armas th,
.tabela-armas td,
.tabela-armaduras th,
.tabela-armaduras td {
  border: 1px solid var(--border-color);
  padding: 8px;
  text-align: left;
}

.tabela-armas th,
.tabela-armaduras th {
  background-color: rgba(201, 169, 89, 0.2);
}

.tabela-armas input,
.tabela-armaduras input {
  width: 100%;
  padding: 5px;
}

.btn-remove {
  background-color: var(--danger);
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.inventario-container {
  margin-top: 20px;
}

/* Magias */
.magias-container {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 20px;
}

.cd-magias {
  margin-top: 20px;
}

.cd-niveis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.cd-nivel {
  display: flex;
  justify-content: space-between;
  padding: 5px;
  border-bottom: 1px dotted var(--border-color);
}

.lista-magias {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 15px;
  background-color: rgba(255, 255, 255, 0.5);
}

.magia-item {
  display: grid;
  grid-template-columns: 3fr 1fr 3fr 1fr;
  gap: 10px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px dotted var(--border-color);
}

.magia-item:last-child {
  border-bottom: none;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
  background: linear-gradient(to bottom, #f8f0e3, #e6d7b8);
  margin: 10% auto;
  padding: 20px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  width: 80%;
  max-width: 500px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.close {
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.dados-container {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 20px;
}

.dado-seletor {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.resultado-rolagem {
  text-align: center;
  padding: 15px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.7);
}

.resultado-dados {
  font-size: 1.8em;
  font-weight: bold;
  color: var(--primary-color);
  margin-top: 10px;
}

/* Utilidades */
.hidden {
  display: none !important;
}

/* Botões */
.btn {
  display: inline-block;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
  user-select: none;
  border: 1px solid transparent;
  padding: 8px 16px;
  font-size: 1rem;
  line-height: 1.5;
  border-radius: 4px;
  transition: all 0.2s ease-in-out;
  cursor: pointer;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background-color: #5e2525;
}

.btn-secondary {
  background-color: var(--gray);
  color: white;
}

.btn-secondary:hover {
  background-color: #666666;
}

.btn-success {
  background-color: var(--success);
  color: white;
}

.btn-success:hover {
  background-color: #245e43;
}

.btn-danger {
  background-color: var(--danger);
  color: white;
}

.btn-danger:hover {
  background-color: #732828;
}

.btn-small {
  padding: 5px 10px;
  font-size: 0.8rem;
}

/* Media queries para responsividade */
@media screen and (max-width: 768px) {
  .magias-container {
    grid-template-columns: 1fr;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
  
  .atributos-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .resistencias-grid {
    grid-template-columns: 1fr;
  }
  
  .cd-niveis {
    grid-template-columns: 1fr;
  }
}

@media screen and (max-width: 480px) {
  header {
    flex-direction: column;
    text-align: center;
    gap: 15px;
  }
  
  .atributos-grid {
    grid-template-columns: 1fr;
  }
  
  .ficha-header {
    flex-direction: column;
    gap: 15px;
  }
}