:root {
  --bg-color: #0b0616; 
  --card-bg: #140b26; 
  --text-main: #f5f0fc; 
  --text-muted: #b8a2d8; 
  --accent-purple: #a855f7;
  --accent-pink: #a855f7; /* Compatibility alias for existing classes */
  --accent-yellow: #fbbf24; /* Mystic gold from crown and sword */
  --border-color: #2e174f;
  --border-glow: rgba(168, 85, 247, 0.35);
  --border-gold: rgba(251, 191, 36, 0.45);
  --green-done: rgba(16, 185, 129, 0.16); 
  --green-text: #34d399;
  
  --warrior: #fb923c; 
  --archer: #34d399;  
  --mage: #c084fc;    
  --master: #fbbf24;  
  --jewelry: #f472b6; 
}

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

body {
  background: var(--bg-color);
  background-image: 
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(139, 92, 246, 0.28), transparent 70%),
    radial-gradient(circle at 10% 30%, rgba(251, 191, 36, 0.07), transparent 30%),
    radial-gradient(circle at 90% 70%, rgba(168, 85, 247, 0.08), transparent 40%),
    radial-gradient(rgba(168, 85, 247, 0.18) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 100% 100%, 36px 36px;
  background-attachment: fixed;
  color: var(--text-main);
  font-family: 'Nunito', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

.wrap { position: relative; z-index: 1; max-width: 1150px; margin: 0 auto; padding: 0 20px 60px; }

/* LANG SWITCHER */
.lang-switcher {
  position: absolute; top: 72px; right: 20px; display: flex; gap: 10px;
  background: rgba(20, 11, 38, 0.9); backdrop-filter: blur(8px);
  padding: 8px 12px; border-radius: 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5); border: 1.5px solid var(--border-color); z-index: 100;
}
.lang-btn { font-size: 24px; cursor: pointer; opacity: 0.5; transition: all 0.3s ease; filter: grayscale(50%); }
.lang-btn:hover { opacity: 0.8; transform: scale(1.1); }
.lang-btn.active { opacity: 1; filter: grayscale(0%); transform: scale(1.2); }

@media(max-width: 768px) {
  .lang-switcher { top: 68px; right: 12px; padding: 6px 10px; }
  .lang-btn { font-size: 20px; }
}

