/* ── Pravidla a schopnosti: CSS Styl ────────────────────────────────────────── */

/* Rozvržení panelu Pravidla */
.rules-container {
  display: flex;
  gap: 1.5rem;
  height: calc(100vh - var(--header-h) - var(--nav-h) - 2rem);
  overflow: hidden;
}

.rules-sidebar {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-y: auto;
  backdrop-filter: blur(10px);
}

.rules-sidebar h3 {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.rules-menu {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.rules-menu-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
}

.rules-menu-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border-color: var(--border);
}

.rules-menu-btn.active {
  background: var(--accent-grad);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 0 15px rgba(167, 139, 250, 0.2);
}

.rules-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  overflow-y: auto;
  backdrop-filter: blur(10px);
}

.rules-content h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.rules-section-title {
  font-family: 'Cinzel', serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
  margin: 1.5rem 0 0.75rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.rules-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Mřížka pro karty */
.rules-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.rules-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.1rem;
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: var(--transition);
}

.rules-card:hover {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(167, 139, 250, 0.15);
  transform: translateY(-2px);
}

.rules-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.rules-card-title {
  font-family: 'Cinzel', serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.rules-card-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Odznáčky a štítky */
.badge-domain {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  text-shadow: none;
}

.badge-domain.telo {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #f87171;
}

.badge-domain.duse {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: #60a5fa;
}

.badge-domain.vliv {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #34d399;
}

.badge-active {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.18rem 0.45rem;
  border-radius: 6px;
  text-transform: uppercase;
}

.badge-active.active {
  background: rgba(249, 115, 22, 0.08);
  border: 1px solid rgba(249, 115, 22, 0.25);
  color: #fb923c;
}

.badge-active.passive {
  background: rgba(167, 139, 250, 0.08);
  border: 1px solid rgba(167, 139, 250, 0.25);
  color: #c084fc;
}

.rules-card-text {
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text-dim);
  white-space: pre-wrap;
}

/* Prázdný stav a načítání */
.rules-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: var(--text-dim);
  font-size: 1.05rem;
  text-align: center;
  padding: 2rem;
}

.rules-empty-state span {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.7;
}

/* ── Integrace do postavy: Schopnosti a dovednosti ──────────────────────────────── */

.char-ability-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 0.5rem;
  transition: var(--transition);
  gap: 0.5rem;
}

.char-ability-item:hover {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(167, 139, 250, 0.12);
}

.char-ability-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.char-ability-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.clickable-header {
  cursor: pointer;
  user-select: none;
}

.char-ability-toggle-icon {
  display: inline-block;
  transition: transform 0.2s ease;
  color: var(--text-dim);
  font-size: 0.75rem;
  margin-right: 0.2rem;
}

.clickable-header.open .char-ability-toggle-icon {
  transform: rotate(90deg);
}

.char-ability-text-collapsible {
  transition: max-height 0.3s ease;
}

.char-ability-note-section {
  margin-top: 0.6rem;
  padding-top: 0.5rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.06);
}

.char-ability-note-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
  color: var(--text);
  transition: var(--transition);
}

.char-ability-note-input:focus {
  outline: none;
  border-color: rgba(167, 139, 250, 0.4);
  background: rgba(255, 255, 255, 0.04);
}

.char-ability-note-display {
  font-size: 0.85rem;
  color: var(--text-dim);
  padding: 0.1rem 0.2rem;
  font-style: italic;
  border-left: 2px solid rgba(167, 139, 250, 0.3);
  padding-left: 0.5rem;
}

.char-ability-name {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.char-ability-meta {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.char-ability-text {
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--text-dim);
  white-space: pre-wrap;
  margin-top: 0.2rem;
}

.btn-delete-ability {
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0.1rem 0.3rem;
  line-height: 1;
  transition: var(--transition);
}

.btn-delete-ability:hover {
  color: var(--danger, #ef4444);
}

.ability-empty {
  font-size: 0.9rem;
  color: var(--text-dim);
  font-style: italic;
  display: block;
  padding: 0.5rem 0;
}

/* Responzivní styl pro mobilní zobrazení */
@media (max-width: 768px) {
  .rules-container {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }

  .rules-sidebar {
    width: 100%;
    height: auto;
    flex-direction: row;
    overflow-x: auto;
    white-space: nowrap;
    padding: 0.5rem;
    gap: 0.5rem;
    scrollbar-width: none; /* Firefox */
  }

  .rules-sidebar::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
  }

  .rules-sidebar h3 {
    display: none; /* Skrýt nadpis v mobilním scroll baru */
  }

  .rules-menu {
    flex-direction: row;
    width: auto;
  }

  .rules-menu-btn {
    padding: 0.45rem 0.8rem;
    font-size: 0.85rem;
  }

  .rules-content {
    padding: 1rem;
    height: auto;
    overflow: visible;
  }

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