/**
 * MORDHEIM CAMPAIGN THEME - UNIFIED
 * Einheitliches Design-System fÃƒÆ’Ã‚Â¼r ALLE Seiten
 * Version 3.0 - Streamlined mit Pulse Animationen
 */

/* ============================================
   GOOGLE FONTS IMPORT
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Lato:wght@400;700&display=swap');

/* ============================================
   CSS CUSTOM PROPERTIES (DESIGN TOKENS)
   ============================================ */
:root {
  /* Hintergrundfarben */
  --bg-body: #1a1a1a;
  --bg-primary: #1a1a1a;
  --bg-secondary: #242424;
  --bg-card: #2d2d2d;
  --bg-card-header: #333333;
  --bg-card-hover: #3a3a3a;
  --bg-input: #1f1f1f;

  /* Textfarben */
  --text-primary: #e0e0e0;
  --text-secondary: #b0b0b0;
  --text-muted: #888888;
  --text-dark: #1a1a1a;

  /* Akzentfarben */
  --color-blood: #8b0000;
  --color-blood-light: #a52a2a;
  --color-blood-dark: #5c0000;
  --color-gold: #c9a959;
  --color-gold-light: #d4bc7a;
  --color-gold-dark: #9a7b3a;

  /* Funktionale Farben */
  --color-success: #2e7d32;
  --color-success-light: #4caf50;
  --color-warning: #f9a825;
  --color-error: #c62828;
  --color-info: #2980b9;

  /* Borders */
  --border-color: #444444;
  --border-light: #555555;
  --border-accent: var(--color-blood);

  /* Schatten */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-glow-gold: 0 0 15px rgba(201, 169, 89, 0.3);
  --shadow-glow-blood: 0 0 15px rgba(139, 0, 0, 0.3);

  /* Typografie */
  --font-display: 'Cinzel', 'Times New Roman', serif;
  --font-body: 'Lato', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-gothic: 'Cinzel', serif;

  /* GrÃƒÆ’Ã‚Â¶ÃƒÆ’Ã…Â¸en */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* ÃƒÆ’Ã…â€œbergÃƒÆ’Ã‚Â¤nge */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;

  /* AbstÃƒÆ’Ã‚Â¤nde */
  --spacing-xs: 5px;
  --spacing-sm: 10px;
  --spacing-md: 20px;
  --spacing-lg: 30px;
  --spacing-xl: 50px;
}

/* ============================================
   KEYFRAME ANIMATIONS
   ============================================ */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse-gold {
  0%, 100% {
    box-shadow: 0 0 5px rgba(201, 169, 89, 0.4);
    border-color: var(--color-gold);
  }
  50% {
    box-shadow: 0 0 20px rgba(201, 169, 89, 0.8), 0 0 30px rgba(201, 169, 89, 0.4);
    border-color: var(--color-gold-light);
  }
}

@keyframes pulse-success {
  0%, 100% {
    box-shadow: 0 0 5px rgba(46, 125, 50, 0.4);
    border-color: var(--color-success);
  }
  50% {
    box-shadow: 0 0 20px rgba(46, 125, 50, 0.8), 0 0 30px rgba(46, 125, 50, 0.4);
    border-color: var(--color-success-light);
  }
}

@keyframes pulse-warning {
  0%, 100% {
    box-shadow: 0 0 5px rgba(249, 168, 37, 0.4);
    border-color: var(--color-warning);
  }
  50% {
    box-shadow: 0 0 20px rgba(249, 168, 37, 0.8), 0 0 30px rgba(249, 168, 37, 0.4);
    border-color: #ffc107;
  }
}

@keyframes pulse-badge {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 5px rgba(201, 169, 89, 0.4);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(201, 169, 89, 0.8);
  }
}

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

@keyframes glow-border {
  0%, 100% { border-color: var(--color-gold); }
  50% { border-color: var(--color-gold-light); }
}

