/* ===== ISLAND VIEWER MODAL ===== */

/* Animations for MapLibre-based islands */
@keyframes islandFloat {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes treeSway {
  0%, 100% {
    transform: rotate(0deg);
  }
  50% {
    transform: rotate(3deg);
  }
}

@keyframes contentFloat {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-5px);
  }
}

.island-viewer-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: linear-gradient(135deg, rgba(0, 20, 40, 0.95) 0%, rgba(0, 10, 30, 0.98) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  animation: fadeIn 0.4s ease;
}

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

.island-viewer-container {
  position: relative;
  width: 92%;
  max-width: 1300px;
  max-height: 92vh;
  overflow-y: auto;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
  border-radius: 24px;
  padding: 2.5rem;
  box-shadow:
    0 25px 80px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(148, 163, 184, 0.1),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
  animation: slideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.island-viewer-container::-webkit-scrollbar {
  width: 10px;
}
.island-viewer-container::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.35);
  border-radius: 999px;
  border: 2px solid rgba(15, 23, 42, 0.9);
}
.island-viewer-container::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.5);
  border-radius: 999px;
}

body[data-theme="blue"] .island-viewer-modal{
  background: linear-gradient(135deg, rgba(3, 12, 40, 0.95) 0%, rgba(2, 8, 28, 0.98) 100%);
}
body[data-theme="blue"] .island-viewer-container{
  background: linear-gradient(135deg, #0b1b3b 0%, #0f224d 60%, #163264 100%);
  border-color: rgba(96, 165, 250, 0.35);
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.island-viewer-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.island-viewer-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

.island-viewer-close:active {
  transform: rotate(90deg) scale(0.95);
}

/* Header */

.island-viewer-header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.island-header-row{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.island-header-avatar{
  width: 64px;
  height: 64px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(56, 189, 248, 0.6);
  background: rgba(56, 189, 248, 0.15);
  display: grid;
  place-items: center;
  color: #e2e8f0;
  font-weight: 800;
}

.island-header-avatar img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.island-header-text{
  text-align: left;
}

.island-tabbar{
  margin-top: 12px;
  display: inline-flex;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.island-tab{
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.island-tab.is-active{
  background: rgba(56, 189, 248, 0.25);
  color: #fff;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
}

.island-viewer-header h2 {
  color: #f1f5f9;
  font-size: 2.25rem;
  margin-bottom: 0.75rem;
  font-weight: 800;
  text-shadow: 0 2px 12px rgba(56, 189, 248, 0.4);
  letter-spacing: -0.02em;
}

.island-viewer-header p {
  color: #cbd5e1;
  font-size: 1.1rem;
  font-style: italic;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Profile panel */
.island-profile-panel {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.35), rgba(15, 23, 42, 0.7));
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  margin-bottom: 1.5rem;
}

.island-posts-panel{
  padding: 0.9rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.6);
  margin-bottom: 1.5rem;
  max-height: 280px;
  overflow: auto;
}

.island-post-row{
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(2, 6, 23, 0.4);
  border: 1px solid rgba(148, 163, 184, 0.18);
  margin-bottom: 10px;
}

.island-post-title{
  font-weight: 800;
  font-size: 0.88rem;
  color: #f8fafc;
}

.island-post-snippet{
  font-size: 0.78rem;
  color: rgba(226, 232, 240, 0.8);
  margin-top: 4px;
}

.island-post-meta{
  font-size: 0.72rem;
  color: rgba(148, 163, 184, 0.85);
  margin-top: 6px;
}

.island-posts-empty{
  font-size: 0.85rem;
  color: rgba(226, 232, 240, 0.75);
}
.island-profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(56, 189, 248, 0.6);
  background: rgba(56, 189, 248, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.island-profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.island-profile-letter {
  color: #e2f2ff;
  font-weight: 800;
  font-size: 1.4rem;
}

.island-viewer-canvas-wrap{
  position: relative;
}

.island-tabbar-overlay{
  position: absolute;
  right: 16px;
  top: 16px;
}
.island-profile-meta {
  flex: 1;
  min-width: 0;
}
.island-profile-name {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.95rem;
  font-weight: 800;
  color: #e2e8f0;
  margin-bottom: 0.35rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.island-profile-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.island-profile-error{
  font-size: 0.75rem;
  color: #f87171;
}

.island-profile-info{
  font-size: 0.75rem;
  color: #86efac;
}
.island-profile-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: #cbd5f5;
}
.island-profile-inline {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.island-profile-inline .island-profile-input {
  flex: 1;
}
.island-profile-row select {
  flex: 1;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.4);
  color: #e2e8f0;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.72rem;
}
.island-profile-input {
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.4);
  color: #e2e8f0;
  border-radius: 10px;
  padding: 0.35rem 0.6rem;
  font-size: 0.72rem;
}
.island-profile-btn {
  align-self: flex-start;
  border: 1px solid rgba(56, 189, 248, 0.6);
  background: rgba(56, 189, 248, 0.2);
  color: #e2f2ff;
  font-weight: 800;
  font-size: 0.72rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
}
.island-profile-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Canvas */

.island-viewer-canvas {
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(56, 189, 248, 0.15),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
  display: block;
  margin: 0 auto;
  border: 1px solid rgba(148, 163, 184, 0.1);
}

/* Stats */

.island-viewer-stats {
  display: flex;
  gap: 2rem;
  justify-content: center;
  margin-top: 1.5rem;
}

.stat {
  text-align: center;
}

.stat-value {
  display: block;
  color: white;
  font-size: 2rem;
  font-weight: bold;
  margin-bottom: 0.25rem;
}

.stat-label {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Footer */

.island-viewer-footer {
  text-align: center;
  margin-top: 1rem;
}

.island-info {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.85rem;
  margin: 0;
}

/* ===== ISLAND MARKERS (on map) ===== */

.island-marker {
  opacity: 0;
  transition: opacity 0.4s ease;
}

.island-marker.sw-appear-in {
  opacity: 1;
}

.island-marker-container {
  pointer-events: auto;
}

/* Responsive */

@media (max-width: 768px) {
  .island-viewer-container {
    width: 95%;
    padding: 1.5rem;
  }

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

  .island-viewer-canvas {
    height: 400px !important;
  }

  .island-viewer-stats {
    flex-wrap: wrap;
    gap: 1rem;
  }

  .stat-value {
    font-size: 1.5rem;
  }
}

/* Light theme support */

body[data-theme="light"] .island-viewer-container {
  background: linear-gradient(135deg, #e0e7ff 0%, #ddd6fe 100%);
}

body[data-theme="light"] .island-viewer-header h2 {
  color: #1e3a8a;
}

body[data-theme="light"] .island-viewer-header p {
  color: rgba(30, 58, 138, 0.8);
}

body[data-theme="light"] .stat-value {
  color: #1e3a8a;
}

body[data-theme="light"] .stat-label {
  color: rgba(30, 58, 138, 0.7);
}

body[data-theme="light"] .island-info {
  color: rgba(30, 58, 138, 0.6);
}

body[data-theme="light"] .island-viewer-close {
  background: rgba(30, 58, 138, 0.2);
  color: #1e3a8a;
}

body[data-theme="light"] .island-viewer-close:hover {
  background: rgba(30, 58, 138, 0.3);
}

/* Password Form */
.island-password-form {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.island-password-form .island-profile-row {
  margin-bottom: 0.5rem;
}

.island-password-form .island-profile-row label {
  min-width: 100px;
}

.island-profile-btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  border-color: rgba(99, 102, 241, 0.6);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.island-profile-btn-primary:hover:not(:disabled) {
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.5);
}

body[data-theme="light"] .island-password-form {
  background: rgba(255, 255, 255, 0.5);
}

body[data-theme="light"] .island-profile-btn-primary {
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
}

/* Password Change Modal */
.password-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

.password-modal {
  position: relative;
  width: 90%;
  max-width: 380px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(56, 189, 248, 0.2);
  animation: slideUp 0.25s ease;
}

.password-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.password-modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.password-modal-title {
  color: #f1f5f9;
  font-size: 1.25rem;
  margin: 0 0 1.25rem 0;
  font-weight: 700;
}

.password-modal-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.password-modal-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.password-modal-field label {
  color: rgba(226, 232, 240, 0.8);
  font-size: 0.8rem;
  font-weight: 600;
}

.password-modal-field input {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #e2e8f0;
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
}

.password-modal-field input:focus {
  outline: none;
  border-color: rgba(56, 189, 248, 0.5);
}

.password-modal-error {
  color: #f87171;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8rem;
}

.password-modal-success {
  color: #86efac;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8rem;
}

.password-modal-submit {
  background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  border: none;
  color: white;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 0.5rem;
}

.password-modal-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.password-modal-submit:hover:not(:disabled) {
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

body[data-theme="light"] .password-modal {
  background: linear-gradient(135deg, #e0e7ff 0%, #f5f3ff 100%);
  border-color: rgba(99, 102, 241, 0.3);
}

body[data-theme="light"] .password-modal-title {
  color: #1e3a8a;
}

body[data-theme="light"] .password-modal-field label {
  color: rgba(30, 58, 138, 0.8);
}

body[data-theme="light"] .password-modal-field input {
  background: rgba(255, 255, 255, 0.8);
  color: #1e293b;
  border-color: rgba(99, 102, 241, 0.3);
}

/* ===== ISLAND ACTION BUTTONS ===== */

.island-viewer-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.island-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(30, 41, 59, 0.6);
  color: #e2e8f0;
  backdrop-filter: blur(8px);
}

.island-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  border-color: rgba(96, 165, 250, 0.5);
}

.island-action-btn:active {
  transform: scale(0.97);
}

.island-action-btn i {
  font-size: 1rem;
}

.island-action-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  border-color: rgba(99, 102, 241, 0.5);
  color: white;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.island-action-primary:hover {
  background: linear-gradient(135deg, #60a5fa 0%, #818cf8 100%);
  box-shadow: 0 8px 28px rgba(99, 102, 241, 0.4);
  border-color: rgba(129, 140, 248, 0.6);
}

body[data-theme="light"] .island-action-btn {
  background: rgba(255, 255, 255, 0.8);
  color: #1e3a8a;
  border-color: rgba(99, 102, 241, 0.25);
}

body[data-theme="light"] .island-action-btn:hover {
  border-color: rgba(99, 102, 241, 0.5);
}

body[data-theme="light"] .island-action-primary {
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  color: white;
}
