/* Calculator Wrapper */
.calc-wrapper {
  background: var(--card-bg, #2b2633);
  border: 1px solid var(--card-border, #40394a);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

/* Value Indicator */
.value-indicator {
  margin-bottom: 2rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 1.5rem;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.value-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
}

.you-text { color: #34d399; }
.their-text { color: #94a3b8; }
.diff-text {
  font-size: 1rem;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.1);
  padding: 4px 12px;
  border-radius: 12px;
}

.value-bar-container {
  width: 100%;
  height: 12px;
  background: #1e293b;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
}

.value-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #34d399, #10b981);
  border-radius: 6px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1), background 0.5s;
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.5);
}

/* Calculator Container & Sides */
.calc-container {
  display: flex;
  gap: 2rem;
}

.calc-side {
  flex: 1;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 16px;
  padding: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.side-header {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid rgba(255,255,255,0.05);
}

.you-header { color: #34d399; border-color: rgba(52, 211, 153, 0.2); }
.their-header { color: #94a3b8; border-color: rgba(148, 163, 184, 0.2); }

.calc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

/* Grid Slots */
.calc-slot {
  aspect-ratio: 1;
  background: rgba(30, 41, 59, 0.5);
  border: 2px dashed rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.calc-slot:hover {
  border-color: rgba(148, 163, 184, 0.5);
  background: rgba(30, 41, 59, 0.8);
}

.calc-slot.filled {
  border-style: solid;
  border-color: rgba(255,255,255,0.1);
}

.calc-slot.filled:hover::after {
  content: '✕ Remove';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(239, 68, 68, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  color: white;
  font-weight: bold;
  font-size: 0.9rem;
  backdrop-filter: blur(2px);
}

.slot-add-icon {
  font-size: 2rem;
  color: rgba(148, 163, 184, 0.4);
}

.calc-slot:hover .slot-add-icon {
  color: rgba(148, 163, 184, 0.8);
}

.slot-img {
  width: 60%;
  height: 60%;
  object-fit: contain;
  margin-bottom: 0.5rem;
}

.slot-value {
  font-size: 0.8rem;
  font-weight: 600;
  color: #34d399;
  background: rgba(0,0,0,0.3);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Actions */
.calc-actions {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
}

.calc-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.5rem;
  border: none;
  border-radius: 12px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.clear-btn {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.clear-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  transform: translateY(-2px);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: none; /* Ukryte domyślnie */
  justify-content: center;
  align-items: center;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  width: 90%;
  max-width: 800px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

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

.modal-header h2 {
  font-family: 'Outfit', sans-serif;
  margin: 0;
}

.close-btn {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

.close-btn:hover { color: #ef4444; }

.modal-search {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(0,0,0,0.2);
}

#item-search {
  width: 100%;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

#item-search:focus {
  border-color: var(--accent-1);
}

.modal-filters {
  display: flex;
  gap: 0.5rem;
}

.filter-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.filter-btn.active {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.3);
}

.modal-items-grid {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}

/* Modal Item Card */
.modal-item {
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.modal-item:hover {
  background: rgba(30, 41, 59, 0.8);
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateY(-2px);
}

.modal-item-img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  margin-bottom: 0.8rem;
}

.modal-item-name {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: #f8fafc;
}

.modal-item-type {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: #94a3b8;
  background: rgba(0,0,0,0.3);
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 0.4rem;
}

.modal-item-value {
  font-size: 0.8rem;
  font-weight: 700;
  color: #34d399;
}

@media (max-width: 768px) {
  .calc-container {
    flex-direction: column;
  }
  .calc-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