/* ============================================
   RESET & BASE STYLES
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-body);
  min-height: 100vh;
  padding: 20px;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
.title-gothic {
  font-family: var(--font-gothic);
  font-weight: normal;
  color: var(--color-gold);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

h1, h2, h3, .title-display {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--color-gold);
  line-height: 1.3;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

p, li, td, th, label, input, select, textarea {
  font-family: var(--font-body);
}

a {
  color: var(--color-gold);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-gold-light);
  text-decoration: underline;
}

/* ============================================
   LAYOUT CONTAINERS
   ============================================ */
.container {
  max-width: 1600px;
  margin: 0 auto;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.container-narrow {
  max-width: 1000px;
  margin: 0 auto;
  padding: var(--spacing-md);
}

/* ============================================
   HEADER
   ============================================ */
.site-header,
header {
  background: linear-gradient(135deg, var(--color-blood) 0%, var(--color-blood-dark) 100%);
  padding: var(--spacing-lg);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  text-align: center;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.site-header h1,
header h1 {
  font-size: 2rem;
  margin: 0;
  color: var(--color-gold);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.site-header .subtitle,
header .subtitle {
  color: #ffefba;
  font-size: 1.1rem;
  font-weight: 400;
}

.site-header .logo,
header .logo {
  max-width: 300px;
  height: auto;
  margin-bottom: var(--spacing-md);
}

/* ============================================
   FILE STATUS
   ============================================ */
.file-status {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-md);
  font-size: 0.9rem;
}

.file-status .status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.file-status .last-sync {
  margin-left: auto;
  opacity: 0.7;
  font-size: 0.85em;
}

.status-connected,
.file-status.status-connected {
  background: rgba(46, 125, 50, 0.15);
  border: 1px solid var(--color-success);
  color: #81c784;
}

.status-connected .status-dot {
  background: var(--color-success);
  box-shadow: 0 0 8px var(--color-success);
}

.status-disconnected,
.file-status.status-disconnected {
  background: rgba(198, 40, 40, 0.15);
  border: 1px solid var(--color-error);
  color: #ef9a9a;
}

.status-disconnected .status-dot {
  background: var(--color-error);
  box-shadow: 0 0 8px var(--color-error);
}

/* ============================================
   NAVIGATION & TABS
   ============================================ */
.nav-tabs {
  display: flex;
  gap: var(--spacing-sm);
  justify-content: center;
  margin-bottom: var(--spacing-lg);
  padding: var(--spacing-md);
  flex-wrap: wrap;
}

.nav-tab {
  padding: 12px 24px;
  background: rgba(139, 0, 0, 0.2);
  border: 2px solid var(--color-blood);
  border-radius: var(--radius-md);
  color: var(--color-gold);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition-normal);
  text-decoration: none;
}

.nav-tab:hover {
  background: rgba(139, 0, 0, 0.4);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.nav-tab.active {
  background: var(--color-blood);
  color: var(--color-gold-light);
  box-shadow: var(--shadow-glow-blood);
}

/* Admin Tabs */
.tabs {
  display: flex;
  background: var(--bg-card);
  border-bottom: 2px solid var(--border-color);
  padding: 0 30px;
  gap: 10px;
}

.tab-btn {
  background: transparent;
  border: none;
  padding: 12px 20px;
  cursor: pointer;
  font-size: 1em;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}

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

.tab-btn.active {
  color: #ff6b6b;
  border-bottom-color: var(--color-blood);
}

/* ============================================
   ADMIN SECTIONS
   ============================================ */
.admin-section {
  display: none;
  padding: 25px 30px;
}

.admin-section.active {
  display: block;
}

.section-title {
  font-size: 1.8em;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 3px solid var(--color-blood);
  padding-bottom: 10px;
  margin: 30px 0 25px 0;
}

/* ============================================
   EDITOR TOOLBAR
   ============================================ */
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  align-items: center;
  margin-bottom: 20px;
  padding: 15px 20px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.editor-toolbar select {
  flex: 1;
  min-width: 250px;
  padding: 10px 14px;
  font-size: 1em;
  font-weight: 600;
  border: 2px solid var(--color-blood);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text-primary);
  cursor: pointer;
}

.editor-toolbar select:hover {
  border-color: var(--color-blood-light);
}

.editor-toolbar select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(139, 0, 0, 0.2);
}

