* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.container {
  width: 100%;
  max-width: 800px;
}

.card {
  background: white;
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.card.dashboard {
  max-width: 900px;
}

h1 {
  color: #333;
  margin-bottom: 10px;
  font-size: 32px;
}

h2 {
  color: #555;
  margin-bottom: 20px;
  font-size: 24px;
}

.subtitle {
  color: #666;
  margin-bottom: 30px;
}

.form-section {
  margin-bottom: 20px;
}

.form-section.hidden {
  display: none;
}

input {
  width: 100%;
  padding: 12px;
  margin-bottom: 15px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 16px;
}

input:focus {
  outline: none;
  border-color: #667eea;
}

button {
  width: 100%;
  padding: 12px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.3s;
}

button:hover {
  background: #5568d3;
}

.btn-primary {
  background: #667eea;
  display: inline-block;
  text-decoration: none;
  text-align: center;
  margin-top: 10px;
}

.btn-primary:hover {
  background: #5568d3;
}

.btn-secondary {
  background: #48bb78;
  width: auto;
  padding: 10px 20px;
  margin-bottom: 15px;
}

.btn-secondary:hover {
  background: #38a169;
}

.btn-danger {
  background: #f56565;
  width: auto;
  padding: 10px 20px;
}

.btn-danger:hover {
  background: #e53e3e;
}

.btn-logout {
  background: #e53e3e;
  width: auto;
  padding: 8px 16px;
  font-size: 14px;
}

.toggle-text {
  text-align: center;
  margin-top: 20px;
  color: #666;
}

.toggle-text a {
  color: #667eea;
  text-decoration: none;
}

.toggle-text a:hover {
  text-decoration: underline;
}

.message {
  padding: 12px;
  margin-top: 20px;
  border-radius: 6px;
  display: none;
}

.message.success {
  background: #c6f6d5;
  color: #22543d;
  border: 1px solid #9ae6b4;
  display: block;
}

.message.error {
  background: #fed7d7;
  color: #742a2a;
  border: 1px solid #fc8181;
  display: block;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.user-info {
  background: #f7fafc;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 30px;
}

.user-info p {
  margin-bottom: 8px;
  color: #4a5568;
}

.section {
  margin-top: 30px;
  padding-top: 30px;
  border-top: 2px solid #e2e8f0;
}

.status-box {
  background: #edf2f7;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.status-box.connected {
  background: #c6f6d5;
  border: 1px solid #9ae6b4;
}

.status-box.disconnected {
  background: #fed7d7;
  border: 1px solid #fc8181;
}

.error-box {
  background: #fed7d7;
  border: 1px solid #fc8181;
  color: #742a2a;
  padding: 20px;
  border-radius: 8px;
  margin: 20px 0;
}

.hidden {
  display: none !important;
}

.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.tab-btn {
  flex: 1;
  background: #e2e8f0;
  color: #4a5568;
}

.tab-btn.active {
  background: #667eea;
  color: white;
}

.tab-content {
  min-height: 200px;
}

.data-list {
  margin-top: 15px;
  max-height: 400px;
  overflow-y: auto;
}

.data-item {
  background: #f7fafc;
  padding: 15px;
  margin-bottom: 10px;
  border-radius: 6px;
  border-left: 4px solid #667eea;
}

.data-item h3 {
  color: #2d3748;
  margin-bottom: 8px;
}

.data-item p {
  color: #718096;
  font-size: 14px;
  margin-bottom: 4px;
}

.loading {
  text-align: center;
  padding: 20px;
  color: #718096;
}

#olddragon-actions {
  display: flex;
  gap: 10px;
}

/* ==========================================
   PERSONAGENS
   ========================================== */

.character-item {
  position: relative;
}

.character-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.level-badge {
  background: #667eea;
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: bold;
}

.character-info {
  margin-bottom: 10px;
}

.character-stats {
  display: flex;
  gap: 15px;
  margin-bottom: 15px;
  background: #e2e8f0;
  padding: 10px;
  border-radius: 6px;
}

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

.stat-label {
  font-size: 11px;
  font-weight: bold;
  color: #4a5568;
  text-transform: uppercase;
}

.stat-value {
  font-size: 16px;
  font-weight: bold;
  color: #2d3748;
}

.character-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
  width: auto;
}

.btn-tiny {
  padding: 4px 8px;
  font-size: 11px;
  width: auto;
}

.btn-info {
  background: #4299e1;
}

.btn-info:hover {
  background: #3182ce;
}

