/* Terrariapp - Modern, Minimalist, Mobile-First Terraria Player Editor */
:root {
  --bg-main: #0b0f17;
  --bg-surface: #141c2b;
  --bg-surface-elevated: #1e293b;
  --bg-input: #0f172a;
  --border-color: #334155;
  --border-focus: #38bdf8;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --accent: #38bdf8;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --slot-bg: #1e293b;
  --slot-border: #334155;
  --slot-hover: #475569;
  --slot-active: #0284c7;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --bottom-nav-height: 60px;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--bottom-nav-height) + 24px);
}

/* Evitar FOUC: ocultar componentes de la app hasta que Vue monte */
[v-cloak] {
  display: none !important;
}

@media (min-width: 768px) {
  body {
    padding-bottom: calc(var(--bottom-nav-height) + 28px);
  }
}

/* Header & Top Bar */
.app-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-container {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-badge {
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
}

.app-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background: #334155;
  border-color: #475569;
}

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover {
  background: #059669;
}

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

.btn-sm {
  padding: 4px 8px;
  font-size: 12px;
}

/* Bottom Global Navigation Bar (Unificada: móvil y escritorio) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  z-index: 50;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.4);
}

.bottom-nav-container {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  padding: 0 4px;
}

.bottom-nav-container::-webkit-scrollbar {
  display: none;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  /* En pantallas móviles: exactamente 4 iconos visibles a la vez (25%) */
  flex: 0 0 25%;
  min-width: 25%;
  max-width: 25%;
  height: 100%;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  scroll-snap-align: start;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.15s ease;
  border-radius: var(--radius-sm);
}

.bottom-nav-item span:first-child {
  font-size: 18px;
  line-height: 1;
}

.bottom-nav-item:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.bottom-nav-item.active {
  color: var(--accent);
}

/* En tablets y escritorios: centrados, más iconos visibles o todos los 11 pestañas sin scroll */
@media (min-width: 768px) {
  .bottom-nav {
    height: 64px;
  }

  .bottom-nav-container {
    max-width: 1280px;
    margin: 0 auto;
    justify-content: center;
    gap: 4px;
    padding: 0 16px;
    overflow-x: visible;
  }

  .bottom-nav-item {
    flex: 0 0 auto;
    min-width: 82px;
    max-width: none;
    padding: 6px 12px;
    font-size: 11px;
  }

  .bottom-nav-item span:first-child {
    font-size: 19px;
  }
}

@media (min-width: 1024px) {
  .bottom-nav-item {
    min-width: 90px;
    padding: 6px 14px;
    font-size: 12px;
  }

  .bottom-nav-item span:first-child {
    font-size: 20px;
  }
}

/* Floating Toast Notification */
.toast-banner {
  position: fixed;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  max-width: 92vw;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.toast-info {
  background: #0c4a6e;
  border: 1px solid #38bdf8;
  color: #e0f2fe;
}

.toast-error {
  background: #7f1d1d;
  border: 1px solid #f87171;
  color: #fee2e2;
}

.mobile-nav-item svg {
  width: 20px;
  height: 20px;
}

/* Main Content Layout */
.app-content {
  max-width: 1280px;
  margin: 16px auto;
  padding: 0 16px;
}

/* Cards & Panels */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Form Controls */
.form-group {
  margin-bottom: 12px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.form-input, .form-select {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 13px;
  transition: border-color 0.15s;
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--border-focus);
}

.color-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-picker {
  -webkit-appearance: none;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: transparent;
}
.color-picker::-webkit-color-swatch-wrapper {
  padding: 0;
}
.color-picker::-webkit-color-swatch {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

/* Responsive Grids */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 768px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 768px) {
  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Terraria Pixel-Art Slots (40x40) */
.slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 42px);
  gap: 6px;
  justify-content: start;
}

.item-slot {
  width: 42px;
  height: 42px;
  background-color: var(--slot-bg);
  border: 1px solid var(--slot-border);
  border-radius: var(--radius-sm);
  position: relative;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s, border-color 0.1s;
}

.item-slot:hover {
  border-color: var(--slot-hover);
  transform: scale(1.04);
  z-index: 2;
}

.item-slot.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.3);
}

.item-icon {
  width: 40px;
  height: 40px;
  background-image: url('../assets/img/items.png');
  background-repeat: no-repeat;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
}

.buff-icon {
  width: 32px;
  height: 32px;
  background-image: url('../assets/img/buffs.png');
  background-repeat: no-repeat;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
}

.slot-count {
  position: absolute;
  bottom: 1px;
  right: 2px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
  line-height: 1;
  pointer-events: none;
}

.slot-fav-star {
  position: absolute;
  top: 1px;
  left: 2px;
  font-size: 9px;
  color: #fbbf24;
  text-shadow: 0 0 2px #000;
  pointer-events: none;
}

/* Character Avatar Preview */
.avatar-preview-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.avatar-canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border: 2px dashed rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  background: radial-gradient(circle, #1e293b 0%, #0f172a 100%);
}

/* Toggles & Checkboxes */
.toggle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 13px;
  cursor: pointer;
}

.toggle-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Modal & Drawer */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal-sheet {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

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

.modal-body {
  padding: 16px;
  overflow-y: auto;
}

.modal-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Search results in modal */
.search-results-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  margin-top: 10px;
}

.search-item-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.search-item-card:hover {
  border-color: var(--accent);
  background: var(--bg-surface-elevated);
}

.search-item-name {
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Tooltip / Hint styling */
.hint-text {
  font-size: 11px;
  color: var(--text-muted);
}

/* Badge tags */
.badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}
.badge-journey { background: #8b5cf6; color: #fff; }
.badge-classic { background: #3b82f6; color: #fff; }
.badge-medium { background: #f59e0b; color: #000; }
.badge-hardcore { background: #ef4444; color: #fff; }

/* App Footer */
.app-footer {
  text-align: center;
  padding: 28px 16px 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.app-footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.15s;
}

.app-footer a:hover {
  text-decoration: underline;
  color: #7dd3fc;
}

.app-footer .footer-subtext {
  font-size: 11px;
  opacity: 0.65;
  margin-top: 4px;
}

