/* ============================================
   MODAL STYLES - GLOBAL
   ============================================ */

/* Modal Overlay */
.modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  animation: fadeIn 0.3s ease;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  box-sizing: border-box;
}

.modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modalFadeOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-30px);
  }
}

/* Modal Content Box */
.modal-content {
  background: linear-gradient(
    135deg,
    rgba(26, 26, 46, 0.98),
    rgba(20, 20, 36, 0.98)
  );
  margin: auto;
  padding: 0;
  border: 1px solid rgba(106, 61, 232, 0.3);
  border-radius: 20px;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 100px rgba(106, 61, 232, 0.3);
  animation: slideIn 0.3s ease;
  position: relative;
}

/* Variação para modais menores (painel do jogador) */
.modal-content.modal-content-small {
  max-width: 500px;
  padding: 30px;
}

/* Modal Close Button - Estilo principal */
.modal-close,
.close {
  position: sticky;
  top: 0;
  right: 0;
  float: right;
  font-size: 35px;
  font-weight: bold;
  color: var(--text-muted, #a0a0a6);
  cursor: pointer;
  z-index: 10;
  padding: 20px 25px 0 0;
  transition: all 0.3s ease;
  background: linear-gradient(to bottom, rgba(26, 26, 46, 0.98), transparent);
}

/* Variação do close para modal pequeno */
.close {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 28px;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: none;
}

.modal-close:hover,
.modal-close:focus,
.close:hover,
.close:focus {
  color: var(--primary-light, #e1e1e6);
  transform: scale(1.2) rotate(90deg);
}

.close:hover {
  background: rgba(106, 61, 232, 0.1);
}

/* Modal Header */
.modal-header {
  padding: 25px 30px 18px;
  border-bottom: 2px solid rgba(106, 61, 232, 0.2);
  display: flex;
  align-items: center;
  gap: 15px;
}

.modal-icon {
  width: 50px;
  height: 50px;
  background: linear-gradient(
    135deg,
    var(--primary-color, #6a3de8),
    var(--primary-dark, #4a1db8)
  );
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 5px 20px rgba(106, 61, 232, 0.5);
  flex-shrink: 0;
}

.modal-icon i {
  font-size: 1.5rem;
  color: white;
}

.modal-header h2 {
  font-size: 1.6rem;
  color: var(--text-color, #e1e1e6);
  margin: 0;
  background: linear-gradient(
    to right,
    var(--primary-light, #8a5cf7),
    var(--accent-color, #ff6b97)
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Modal Title - Variação alternativa */
.modal-title {
  font-size: 1.5rem;
  margin-bottom: 20px;
  color: #e1e1e6;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(106, 61, 232, 0.3);
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-title i {
  color: #8a5cf7;
}

/* Modal Body */
.modal-body {
  padding: 20px 30px 25px;
  color: var(--text-muted, #a0a0a6);
  line-height: 1.6;
}

.modal-body p {
  margin-bottom: 15px;
  font-size: 1rem;
}

/* ============================================
   CHARACTER DETAILS MODAL
   ============================================ */

.character-details-content {
  max-width: 700px;
}

/* Character Profile */
.char-profile {
  margin-bottom: 20px;
}

.char-profile-header {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}

.char-profile-avatar {
  width: 100px;
  height: 100px;
  background: rgba(26, 26, 46, 0.7);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid rgba(106, 61, 232, 0.3);
  flex-shrink: 0;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.char-profile-avatar img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.char-profile-info {
  flex: 1;
}

.char-profile-name {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 5px;
  color: #e1e1e6;
}

.char-profile-class {
  font-size: 1.1rem;
  color: #8a5cf7;
  margin-bottom: 15px;
}

.char-profile-levels {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.level-item {
  background: rgba(26, 26, 46, 0.5);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
}

.level-item span {
  font-size: 0.8rem;
  color: #a0a0a6;
  margin-bottom: 3px;
}

.level-item strong {
  font-size: 1.1rem;
  color: #e1e1e6;
}

/* Character Stats */
.char-stats-bars {
  margin-bottom: 20px;
}

.stat-bar-item {
  margin-bottom: 10px;
}

.stat-bar-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  font-size: 0.9rem;
  color: #a0a0a6;
}

.stat-bar {
  height: 8px;
  background: rgba(26, 26, 46, 0.5);
  border-radius: 4px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.hp-bar {
  background: linear-gradient(to right, #ff3e78, #ff6b97);
}

.sp-bar {
  background: linear-gradient(to right, #00d9ff, #00b8d4);
}

.char-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.char-stats-column h3 {
  font-size: 1.1rem;
  color: #e1e1e6;
  margin-bottom: 15px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(106, 61, 232, 0.2);
}

.char-stat-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.char-stat-row:last-child {
  border-bottom: none;
}

.stat-name {
  color: #a0a0a6;
}

.stat-value {
  color: #e1e1e6;
  font-weight: 500;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
}

.status-dot.online {
  background-color: #00c896;
  box-shadow: 0 0 5px #00c896;
}

.status-dot.offline {
  background-color: #6c757d;
}

/* Character Equipment */
.char-equipment h3 {
  font-size: 1.1rem;
  color: #e1e1e6;
  margin-bottom: 15px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(106, 61, 232, 0.2);
}

.char-equipment ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.char-equipment li {
  padding: 8px 10px;
  margin-bottom: 8px;
  background: rgba(26, 26, 46, 0.5);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.char-equipment li i {
  color: #8a5cf7;
}

.char-equipment li.no-equipment {
  color: #a0a0a6;
  font-style: italic;
}

.char-equipment li.no-equipment i {
  color: #ff3e78;
}

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

.equipment-item {
  background: rgba(26, 26, 46, 0.5);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(106, 61, 232, 0.1);
}

.equipment-icon {
  width: 40px;
  height: 40px;
  background: rgba(18, 18, 37, 0.8);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid rgba(106, 61, 232, 0.2);
  flex-shrink: 0;
}

.equipment-icon img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.equipment-info {
  flex: 1;
}

.equipment-name {
  font-size: 0.9rem;
  color: #e1e1e6;
  margin-bottom: 3px;
}

.equipment-type {
  font-size: 0.8rem;
  color: #a0a0a6;
}

.item-refine {
  color: #ffc107;
  font-weight: bold;
  margin-left: 5px;
}

/* ============================================
   FORM STYLES IN MODALS
   ============================================ */

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

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: #e1e1e6;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid rgba(106, 61, 232, 0.3);
  border-radius: 8px;
  background-color: rgba(18, 18, 37, 0.8);
  color: #e1e1e6;
  font-size: 1rem;
  box-sizing: border-box;
}

.form-group input:focus {
  outline: none;
  border-color: #6a3de8;
  box-shadow: 0 0 0 2px rgba(106, 61, 232, 0.2);
}

.password-input {
  position: relative;
}

.toggle-password {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #a0a0a6;
  cursor: pointer;
  padding: 5px;
}

.toggle-password:hover {
  color: #e1e1e6;
}

.password-strength-container {
  margin-top: 10px;
}

.strength-bar {
  height: 5px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 5px;
}

.strength-progress {
  height: 100%;
  width: 0;
  border-radius: 3px;
  transition: all 0.3s;
}

.strength-text {
  font-size: 0.8rem;
  color: #a0a0a6;
}

.password-requirements {
  margin-top: 10px;
  font-size: 0.85rem;
  color: #a0a0a6;
}

.password-requirements ul {
  padding-left: 20px;
  margin-top: 5px;
}

.password-requirements li {
  margin-bottom: 3px;
}

.password-requirements li.valid {
  color: #00c896;
}

.password-requirements li.invalid {
  color: #dc3545;
}

#password-match-message {
  font-size: 0.85rem;
  margin-top: 5px;
}

.match-valid {
  color: #00c896;
}

.match-invalid {
  color: #dc3545;
}

.form-submit {
  background: linear-gradient(135deg, #6a3de8, #8a5cf7);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.form-submit:hover {
  background: linear-gradient(135deg, #8a5cf7, #6a3de8);
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(106, 61, 232, 0.3);
}

.form-submit:disabled {
  background: #6c757d;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.delete-submit {
  background: linear-gradient(135deg, #dc3545, #b02a37);
}

.delete-submit:hover {
  background: linear-gradient(135deg, #b02a37, #dc3545);
  box-shadow: 0 5px 15px rgba(220, 53, 69, 0.3);
}

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

.btn-cancel {
  background: rgba(108, 117, 125, 0.2);
  color: #a0a0a6;
  border: 1px solid rgba(108, 117, 125, 0.3);
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  flex: 1;
  text-align: center;
}

.btn-cancel:hover {
  background: rgba(108, 117, 125, 0.3);
}

.modal-warning {
  margin-bottom: 20px;
  padding: 15px;
  background-color: rgba(220, 53, 69, 0.1);
  border: 1px solid rgba(220, 53, 69, 0.2);
  border-radius: 8px;
}

.warning-text {
  color: #ff3e78;
  font-weight: bold;
  margin-top: 10px;
}

.valid-input {
  border-color: #00c896 !important;
  background-color: rgba(0, 200, 150, 0.05) !important;
}

.invalid-input {
  border-color: #dc3545 !important;
  background-color: rgba(220, 53, 69, 0.05) !important;
}

/* ============================================
   LOADING & ERROR STATES
   ============================================ */

.character-loading {
  text-align: center;
  padding: 30px;
}

.loading-spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 3px solid rgba(106, 61, 232, 0.3);
  border-radius: 50%;
  border-top-color: #8a5cf7;
  animation: spin 1s ease-in-out infinite;
  margin-bottom: 15px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.character-error {
  text-align: center;
  padding: 30px;
  color: #ff3e78;
}

.character-error i {
  font-size: 3rem;
  margin-bottom: 15px;
}

/* ============================================
   SCROLLBAR CUSTOMIZATION
   ============================================ */

.modal-content::-webkit-scrollbar {
  width: 10px;
}

.modal-content::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb {
  background: linear-gradient(
    to bottom,
    var(--primary-color, #6a3de8),
    var(--accent-color, #ff6b97)
  );
  border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
  background: var(--primary-light, #8a5cf7);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Classe para quando o modal está aberto */
body.modal-open {
  overflow: hidden;
}

/* Classes para animação de entrada e saída */
.modal-active {
  animation: modalFadeIn 0.3s ease;
}

.modal-closing {
  animation: modalFadeOut 0.3s ease;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    margin: 10px;
    max-height: 90vh;
    padding: 20px;
  }

  .modal-content.modal-content-small {
    padding: 20px;
    margin: 15% auto;
  }

  .modal-header {
    padding: 20px 25px 15px;
    flex-direction: column;
    text-align: center;
  }

  .modal-header h2 {
    font-size: 1.5rem;
  }

  .modal-body {
    padding: 20px 25px 30px;
  }

  .modal-close {
    padding: 15px 20px 0 0;
    font-size: 30px;
  }

  .char-profile-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .char-stats-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 576px) {
  .modal-header h2 {
    font-size: 1.3rem;
  }

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

  .char-profile-avatar {
    width: 80px;
    height: 80px;
  }
}