.editor-toolbar .btn {
  padding: 10px 20px;
  white-space: nowrap;
}

/* ============================================
   WARBAND HEADER INFO
   ============================================ */
.warband-header-info,
.warband-info {
  background: var(--bg-card);
  padding: 15px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.warband-header-info .form-row {
  margin-bottom: 0;
}

.warband-header-info .form-row,
.warband-info .form-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  align-items: end;
}

.rating-display {
  font-size: 1.4em;
  font-weight: 700;
  color: var(--color-gold);
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  text-align: center;
}

/* ============================================
   FORMS
   ============================================ */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
  align-items: start;
}

.form-group {
  margin-bottom: var(--spacing-md);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

input,
select,
textarea,
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-primary) !important;
  background: var(--bg-input) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  background-color: var(--bg-input) !important;
  padding-right: 36px;
  cursor: pointer;
}

select option {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
}

input:focus,
select:focus,
textarea:focus,
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-gold) !important;
  box-shadow: 0 0 0 2px rgba(201, 169, 89, 0.2);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted) !important;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-normal);
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.85em;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1.1em;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--color-blood-dark);
}

.btn-success {
  background: var(--color-success);
  color: white;
  border-color: var(--color-success);
}

.btn-success:hover:not(:disabled) {
  background: var(--color-success-light);
}

.btn-secondary {
  background: #555;
  color: white;
  border-color: #555;
  padding: 8px 16px;
  font-size: 0.9em;
}

.btn-secondary:hover:not(:disabled) {
  background: #666;
}

.btn-danger {
  background: var(--color-error);
  color: white;
  border-color: var(--color-error);
  padding: 8px 16px;
  font-size: 0.9em;
}

.btn-danger:hover:not(:disabled) {
  background: #d32f2f;
}

.btn-gold {
  background: rgba(201, 169, 89, 0.2);
  color: var(--color-gold);
  border-color: var(--color-gold);
}

.btn-gold:hover:not(:disabled) {
  background: rgba(201, 169, 89, 0.3);
}

.btn-warning {
  background: var(--color-warning);
  color: #000;
  border-color: var(--color-warning);
}

.btn-warning:hover:not(:disabled) {
  background: #ffc107;
}

/* ============================================
   CARDS GRID
   ============================================ */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

@media (min-width: 1200px) {
  .cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ============================================
   UNIT CARDS
   ============================================ */
.unit-card {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.unit-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--border-light);
}

.unit-card.edit-mode {
  border-color: var(--color-gold);
  box-shadow: 0 0 20px rgba(201, 169, 89, 0.3);
}

.unit-card.dragging {
  opacity: 0.5;
  transform: scale(0.98);
  cursor: grabbing;
}

.unit-card.drag-over {
  border: 2px dashed var(--color-blood);
  background: rgba(139, 0, 0, 0.1);
}

/* Pending Upgrade Card State */
.unit-card.has-pending-upgrade {
  border-color: var(--color-gold);
  animation: pulse-gold 2s ease-in-out infinite;
}

/* Veteran Ready Card State */
.unit-card.veteran-ready {
  border-color: var(--color-success);
}

.veteran-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--color-success);
  color: white;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75em;
  font-weight: 700;
  z-index: 5;
}

/* ============================================
   INTEGRATED UPGRADE BANNER (NEU!)
   ============================================ */
