/* ===== CSS Variables ===== */
:root {
  --bg-primary: #0a0a14;
  --bg-secondary: #12121f;
  --bg-card: #161625;
  --bg-input: #1a1a2e;
  --bg-elevated: #1e1e32;
  --text-primary: #e8e8f0;
  --text-secondary: #8888a0;
  --accent: #e63946;
  --accent-hover: #ff4d5a;
  --accent-glow: rgba(230, 57, 70, 0.25);
  --accent-secondary: #5b9bd5;
  --accent-secondary-glow: rgba(91, 155, 213, 0.2);
  --border: #252540;
  --border-hover: #3a3a5c;
  --success: #2ecc71;
  --warning: #f39c12;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
  --glow-accent: 0 0 20px rgba(230, 57, 70, 0.15);
  --glow-blue: 0 0 20px rgba(91, 155, 213, 0.15);
  --radius: 14px;
  --radius-sm: 10px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Keyframe Animations ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

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

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

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

/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  background-image:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(230, 57, 70, 0.04) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 100%, rgba(91, 155, 213, 0.03) 0%, transparent 50%);
}

/* ===== Header ===== */
header {
  background: rgba(18, 18, 31, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  animation: slideDown 0.4s ease;
}

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

header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), #ff6b6b, var(--accent-secondary));
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 6s ease infinite;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* ===== Buttons ===== */
.btn {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent-secondary);
  background: var(--bg-secondary);
}

.btn-small {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-small:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.btn-danger {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
}

/* ===== Auth Area ===== */
#auth-area, #user-area {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.user-display {
  color: var(--accent-secondary);
  font-weight: 600;
  font-size: 0.9rem;
}

.auth-error {
  color: var(--accent);
  font-size: 0.85rem;
  margin-bottom: 0.8rem;
  padding: 0.5rem;
  background: rgba(230, 57, 70, 0.1);
  border-radius: var(--radius-sm);
}

.btn-danger:hover {
  background: var(--accent);
  color: white;
}

/* ===== Main ===== */
main {
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  width: 100%;
  display: flex;
  gap: 2rem;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: 2rem;
  align-self: flex-start;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 0.75rem;
  border: 1px solid var(--border);
  animation: fadeInUp 0.4s ease 0.1s backwards;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  width: 100%;
}

.sidebar-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.sidebar-item.active {
  background: rgba(230, 57, 70, 0.12);
  color: var(--accent);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-icon {
  font-size: 1.1rem;
  width: 1.5rem;
  text-align: center;
}

/* ===== Sidebar Search ===== */
.sidebar-search {
  margin-bottom: 0.75rem;
}

.sidebar-search input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color var(--transition);
}

.sidebar-search input:focus {
  outline: none;
  border-color: var(--accent-secondary);
  box-shadow: 0 0 0 3px var(--accent-secondary-glow);
}

.sidebar-search input::placeholder {
  color: var(--text-secondary);
}

/* ===== Import Modal ===== */
#import-text {
  width: 100%;
  padding: 0.8rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.85rem;
  resize: vertical;
  line-height: 1.5;
}

#import-text:focus {
  outline: none;
  border-color: var(--accent-secondary);
}

#import-text::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

/* ===== Teams Section ===== */
#teams-section {
  flex: 1;
  min-width: 0;
}

/* ===== Teams Grid ===== */
.teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.team-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  animation: fadeInUp 0.5s ease backwards;
}

.team-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
  opacity: 0;
  transition: opacity var(--transition);
}

.team-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), var(--glow-blue);
}

.team-card:hover::before {
  opacity: 1;
}

.team-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.8rem;
}

.team-card-header h3 {
  font-size: 1.1rem;
  color: var(--text-primary);
}

.team-card-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.team-card-pokemon {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.team-card-pokemon img {
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
  transition: all var(--transition);
}

.team-card-pokemon img:hover {
  transform: scale(1.25) translateY(-2px);
  filter: drop-shadow(0 4px 8px rgba(91, 155, 213, 0.3));
}

.team-card-actions {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  opacity: 0;
  transition: opacity var(--transition);
  display: flex;
  gap: 0.3rem;
}

.team-card:hover .team-card-actions {
  opacity: 1;
}

/* Favorite button on card */
.btn-fav {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  opacity: 0.5;
  line-height: 1;
}

.btn-fav:hover {
  opacity: 1;
  transform: scale(1.3);
  filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.5));
}