/* HEADER */
header { text-align: center; padding: 60px 0 30px; position: relative; }
.logo-img { 
  max-width: 190px; 
  margin-bottom: 18px; 
  border-radius: 24px; 
  border: 2px solid rgba(251, 191, 36, 0.5); 
  box-shadow: 0 0 30px rgba(168, 85, 247, 0.45), 0 0 12px rgba(251, 191, 36, 0.3); 
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.logo-img:hover {
  transform: scale(1.03);
  box-shadow: 0 0 40px rgba(168, 85, 247, 0.7), 0 0 20px rgba(251, 191, 36, 0.5);
}
h1 { 
  font-family: 'Baloo 2', sans-serif; 
  font-size: clamp(28px, 5vw, 42px); 
  font-weight: 700; 
  color: #ffffff; 
  text-shadow: 0 0 20px rgba(168, 85, 247, 0.6), 0 2px 4px rgba(0, 0, 0, 0.8);
  margin-bottom: 10px; 
  line-height: 1.2; 
}
.header-sub { color: var(--text-muted); font-size: 18px; font-weight: 600; max-width: 600px; margin: 0 auto; }

/* TABS */
.tabs {
  display: flex; gap: 10px; margin-bottom: 30px; background: rgba(20, 11, 38, 0.85);
  backdrop-filter: blur(10px);
  border: 2px solid var(--border-color); border-radius: 25px; padding: 8px;
  overflow-x: auto; scrollbar-width: none; box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  flex: 1; min-width: 100px; padding: 12px 15px; background: transparent; border: 1px solid transparent;
  border-radius: 20px; cursor: pointer; font-family: 'Baloo 2', sans-serif; font-size: 18px;
  color: var(--text-muted); transition: all 0.3s ease; white-space: nowrap;
}
.tab-btn:hover { background: rgba(168, 85, 247, 0.15); color: var(--text-main); border-color: rgba(168, 85, 247, 0.3); }
.tab-btn.active { 
  background: linear-gradient(135deg, #7c3aed, #a855f7); 
  color: white; 
  border-color: rgba(251, 191, 36, 0.5); 
  box-shadow: 0 4px 15px rgba(168, 85, 247, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.3); 
}

/* PANELS */
.class-panel { display: none; animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.class-panel.active { display: block; }
@keyframes popIn { 0% { opacity: 0; transform: scale(0.95) translateY(10px); } 100% { opacity: 1; transform: scale(1) translateY(0); } }

/* SECTION CARD */
.section-card { 
  background: var(--card-bg); 
  border: 1.5px solid var(--border-color); 
  border-radius: 20px; 
  margin-bottom: 20px; 
  overflow: hidden; 
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4), 0 0 15px rgba(168, 85, 247, 0.05); 
}
.section-header { 
  padding: 18px 25px; 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  background: linear-gradient(to right, #1b0e36, #140b28); 
  cursor: pointer; 
  user-select: none; 
  border-bottom: 1.5px solid var(--border-color); 
}
.section-title { font-family: 'Baloo 2', sans-serif; font-size: 20px; color: var(--text-main); display: flex; align-items: center; gap: 12px; }
.section-dot { width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }
.warrior .section-dot { background: var(--warrior); color: var(--warrior); }
.archer  .section-dot { background: var(--archer);  color: var(--archer);  }
.mage    .section-dot { background: var(--mage);    color: var(--mage);    }
.master  .section-dot { background: var(--master);  color: var(--master);  }
.jewelry .section-dot { background: var(--jewelry); color: var(--jewelry); }
.section-toggle { font-size: 18px; color: var(--accent-yellow); transition: transform 0.3s ease; text-shadow: 0 0 8px rgba(251, 191, 36, 0.5); }
.section-card.collapsed .section-toggle { transform: rotate(-90deg); }
.section-card.collapsed .section-body { display: none; }

/* TABLE */
.mat-table { width: 100%; border-collapse: collapse; }
.mat-table thead th { padding: 12px 15px; text-align: left; font-family: 'Baloo 2', sans-serif; color: var(--text-muted); font-size: 16px; border-bottom: 2px dashed var(--border-color); }
.mat-table thead th:not(:first-child) { text-align: right; }
.mat-table tbody tr { border-bottom: 1px solid rgba(46, 23, 79, 0.8); transition: background 0.3s, border-left 0.3s; }
.mat-table tbody tr:last-child { border-bottom: none; }
.mat-table tbody tr:hover { background: rgba(168, 85, 247, 0.08); }
.mat-table td { padding: 10px 15px; vertical-align: middle; font-size: 16px; font-weight: 600; }
.mat-table td:not(:first-child) { text-align: right; }
.mat-need { color: var(--text-muted); }

/* ICONS & ITEM NAMES */
.mat-name { display: flex; align-items: center; gap: 12px; position: relative; transition: color 0.3s; }
.item-icon {
  width: 32px; height: 32px; object-fit: contain; background: #0c0617; 
  border: 1px solid var(--border-color); border-radius: 8px; padding: 2px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--text-muted); transition: all 0.3s;
}
.item-text { flex: 1; }

/* EFEKT SCHODKÓW (SUB-ITEMS) */
tr.sub-item { background-color: rgba(12, 6, 23, 0.45); }
tr.sub-item .mat-name { padding-left: 45px; }
tr.sub-item .mat-name::before {
  content: '↳'; position: absolute; left: 18px; top: 50%; transform: translateY(-50%);
  color: var(--accent-yellow); font-size: 22px; font-weight: bold; opacity: 0.85;
  text-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
}

/* PODŚWIETLENIE UKOŃCZONYCH (ZIELONY KOLOR) */
tr.completed { background-color: var(--green-done) !important; }
tr.completed .mat-name { color: var(--green-text); }
tr.completed .item-icon { border-color: var(--green-text); box-shadow: 0 0 10px rgba(52, 211, 153, 0.3); }

.mat-own input, .mat-price input {
  width: 95px; background: #0c0617; border: 1.5px solid var(--border-color); border-radius: 10px; 
  color: var(--text-main); font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 16px; 
  text-align: right; padding: 6px 10px; outline: none; transition: all 0.2s;
}
.mat-price input { border-color: rgba(251, 191, 36, 0.4); color: var(--accent-yellow); } 
.mat-own input:focus { border-color: var(--accent-purple); box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.3); }
.mat-price input:focus { border-color: var(--accent-yellow); box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.35); }