.upgrade-banner-integrated {
  background: linear-gradient(135deg, rgba(201, 169, 89, 0.2) 0%, rgba(201, 169, 89, 0.1) 100%);
  border-bottom: 2px solid var(--color-gold);
  padding: 12px 15px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  animation: shimmer 3s ease-in-out infinite;
  background-size: 200% 100%;
  background-image: linear-gradient(
    90deg,
    rgba(201, 169, 89, 0.1) 0%,
    rgba(201, 169, 89, 0.3) 50%,
    rgba(201, 169, 89, 0.1) 100%
  );
}

.ubi-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ubi-icon {
  font-size: 1.3em;
  animation: pulse-badge 1.5s ease-in-out infinite;
}

.ubi-text {
  font-weight: 700;
  color: var(--color-gold);
  font-size: 0.95em;
}

.ubi-actions {
  display: flex;
  gap: 8px;
}

.ubi-actions .btn {
  padding: 5px 12px;
  font-size: 0.8em;
}

/* ============================================
   CARD HEADER
   ============================================ */
.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 15px;
  background: var(--bg-card-header);
  border-bottom: 1px solid var(--border-color);
  gap: 12px;
}

.card-title-editable {
  flex: 1;
  min-width: 0;
}

.unit-card .title-display {
  font-family: var(--font-display);
  font-size: 1.1em;
  font-weight: 700;
  color: var(--color-gold);
  line-height: 1.2;
  margin-bottom: 2px;
  word-wrap: break-word;
  cursor: text;
}

.subtitle-display {
  color: var(--text-muted);
  font-size: 0.85em;
  line-height: 1.2;
  cursor: text;
}

.title-input-large {
  font-size: 1.1em;
  font-weight: 700;
  color: var(--text-primary);
  border: 2px solid var(--color-gold);
  background: var(--bg-input);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  width: 100%;
  margin-bottom: 4px;
}

.subtitle-input-large {
  font-size: 0.85em;
  color: var(--text-secondary);
  border: 2px solid var(--color-gold);
  background: var(--bg-input);
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  width: 100%;
}

/* ============================================
   CARD STATS COLUMN & BADGES
   ============================================ */