.btn-fav.favorited {
  opacity: 1;
  filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.3));
}

/* Always show fav button if favorited */
.team-card .btn-fav.favorited {
  opacity: 1;
}

/* ===== Modal ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 2rem;
  overflow-y: auto;
}

.modal.hidden {
  display: none;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 600px;
  position: relative;
  z-index: 1;
  margin-top: 2rem;
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-large {
  max-width: 900px;
}

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

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

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.8rem;
  cursor: pointer;
  padding: 0 0.3rem;
  line-height: 1;
  transition: color var(--transition);
}

.modal-close:hover {
  color: var(--accent);
}

/* ===== Forms ===== */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent-secondary);
  box-shadow: 0 0 0 3px var(--accent-secondary-glow);
}

/* ===== Team Suggestions ===== */
.team-suggestions {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.team-suggestions h4 {
  color: var(--accent-secondary);
  margin-bottom: 0.8rem;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.suggestion-card {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.7rem;
  cursor: pointer;
  transition: var(--transition);
  animation: fadeIn 0.3s ease both;
}

.suggestion-card:hover {
  border-color: var(--accent-secondary);
  box-shadow: 0 0 12px var(--accent-secondary-glow);
  transform: translateY(-2px);
}

.suggestion-card img {
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.suggestion-info {
  flex: 1;
  min-width: 0;
}

.suggestion-info strong {
  display: block;
  font-size: 0.85rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.suggestion-info .pokemon-types {
  margin: 0.2rem 0;
}

.suggestion-info .type-badge {
  font-size: 0.6rem;
  padding: 0.1rem 0.35rem;
}

.suggestion-reason {
  font-size: 0.7rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
  margin-top: 0.15rem;
}

.suggestion-reason-label {
  color: var(--text-muted);
}

.suggestion-reason .type-badge {
  font-size: 0.55rem;
  padding: 0.05rem 0.25rem;
}

.suggestion-loading {
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 0.5rem 0;
}

.form-actions {
  display: flex;
  gap: 0.8rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* ===== Pokémon Slots ===== */
.pokemon-slots {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1rem 0;
}

.pokemon-slot {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  position: relative;
  transition: border-color var(--transition);
  animation: fadeInUp 0.3s ease backwards;
}

.pokemon-slot:hover {
  border-color: var(--border-hover);
}

.pokemon-slot-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.pokemon-slot-number {
  background: var(--accent);
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.pokemon-search-wrapper {
  flex: 1;
  position: relative;
}

.pokemon-search-wrapper input {
  width: 100%;
  padding: 0.5rem 0.7rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
}

.pokemon-search-wrapper input:focus {
  outline: none;
  border-color: var(--accent-secondary);
}

.pokemon-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
  display: none;
}

.pokemon-suggestions.active {
  display: block;
}

.pokemon-suggestion {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.7rem;
  cursor: pointer;
  transition: background var(--transition);
}

.pokemon-suggestion:hover {
  background: var(--bg-secondary);
}

.pokemon-suggestion img {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
}

/* Item Autocomplete */
.item-input-wrapper {
  position: relative;
}

.item-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  max-height: 180px;
  overflow-y: auto;
  z-index: 10;
  display: none;
}

.item-suggestions.active {
  display: block;
}

.item-suggestion {
  padding: 0.45rem 0.7rem;
  cursor: pointer;
  transition: background var(--transition);
  font-size: 0.9rem;
}

.item-suggestion:hover,
.item-suggestion.selected {
  background: var(--bg-secondary);
}

.item-suggestion small {
  color: var(--text-secondary);
  margin-left: 0.3rem;
}

.pokemon-slot-preview {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.pokemon-slot-preview img {
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
}

.pokemon-slot-preview .pokemon-types {
  display: flex;
  gap: 0.3rem;
}

.pokemon-slot-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.pokemon-slot-details .form-group {
  margin-bottom: 0;
}

.pokemon-slot-details label {
  font-size: 0.75rem;
}

.pokemon-slot-details input,
.pokemon-slot-details select {
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
}

/* EV/IV Section */
.ev-iv-section {
  grid-column: 1 / -1;
}

.ev-iv-section label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ev-total {
  font-weight: 400;
  color: var(--text-secondary);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.4rem;
  margin-top: 0.3rem;
}

.stat-input {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.stat-input span {
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.stat-input input {
  width: 100%;
  text-align: center;
  padding: 0.3rem 0.2rem;
  font-size: 0.8rem;
  -moz-appearance: textfield;
}

.stat-input input::-webkit-outer-spin-button,
.stat-input input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.pokemon-slot-remove {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.2rem;
  line-height: 1;
  transition: color var(--transition);
}

.pokemon-slot-remove:hover {
  color: var(--accent);
}

/* ===== Type Badges ===== */
.type-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 5px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: white;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: all var(--transition);
}

.type-badge:hover {
  transform: scale(1.05);
  filter: brightness(1.15);
}

.type-normal { background: #a8a878; }
.type-fire { background: #f08030; }
.type-water { background: #6890f0; }
.type-electric { background: #f8d030; color: #333; }
.type-grass { background: #78c850; }
.type-ice { background: #98d8d8; color: #333; }
.type-fighting { background: #c03028; }
.type-poison { background: #a040a0; }
.type-ground { background: #e0c068; color: #333; }
.type-flying { background: #a890f0; }
.type-psychic { background: #f85888; }
.type-bug { background: #a8b820; }
.type-rock { background: #b8a038; }
.type-ghost { background: #705898; }
.type-dragon { background: #7038f8; }
.type-dark { background: #705848; }
.type-steel { background: #b8b8d0; color: #333; }
.type-fairy { background: #ee99ac; }

/* ===== Detail View ===== */
.detail-meta {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.detail-pokemon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

.detail-pokemon-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  text-align: center;
  transition: all var(--transition);
  animation: fadeInUp 0.4s ease backwards;
}

.detail-pokemon-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow);
}

.detail-pokemon-card img {
  width: 96px;
  height: 96px;
  transition: transform var(--transition-slow);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.detail-pokemon-card:hover img {
  transform: scale(1.08);
}

.detail-pokemon-card h4 {
  text-transform: capitalize;
  margin: 0.5rem 0 0.3rem;
}

.detail-pokemon-info {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-align: left;
  margin-top: 0.8rem;
}

.detail-pokemon-info p {
  padding: 0.2rem 0;
  border-bottom: 1px solid var(--border);
}

.detail-pokemon-info span {
  color: var(--text-primary);
  font-weight: 500;
}

.detail-actions {
  display: flex;
  gap: 0.8rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* ===== Comments ===== */
.comments-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.comments-section h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.comment-form {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.comment-form textarea {
  flex: 1;
  padding: 0.6rem 0.8rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
  min-height: 40px;
}

.comment-form textarea:focus {
  outline: none;
  border-color: var(--accent-secondary);
}

.comment-form textarea::placeholder {
  color: var(--text-secondary);
}

.comment-form .btn {
  align-self: flex-end;
  white-space: nowrap;
}

.comment {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  margin-bottom: 0.6rem;
  transition: border-color var(--transition);
  animation: fadeInUp 0.3s ease backwards;
}

.comment:hover {
  border-color: var(--border-hover);
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
  font-size: 0.8rem;
}

.comment-author {
  font-weight: 600;
  color: var(--accent-secondary);
  cursor: pointer;
}

.comment-author:hover {
  text-decoration: underline;
  color: var(--accent);
}

.comment-date {
  color: var(--text-secondary);
}

.comment-delete {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 0.3rem;
  line-height: 1;
  opacity: 0.5;
  transition: var(--transition);
}

.comment-delete:hover {
  color: var(--accent);
  opacity: 1;
}

.comment-text {
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.no-comments {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-style: italic;
}

.loading-small {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* ===== States ===== */
.loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary);
  animation: pulse 1.5s ease infinite;
}

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-secondary);
  animation: fadeIn 0.5s ease;
}

.empty-state p {
  font-size: 1.1rem;
}

.hidden {
  display: none !important;
}

/* ===== Profile ===== */
.profile-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.profile-info h3 {
  font-size: 1.4rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.profile-info .profile-joined {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.profile-stat {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  text-align: center;
  transition: all var(--transition);
}

.profile-stat:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.profile-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  display: block;
  transition: color var(--transition);
}

.profile-stat:hover .profile-stat-value {
  color: var(--accent-hover);
}
}

.profile-stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  display: block;
}

.profile-teams-title {
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.profile-teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.profile-team-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  cursor: pointer;
  transition: var(--transition);
}

.profile-team-card:hover {
  border-color: var(--accent-secondary);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.profile-team-card h4 {
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}

.profile-team-card .meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.profile-team-card .sprites {
  display: flex;
  gap: 0.3rem;
  margin-top: 0.5rem;
}

.profile-team-card .sprites img {
  width: 36px;
  height: 36px;
  image-rendering: pixelated;
}

/* Author link in team cards/detail */
.author-link {
  color: var(--accent-secondary);
  cursor: pointer;
  text-decoration: none;
}

.author-link:hover {
  text-decoration: underline;
  color: var(--accent);
}

/* ===== Footer ===== */
footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-secondary);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
  background: rgba(18, 18, 31, 0.5);
}

footer a {
  color: var(--accent-secondary);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  header {
    padding: 0.8rem 1rem;
  }

  header h1 {
    font-size: 1.1rem;
  }

  main {
    padding: 1rem;
    flex-direction: column;
    gap: 1rem;
  }

  .sidebar {
    width: 100%;
    position: static;
  }

  .sidebar-nav {
    flex-direction: row;
    overflow-x: auto;
    padding: 0.5rem;
    gap: 0.25rem;
  }

  .sidebar-item {
    white-space: nowrap;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
  }

  .teams-grid {
    grid-template-columns: 1fr;
  }

  .modal-content {
    padding: 1.2rem;
    margin-top: 1rem;
  }

  .modal {
    padding: 0.5rem;
  }

  .pokemon-slot-details {
    grid-template-columns: 1fr;
  }

  .stat-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .detail-pokemon-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Move Info (Builder) ===== */
.move-info {
  min-height: 1.2rem;
  margin-top: 0.2rem;
  font-size: 0.75rem;
}

.move-detail-info {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-secondary);
}

.move-detail-info .type-badge {
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
}

/* ===== Detail View: Move Badges ===== */
.detail-moves {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.3rem;
  margin-bottom: 0.3rem;
}

.move-detail-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.75rem;
}

.move-detail-badge .type-badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
}

.detail-pokemon-types {
  display: flex;
  justify-content: center;
  gap: 0.3rem;
  margin-bottom: 0.3rem;
}

/* ===== Move Effects ===== */
.move-effects {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.2rem;
}

.move-effect-tag {
  display: inline-block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  font-size: 0.7rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ===== Type Coverage Section ===== */
.type-coverage-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
  margin-top: 1.5rem;
  animation: fadeInUp 0.4s ease 0.2s backwards;
}

.type-coverage-section h3 {
  margin-bottom: 0.8rem;
  font-size: 1rem;
}

.coverage-row {
  margin-bottom: 0.6rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
}

.coverage-row strong {
  margin-right: 0.3rem;
  white-space: nowrap;
}

.coverage-warning {
  color: var(--warning);
}

.weakness-count {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.75rem;
  margin-right: 0.3rem;
}

/* ===== Team Suggestions ===== */
.team-suggestions {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
  margin-top: 1rem;
}

.team-suggestions h3 {
  margin-bottom: 0.6rem;
  font-size: 1rem;
}

.suggestion-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
}

.suggestion-item:last-child {
  border-bottom: none;
}

/* ===== Sidebar Divider ===== */
.sidebar-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.5rem 0.8rem;
}

/* ===== Damage Calculator ===== */
.calc-container {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1.5rem;
  align-items: start;
}

.calc-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.2rem;
  animation: fadeInUp 0.4s ease both;
}

.calc-panel:nth-child(3) {
  animation-delay: 0.1s;
}

.calc-panel h3 {
  color: var(--accent-secondary);
  margin-bottom: 1rem;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.calc-search-wrapper {
  position: relative;
  margin-bottom: 0.8rem;
}

.calc-pokemon-search {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: var(--transition);
}

.calc-pokemon-search:focus {
  border-color: var(--accent-secondary);
  box-shadow: 0 0 8px var(--accent-secondary-glow);
  outline: none;
}

.calc-search-wrapper .pokemon-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 10;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
  display: none;
  padding: 0.4rem 0.6rem;
}

.calc-search-wrapper .pokemon-suggestions.active {
  display: block;
}

.calc-search-wrapper .suggestion-item {
  cursor: pointer;
  padding: 0.5rem 0.3rem;
  border-radius: 4px;
  transition: var(--transition);
}

.calc-search-wrapper .suggestion-item:hover {
  background: var(--bg-card);
  color: var(--accent-secondary);
}

.calc-preview {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem;
  background: var(--bg-elevated);
  border-radius: 10px;
  margin-bottom: 1rem;
  animation: scaleIn 0.3s ease both;
}

.calc-preview img {
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
}

.calc-preview strong {
  font-size: 1rem;
  color: var(--text-primary);
}

.calc-fields .form-group {
  margin-bottom: 0.8rem;
}

.calc-fields label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.2rem;
  display: block;
}

.calc-fields select,
.calc-fields input[type="number"],
.calc-fields input[type="text"] {
  width: 100%;
  padding: 0.45rem 0.6rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.85rem;
}

.calc-fields select:focus,
.calc-fields input:focus {
  border-color: var(--accent-secondary);
  outline: none;
}

/* Calculator Result Column */
.calc-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding-top: 3rem;
  min-width: 160px;
}

.calc-btn {
  font-size: 1rem;
  padding: 0.8rem 1.5rem;
  border-radius: 10px;
  white-space: nowrap;
}

.calc-output {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  width: 100%;
  animation: scaleIn 0.3s ease both;
  text-align: center;
}

.calc-damage-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 0.8rem;
}

.calc-damage-range {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.calc-damage-pct {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.calc-ko {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  margin-top: 0.2rem;
}

.calc-bar-wrapper {
  height: 8px;
  background: var(--bg-secondary);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.8rem;
}

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

.calc-bar-green { background: #4caf50; }
.calc-bar-orange { background: #ff9800; }
.calc-bar-red { background: var(--accent); }

.calc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.calc-tag {
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  background: var(--bg-elevated);
  border-radius: 4px;
  color: var(--text-secondary);
}

.calc-eff {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
}

.calc-super { background: rgba(76, 175, 80, 0.2); color: #4caf50; }
.calc-resist { background: rgba(255, 152, 0, 0.2); color: #ff9800; }
.calc-immune { background: rgba(158, 158, 158, 0.2); color: #9e9e9e; }

.calc-stat-line {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* Field Conditions */
.calc-field-conditions {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem;
  margin-bottom: 1rem;
  width: 100%;
}

.calc-field-conditions h4 {
  color: var(--accent-secondary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.7rem;
}

.calc-field-conditions .form-group {
  margin-bottom: 0.6rem;
}

.calc-field-conditions label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.2rem;
  display: block;
}

.calc-field-conditions select {
  width: 100%;
  padding: 0.35rem 0.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.8rem;
}

.calc-field-conditions select:focus {
  border-color: var(--accent-secondary);
  outline: none;
}

.calc-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.calc-check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-primary);
  cursor: pointer;
}

.calc-check input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent-secondary);
  cursor: pointer;
}

.calc-mod-tags {
  margin-top: 0.3rem;
  border-top: 1px solid var(--border);
  padding-top: 0.4rem;
}

.calc-mod-tag {
  background: rgba(91, 155, 213, 0.15);
  color: var(--accent-secondary);
  border: 1px solid rgba(91, 155, 213, 0.3);
}

/* Calculator responsive */
@media (max-width: 900px) {
  .calc-container {
    grid-template-columns: 1fr;
  }
  .calc-result {
    padding-top: 0;
    order: 3;
  }
  .calc-panel:nth-child(3) {
    order: 2;
  }
}