.mat-miss.done { color: #34d399; }
.mat-miss.some { color: #fbbf24; }
.mat-miss.none { color: #fb7185; }
.val-cost { color: #fb7185; font-weight: 700; font-family: 'Baloo 2', sans-serif;}

/* SUMMARY CARD */
.summary-card { 
  background: var(--card-bg); 
  border: 2px solid rgba(168, 85, 247, 0.5); 
  border-radius: 20px; 
  margin-bottom: 25px; 
  overflow: hidden; 
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(168, 85, 247, 0.2); 
}
.summary-header { 
  padding: 16px 25px; 
  background: linear-gradient(90deg, #6d28d9, #9333ea, #7c3aed); 
  color: #ffffff; 
  text-align: center; 
  border-bottom: 1px solid rgba(251, 191, 36, 0.3);
}
.summary-title { 
  font-family: 'Baloo 2', sans-serif; 
  font-size: 22px; 
  letter-spacing: 0.5px;
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.4); 
}

.summary-stats { display: flex; border-bottom: 2px dashed var(--border-color); }
.summary-stats.money-row { background: rgba(251, 191, 36, 0.05); border-bottom: none; }
.stat-box { flex: 1; padding: 15px; text-align: center; border-right: 1.5px dashed var(--border-color); }
.stat-box:last-child { border-right: none; }
.stat-val { font-family: 'Baloo 2', sans-serif; font-size: 28px; display: block; line-height: 1.1; }
.stat-val.gold { color: var(--accent-yellow); text-shadow: 0 0 10px rgba(251, 191, 36, 0.5); }
.stat-val.green { color: #34d399; text-shadow: 0 0 10px rgba(52, 211, 153, 0.4); }
.stat-val.red { color: #fb7185; text-shadow: 0 0 10px rgba(251, 113, 133, 0.4); }
.stat-val.money { color: var(--accent-yellow); text-shadow: 0 0 12px rgba(251, 191, 36, 0.6); }
.stat-lbl { font-size: 13px; color: var(--text-muted); font-weight: 700; text-transform: uppercase;}

/* PROGRESS BAR */
.progress-wrap { padding: 15px 25px 20px; background: var(--card-bg); border-top: 2px dashed var(--border-color); }
.progress-label { display: flex; justify-content: space-between; font-weight: 700; color: var(--text-muted); margin-bottom: 10px; }
.progress-track { height: 14px; background: #0c0617; border: 1px solid var(--border-color); border-radius: 20px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 20px; background: linear-gradient(90deg, #fbbf24, #a855f7, #c084fc); box-shadow: 0 0 12px rgba(168, 85, 247, 0.6); transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1); }

.top-bar { display: flex; justify-content: flex-end; flex-wrap: wrap; margin-bottom: 20px; gap: 10px; }
.btn-reset { 
  background: #140b26; 
  border: 1.5px solid rgba(168, 85, 247, 0.6); 
  border-radius: 12px; 
  color: #e9d5ff; 
  font-family: 'Baloo 2', sans-serif; 
  font-size: 15px; 
  padding: 8px 16px; 
  cursor: pointer; 
  transition: all 0.25s; 
}
.btn-reset:hover { 
  background: linear-gradient(135deg, #7c3aed, #a855f7); 
  color: #ffffff; 
  transform: translateY(-2px); 
  box-shadow: 0 4px 15px rgba(168, 85, 247, 0.5), 0 0 8px rgba(251, 191, 36, 0.3); 
  border-color: rgba(251, 191, 36, 0.5);
}

@media(max-width: 768px) {
  .mat-table thead { display: none; }
  .mat-table tbody tr { display: flex; flex-wrap: wrap; padding: 15px; gap: 10px 0; }
  .mat-table td { padding: 0 5px; border: none; text-align: left !important; width: 50%; }
  .mat-table td:first-child { width: 100%; font-size: 18px; color: var(--accent-yellow); margin-bottom: 5px; text-align: center !important;}
  .mat-table td::before { content: attr(data-label); display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 3px;}
  .mat-own input, .mat-price input { width: 100%; text-align: left; }
  .stat-val { font-size: 20px; }
  .stat-lbl { font-size: 10px; }
  
  /* SCHODKI WERSJA MOBILNA */
  tr.sub-item { margin-left: 20px; width: calc(100% - 20px); border-left: 4px solid var(--accent-yellow) !important; border-radius: 0 15px 15px 0; box-shadow: -2px 0 8px rgba(0,0,0,0.3); }
  tr.sub-item .mat-name { padding-left: 0; }
  tr.sub-item .mat-name::before { display: none; }
}

.main-navbar {
  display: flex;
  justify-content: center;
  background: rgba(15, 8, 28, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 2px solid rgba(168, 85, 247, 0.5);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  position: relative;
  z-index: 1000;
}

.nav-item {
  position: relative;
  border-right: 1px solid var(--border-color);
}
.nav-item:first-child { 
  border-left: 1px solid var(--border-color); 
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: 'Baloo 2', sans-serif;
  font-weight: 600;
  font-size: 16px;
  padding: 12px 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.nav-btn:hover, .nav-btn:active {
  background: rgba(168, 85, 247, 0.18);
  color: var(--accent-yellow);
  text-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: -1px; 
  background: #140b26;
  border: 1.5px solid var(--border-color);
  border-top: none;
  min-width: 200px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  z-index: 1001;
  border-radius: 0 0 12px 12px;
  overflow: hidden;
}

.dropdown-menu.show {
  display: block;
  animation: slideDown 0.2s ease forwards;
}

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

.dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  color: var(--text-muted);
  text-decoration: none;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 14px;
  border-bottom: 1px dashed var(--border-color);
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.dropdown-item:hover {
  background: rgba(168, 85, 247, 0.2);
  color: var(--accent-yellow);
}

.dropdown-item::after {
  content: '▶';
  color: var(--accent-yellow);
  font-size: 10px;
  transition: transform 0.2s;
}

.dropdown-item:hover::after {
  transform: translateX(4px);
}

.app-view {
  animation: fadeIn 0.4s ease;
}

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