.card-stats-column {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.card-badge {
  background: var(--color-blood);
  color: white;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85em;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.card-badge:hover {
  background: var(--color-blood-light);
  transform: scale(1.05);
}

/* Pulsierendes Badge bei Pending Upgrade */
.card-badge.badge-pulse {
  background: linear-gradient(135deg, var(--color-gold-dark) 0%, var(--color-gold) 100%);
  animation: pulse-badge 1.5s ease-in-out infinite;
}

.badge-upgrade-icon {
  margin-left: 5px;
  font-size: 0.9em;
}

.card-cost {
  font-size: 0.8em;
  color: var(--text-muted);
  white-space: nowrap;
}

.next-level-info {
  font-size: 0.7em;
  color: var(--color-gold);
  opacity: 0.8;
}

/* ============================================
   STATS ROW
   ============================================ */
.stats-compact {
  padding: 10px 15px;
  background: rgba(0,0,0,0.2);
  border-bottom: 1px solid var(--border-color);
}

.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.stat-chip {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  font-size: 0.8em;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.stat-chip:hover {
  background: var(--bg-card-hover);
  border-color: var(--color-gold);
}

.stat-chip.buffed {
  background: rgba(46, 125, 50, 0.3);
  color: #81c784;
  border-color: var(--color-success);
  font-weight: 700;
}

.stat-chip.nerfed {
  background: rgba(198, 40, 40, 0.3);
  color: #ef9a9a;
  border-color: var(--color-error);
  font-weight: 700;
}

.stat-chip.armor {
  background: rgba(25, 118, 210, 0.3);
  color: #90caf9;
  border-color: #1976d2;
  font-weight: 700;
}

/* ============================================
   CARD BODY
   ============================================ */
.card-body-content,
.unit-card .form-group {
  padding: 10px 15px;
}

.unit-card .form-group {
  margin-bottom: 0;
}

.unit-card .form-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.equipment-display,
.skills-display {
  padding: 8px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-secondary);
  min-height: 36px;
  font-size: 0.9em;
  line-height: 1.4;
  cursor: text;
  transition: all 0.2s;
}

.skills-display {
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.85em;
}

/* ============================================
   XP SYSTEM
   ============================================ */
.xp-section {
  background: var(--bg-secondary);
  padding: 12px 15px;
  margin: 0;
}

.xp-section h4 {
  color: var(--text-secondary);
  margin: 0 0 8px 0;
  font-size: 0.85em;
  font-weight: 600;
}

.xp-track {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.xp-dot {
  width: 11px;
  height: 11px;
  border: 1px solid var(--border-color);
  border-radius: 2px;
  background: transparent;
}

.xp-dot.filled {
  background: var(--color-blood);
  border-color: var(--color-blood-light);
}

.xp-dot.levelup {
  width: 13px;
  height: 13px;
  border: 2px solid var(--color-gold);
}

.xp-dot.levelup.filled {
  background: var(--color-gold);
}

/* ============================================
   CARD ACTIONS
   ============================================ */
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 15px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

.card-actions .btn {
  padding: 6px 12px;
  font-size: 0.8em;
}

.edit-btn-inline {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8em;
  transition: all var(--transition-fast);
}

.edit-btn-inline:hover {
  border-color: var(--color-gold);
  color: var(--color-gold);
}

/* ============================================
   COUNT CONTROL (Henchmen)
   ============================================ */
.count-control {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  background: rgba(0,0,0,0.2);
  border-radius: var(--radius-md);
}

.count-control .btn {
  padding: 4px 10px;
  font-size: 0.9em;
  min-width: auto;
}

.count-display {
  font-size: 1.2em;
  font-weight: 700;
  color: var(--color-gold);
  min-width: 40px;
  text-align: center;
}

.henchman-member {
  padding: 6px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  font-size: 0.9em;
  color: var(--text-secondary);
}

.promote-section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-color);
}

/* ============================================
   STORED EQUIPMENT & NOTES SECTIONS
   ============================================ */
.stored-equipment-section,
.warband-notes-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  overflow: hidden;
}

.ses-header,
.wns-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  background: var(--bg-card-header);
  cursor: pointer;
  transition: background 0.2s;
}

.ses-header:hover,
.wns-header:hover {
  background: var(--bg-card-hover);
}

.ses-header h3,
.wns-header h3 {
  margin: 0;
  font-size: 1em;
  color: var(--text-primary);
}

.ses-count {
  color: var(--text-muted);
  font-weight: normal;
}

.ses-toggle,
.wns-toggle {
  color: var(--text-muted);
  font-size: 0.9em;
}

.ses-content,
.wns-content {
  padding: 15px;
  border-top: 1px solid var(--border-color);
}

.stored-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 15px;
}

.stored-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.si-name {
  flex: 1;
  font-weight: 600;
  color: var(--text-primary);
}

.si-source {
  font-size: 0.8em;
  color: var(--text-muted);
}

.add-stored-item {
  display: flex;
  gap: 10px;
}

.add-stored-item .form-input {
  flex: 1;
}

.notes-textarea {
  min-height: 120px;
  resize: vertical;
}

/* ============================================
   XP MODAL
   ============================================ */
.xp-modal {
  max-width: 400px;
}

.xp-modal-info {
  display: flex;
  justify-content: space-around;
  gap: 15px;
  margin-bottom: 20px;
  padding: 15px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
}

.xp-modal-stat {
  text-align: center;
}

.xm-label {
  display: block;
  font-size: 0.8em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.xm-value {
  font-size: 1.3em;
  font-weight: 700;
  color: var(--color-gold);
}

.xp-modal-input {
  margin-bottom: 15px;
}

.xp-modal-input label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-secondary);
}

.xp-input-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.xp-input-controls input {
  flex: 1;
  text-align: center;
  font-size: 1.2em;
  font-weight: 700;
}

