/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'SeccaSoftW03-UltraBlack', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    background-color: #f5f5f5;
    min-height: 100vh;
}

/* Adicionar isso para garantir que o body não tenha margens estranhas */
body.rewards-page,
body.dashboard-page {
    padding: 0;
    margin: 0;
    padding-bottom: 70px !important; /* Espaço para navbar fixa */
    background: linear-gradient(160deg, #005580 0%, #003366 60%, #002244 100%);
    color: white;
}

/* Garantir que todas as páginas exceto login e registro possam rolar */
body:not(.login-page):not(.register-page) {
    overflow-y: auto !important;
}

/* Dashboard com scroll travado */
body.dashboard-locked {
    overflow: hidden !important;
}

html.dashboard-locked {
    overflow: hidden !important;
}

/* Corrigir overflow para conteúdos específicos */
.onboarding-content,
.firstupgrade-container,
.dashboard-container,
.profile-container,
.rewards-container,
.islands-container,
.development-container {
    overflow-y: auto;
}

/* Corrigir conflitos com classes do Bootstrap */
.container-moai {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Garantir que modais fiquem visíveis quando abertos */
.modal.show.d-block {
    display: block !important;
    background-color: rgba(0, 0, 0, 0.5);
}

/* Garantir que elementos bootstrap não quebrem o design */
.btn-moai {
    background: linear-gradient(to bottom, #29ABE2, #1D8CB8) !important;
    color: white !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 8px 16px !important;
    font-weight: bold !important;
}

/* Corrigir problemas de z-index */
.navbar.fixed-bottom {
    z-index: 1030 !important;
}

/* Adicionar estas regras para garantir que os modais apareçam por cima de tudo */
.custom-modal-container {
    z-index: 1050 !important;
}

.custom-modal {
    z-index: 1051 !important;
}

/* Corrigir alinhamento de texto em cards */
.card-moai {
    text-align: center !important;
}

/* Global Styles - ajustados para complementar o Bootstrap */
:root {
    --moai-blue: #003366;
    --moai-light-blue: #29ABE2;
    --moai-dark-blue: #002244;
    --moai-accent: #00CED1;
    --moai-font: 'SeccaSoftW03-UltraBlack', cursive;
}

/* Aplicar a fonte MOAI para títulos e elementos importantes */
h1, h2, h3, h4, h5, h6,
.title, .heading, .label-title,
.form-label, .btn-title,
.navbar-brand, .logo-text,
.section-title, .card-title {
    font-family: var(--moai-font) !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    -webkit-text-stroke: 1px #000;
}

/* Resets para garantir compatibilidade com Bootstrap */
.btn:focus, .form-control:focus {
    box-shadow: 0 0 0 0.25rem rgba(41, 171, 226, 0.25);
}

/* Classes utilitárias adicionais */
.vh-100 {
    min-height: 100vh;
}

.text-moai-blue {
    color: var(--moai-blue);
}

.bg-moai-blue {
    background-color: var(--moai-blue);
}

.bg-moai-dark {
    background-color: var(--moai-dark-blue);
}

.bg-gradient-moai {
    background: linear-gradient(160deg, #005580 0%, #003366 60%, #002244 100%);
}

/* Garantir espaço na parte inferior para a navbar fixa */
.content-with-navbar {
    padding-bottom: 70px;
}

/* Botão de fechar para modais escuros */
.btn-close-white {
    filter: invert(1) grayscale(100%) brightness(200%);
    opacity: 0.8 !important;
}

.btn-close-white:hover {
    opacity: 1 !important;
}

/* Remover estilização excessiva do Bootstrap para os modais */
.modal-header, .modal-footer {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

.list-group-item {
    background-color: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.custom-modal .modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.custom-modal .modal-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 15px;
    margin-top: 15px;
}

/* MOAI Upgrade Button */
.moai-upgrade-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(45deg, #ff9d00, #ff7300);
    border: none;
    padding: 10px 15px;
    border-radius: 20px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    color: white;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    z-index: 10;
}

.moai-upgrade-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

.upgrade-icon {
    font-size: 1.4rem;
}

/* Resources Section */
.resources-section {
    background: rgba(0,0,0,0.05);
}

.resource-item {
    text-align: center;
    padding: 10px;
}

.resource-icon {
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.energy-icon {
    color: #ffc107;
}

.tools-icon {
    color: #0d6efd;
}

.creativity-icon {
    color: #20c997;
}

.resource-value {
    font-weight: bold;
    font-size: 1.2rem;
}

.resource-label {
    font-size: 0.9rem;
    color: #6c757d;
}

/* MOAI Modal */
.moai-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
}

.moai-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1049;
}

.moai-modal-content {
    background: linear-gradient(to bottom, #2c3e50, #1a252f);
    color: white;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    border-radius: 10px;
    overflow-y: auto;
    z-index: 1051;
    box-shadow: 0 5px 30px rgba(0,0,0,0.3);
    position: relative;
    padding: 0;
}

.moai-modal-header {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    background-color: rgba(0,0,0,0.2);
}

.moai-modal-title {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.moai-icon {
    font-size: 1.5em;
}

.moai-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    line-height: 1;
    opacity: 0.7;
    cursor: pointer;
}

.moai-modal-close:hover {
    opacity: 1;
}

.moai-modal-body {
    padding: 20px;
}

/* Upgrade Resources Info */
.upgrade-resources-info {
    background-color: rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 15px;
}

.resource-badge {
    background-color: rgba(255,255,255,0.2);
    padding: 8px 15px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.resource-amount {
    font-weight: bold;
}

/* Upgrade List */
.upgrade-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.upgrade-item {
    background-color: rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 15px;
    transition: all 0.3s ease;
    position: relative;
    border: 1px solid rgba(255,255,255,0.1);
}

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

.upgrade-item.owned {
    border-color: #ffc107;
    background-color: rgba(255, 193, 7, 0.1);
}

.upgrade-item.unavailable {
    opacity: 0.7;
}

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

.upgrade-name {
    margin: 0;
    font-size: 1.1rem;
    font-weight: bold;
}

.upgrade-status {
    background-color: #ffc107;
    color: black;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
}

.upgrade-description {
    font-size: 0.9rem;
    margin-bottom: 15px;
    color: rgba(255,255,255,0.8);
    min-height: 40px;
}

.upgrade-requirements, .upgrade-rewards {
    margin-bottom: 15px;
    background-color: rgba(0,0,0,0.2);
    padding: 10px;
    border-radius: 5px;
}

.requirement-list, .reward-list {
    list-style: none;
    padding-left: 0;
    margin-bottom: 0;
}

.requirement-list li, .reward-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 0.9rem;
}

.requirement-list li.met {
    color: #28a745;
}

.requirement-list li:not(.met) {
    color: #dc3545;
}

.requirement-icon, .reward-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.btn-purchase {
    width: 100%;
    background: linear-gradient(45deg, #ff9d00, #ff7300);
    border: none;
    color: white;
    padding: 8px 0;
    border-radius: 5px;
    font-weight: bold;
    transition: all 0.2s;
}

.btn-purchase:hover:not(:disabled) {
    background: linear-gradient(45deg, #ff7300, #ff5500);
    transform: translateY(-1px);
}

.btn-purchase:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* Animation for new items */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.upgrade-item {
    animation: fadeInUp 0.5s ease forwards;
}

.upgrade-item:nth-child(2) { animation-delay: 0.1s; }
.upgrade-item:nth-child(3) { animation-delay: 0.2s; }
.upgrade-item:nth-child(4) { animation-delay: 0.3s; }
.upgrade-item:nth-child(5) { animation-delay: 0.4s; }
.upgrade-item:nth-child(6) { animation-delay: 0.5s; }
.upgrade-item:nth-child(7) { animation-delay: 0.6s; }
.upgrade-item:nth-child(8) { animation-delay: 0.7s; }
.upgrade-item:nth-child(9) { animation-delay: 0.8s; }
.upgrade-item:nth-child(10) { animation-delay: 0.9s; }

/* Remover o feixe decorativo de todas as páginas exceto first upgrade */
.dashboard-container .island-header h1::after,
.islands-container .island-header h1::after,
.rewards-container .island-header h1::after,
.profile-container .island-header h1::after,
.development-container .island-header h1::after,
.onboarding-container .island-header h1::after {
  display: none !important;
}

/* Image Cropper Responsive Styles */
.image-cropper-container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.cropper-area {
  width: 100%;
  max-width: 100%;
  min-height: 250px;
  margin: 0 auto;
  overflow: hidden;
  background-color: #f5f5f5;
  border-radius: 8px;
  position: relative;
}

.cropper-mobile-controls {
  margin-top: 15px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0 10px;
}

.cropper-mobile-controls .control-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  width: 100%;
  justify-content: center;
}

.cropper-mobile-controls .btn {
  width: 50px;
  height: 50px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 20px;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
  border: none;
  transition: transform 0.2s, background 0.2s;
}

.cropper-mobile-controls .btn:active {
  transform: scale(0.95);
  background: rgba(41, 171, 226, 0.2);
}

.cropper-controls {
  margin-top: 20px;
  display: flex;
  justify-content: center;
  gap: 15px;
  padding: 0 10px;
}

.cropper-controls .btn {
  min-width: 130px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 16px;
}

/* Fix cropper styling for mobile */
@media (max-width: 576px) {
  .cropper-container {
    max-width: 100% !important;
    height: auto !important;
  }

  .cropper-view-box,
  .cropper-face {
    border-radius: 50%;
  }

  .cropper-modal {
    background-color: rgba(0, 0, 0, 0.7);
  }

  /* Make the handles larger for touch */
  .cropper-point {
    width: 20px !important;
    height: 20px !important;
    opacity: 0.9 !important;
  }

  .cropper-point.point-e,
  .cropper-point.point-w,
  .cropper-point.point-n,
  .cropper-point.point-s {
    width: 24px !important;
    height: 24px !important;
  }

  .cropper-line {
    background-color: rgba(41, 171, 226, 0.8) !important;
  }

  /* Adjust canvas size to make it more manageable on mobile */
  .cropper-area {
    max-height: 320px;
  }

  /* Make sure the modal doesn't overflow */
  .modal-dialog {
    margin: 0.5rem auto;
    max-width: 98vw;
    height: auto;
  }

  .modal-body {
    padding: 10px;
  }

  /* Ensure that buttons are easier to tap */
  .btn {
    padding: 12px 16px;
    font-size: 16px;
  }

  /* Adjust modal padding for mobile */
  .modal-content {
    padding-bottom: 10px;
  }
}

/* Special handling for iOS Safari */
@supports (-webkit-touch-callout: none) {
  .cropper-area {
    -webkit-overflow-scrolling: touch;
    max-height: 60vh;
  }

  .cropper-container {
    max-height: 60vh;
  }

  /* Fix for iOS modal scrolling issues */
  .modal {
    -webkit-overflow-scrolling: touch;
  }

  /* Ensure buttons have proper touch target size */
  .cropper-mobile-controls .btn,
  .cropper-controls .btn {
    min-height: 50px;
  }

  /* Additional padding for bottom elements to avoid being hidden by iOS bottom bar */
  .modal-body {
    padding-bottom: 30px;
  }

  .cropper-controls {
    margin-bottom: 20px;
  }
}

/* Remover backgrounds que podem criar "boxes" */
.bg-moai-blue,
.bg-moai-dark,
.bg-gradient-moai {
  background: transparent !important;
}

/* Especificamente para a página de ilhas */
body.islands-page .bg-moai-blue,
body.islands-page .bg-moai-dark,
body.islands-page .bg-gradient-moai {
  background: transparent !important;
}

/* Especificamente para a página de registro - prevenir faixas azuis */
body.register-page .bg-moai-blue,
body.register-page .bg-moai-dark,
body.register-page .bg-gradient-moai,
body.register-page .moai-modal-backdrop,
body.register-page .modal-backdrop {
  display: none !important;
  background: none !important;
}