.btn-warning {
  background: #ed8936;
}

.btn-warning:hover {
  background: #dd6b20;
}

.btn-success {
  background: #48bb78;
}

.btn-success:hover {
  background: #38a169;
}

/* ==========================================
   MODAL
   ========================================== */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #e2e8f0;
  background: #f7fafc;
  border-radius: 12px 12px 0 0;
}

.modal-header h2 {
  margin: 0;
  color: #2d3748;
}

.btn-close {
  background: #e53e3e;
  color: white;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-weight: bold;
  cursor: pointer;
  padding: 0;
}

.btn-close:hover {
  background: #c53030;
}

.modal-body {
  padding: 20px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #e2e8f0;
}

.modal-actions button {
  width: auto;
  padding: 10px 20px;
}

/* ==========================================
   DETALHES DO PERSONAGEM
   ========================================== */

.character-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.detail-section {
  background: #f7fafc;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

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

.detail-section h4 {
  color: #2d3748;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #667eea;
  font-size: 16px;
}

.detail-section p {
  margin-bottom: 6px;
  color: #4a5568;
  font-size: 14px;
}

/* ==========================================
   INVENTARIO
   ========================================== */

.inventory-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  max-height: 400px;
  overflow-y: auto;
  padding: 5px;
}

.inventory-item {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 10px;
  transition: all 0.2s;
}

.inventory-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.inventory-item.equipped {
  border-color: #48bb78;
  background: #f0fff4;
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.item-name {
  font-weight: bold;
  color: #2d3748;
}

.item-qty {
  background: #e2e8f0;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  color: #4a5568;
}

.item-details {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.item-type {
  background: #667eea;
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
}

.equipped-badge {
  background: #48bb78;
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
}

.item-damage,
.item-ca {
  background: #ed8936;
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
}

.item-actions {
  display: flex;
  gap: 5px;
}

/* ==========================================
   FORMULARIOS
   ========================================== */

label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
  color: #4a5568;
  font-size: 14px;
}

select {
  width: 100%;
  padding: 10px;
  margin-bottom: 15px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  background: white;
}

select:focus {
  outline: none;
  border-color: #667eea;
}

textarea {
  width: 100%;
  padding: 10px;
  margin-bottom: 15px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}

textarea:focus {
  outline: none;
  border-color: #667eea;
}

.conditional-fields {
  background: #f7fafc;
  padding: 15px;
  border-radius: 6px;
  margin-bottom: 15px;
  border: 1px solid #e2e8f0;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.form-actions button {
  flex: 1;
}

/* ==========================================
   CAMPANHAS
   ========================================== */

.campaign-item {
  border-left-color: #48bb78;
}

/* ==========================================
   MODAL PEQUENO
   ========================================== */

.modal-small {
  max-width: 500px;
}

.choice-buttons {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.choice-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  text-align: center;
}

.choice-btn strong {
  font-size: 16px;
  margin-bottom: 5px;
}

.choice-btn span {
  font-size: 12px;
  opacity: 0.8;
}

/* ==========================================
   ITENS LOCAIS
   ========================================== */

.search-box {
  margin-bottom: 15px;
}

.search-box input {
  margin-bottom: 0;
}

.local-items-list {
  max-height: 500px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 15px;
  padding: 5px;
}

.local-item-card {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  padding: 15px;
  cursor: pointer;
  transition: all 0.2s;
}

.local-item-card:hover {
  border-color: #667eea;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
  transform: translateY(-2px);
}

.local-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.local-item-name {
  font-weight: bold;
  font-size: 16px;
  color: #2d3748;
}

.local-item-type {
  background: #667eea;
  color: white;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: bold;
}

.local-item-info {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.local-item-info span {
  background: #edf2f7;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  color: #4a5568;
}

.local-item-desc {
  font-size: 13px;
  color: #718096;
  margin-bottom: 10px;
  line-height: 1.4;
}

.local-item-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.local-item-badge {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: bold;
}

.local-item-badge.public {
  background: #c6f6d5;
  color: #22543d;
}

.local-item-badge.private {
  background: #fed7d7;
  color: #742a2a;
}

/* ==========================================
   RESPONSIVO
   ========================================== */

@media (max-width: 768px) {
  .character-detail-grid {
    grid-template-columns: 1fr;
  }

  .inventory-list {
    grid-template-columns: 1fr;
  }

  .modal-content {
    max-height: 95vh;
  }

  .character-actions {
    flex-direction: column;
  }

  .btn-small {
    width: 100%;
  }
}