.xp-modal-preview {
  padding: 10px;
  background: rgba(201, 169, 89, 0.1);
  border: 1px solid var(--color-gold);
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  text-align: center;
}

.preview-info {
  color: var(--color-gold);
  font-size: 0.9em;
}

.xp-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ============================================
   BATTLE MODAL OVERLAY
   ============================================ */
.battle-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  padding: 20px;
}

.battle-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.battle-modal {
  background: var(--bg-card);
  border: 2px solid var(--color-blood);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.battle-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: var(--color-blood);
  color: white;
}

.battle-modal-header h2 {
  margin: 0;
  font-size: 1.2em;
  color: white;
}

.modal-close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 1.5em;
  cursor: pointer;
  padding: 0 5px;
  line-height: 1;
  opacity: 0.8;
  transition: opacity 0.2s;
}

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

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

/* ============================================
   ADD BUTTONS
   ============================================ */
.add-btn {
  background: var(--color-success);
  color: white;
  border: none;
  padding: 15px 20px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 600;
  font-size: 1em;
  text-align: center;
  transition: all 0.2s;
  margin: 15px 0;
  display: block;
  width: 100%;
}

.add-btn:hover {
  background: var(--color-success-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ============================================
   SAVE INDICATOR
   ============================================ */
.save-indicator {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: var(--color-success);
  color: white;
  padding: 15px 25px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-weight: 600;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s;
  pointer-events: none;
  z-index: 9999;
}

.save-indicator.show {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   ERROR & EMPTY STATES
   ============================================ */
.error-message {
  background: rgba(198, 40, 40, 0.2);
  border: 2px solid var(--color-error);
  color: #ef9a9a;
  padding: 20px;
  border-radius: var(--radius-md);
  margin: 20px;
  text-align: center;
}

.empty-state {
  text-align: center;
  padding: var(--spacing-lg) var(--spacing-md);
  color: var(--text-muted);
  font-style: italic;
}

/* ============================================
   LOADING OVERLAY
   ============================================ */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  color: var(--color-gold);
}

.loading-overlay.hidden {
  display: none;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--border-color);
  border-top-color: var(--color-gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: var(--spacing-md);
}

/* ============================================
   MANAGEMENT LIST
   ============================================ */
.management-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  margin-bottom: 20px;
}

.management-list .list-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

.management-list .list-item:hover {
  border-color: var(--color-blood);
  background: var(--bg-card-hover);
}

.list-item-info {
  flex: 1;
  min-width: 200px;
}

.list-item-name {
  font-weight: 700;
  font-size: 1.1em;
  color: var(--color-gold);
  margin-bottom: 4px;
}

.list-item-actions {
  display: flex;
  gap: 10px;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-gold { color: var(--color-gold); }
.text-blood { color: var(--color-blood); }
.text-muted { color: var(--text-muted); }

.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; justify-content: center; align-items: center; }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }

.hidden { display: none !important; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  body { padding: 10px; }

  :root {
    --spacing-lg: 20px;
    --spacing-xl: 30px;
  }

  .container { border-radius: 0; }

  .site-header, header {
    padding: 20px;
    border-radius: 0;
  }

  .tabs {
    padding: 0 15px;
    flex-wrap: wrap;
  }

  .tab-btn {
    padding: 12px 15px;
    font-size: 0.95em;
  }

  .admin-section { padding: 15px; }

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

  .form-row { grid-template-columns: 1fr; }

  .card-actions { flex-direction: column; }
  .card-actions .btn,
  .card-actions .edit-btn-inline { width: 100%; }

  .upgrade-banner-integrated {
    flex-direction: column;
    text-align: center;
  }

  .ubi-actions {
    width: 100%;
    justify-content: center;
  }

  .save-indicator {
    bottom: 15px;
    right: 15px;
    left: 15px;
    text-align: center;
  }

  .xp-modal-info {
    flex-direction: column;
    gap: 10px;
  }

  .nav-tabs {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-tab {
    text-align: center;
  }
}
