* {
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  background: transparent;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: 'Segoe UI', Arial, sans-serif;
  user-select: none;
}

#widget {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Close button - now in header */
#close-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  font-size: 18px;
  font-weight: bold;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-app-region: no-drag;
}

#close-btn:hover {
  background: #ff3b30;
  color: #fff;
}

/* Icon wrapper (draggable area) */
#icon-wrapper {
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-app-region: drag;
  background: transparent;
}

/* Icon button (clickable) */
#icon {
  width: 70px;
  height: 70px;
  padding: 5px;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.3;
  outline: none;
  -webkit-app-region: no-drag;
}

#icon:hover {
  opacity: 1;
  transform: scale(1.05);
}

#icon img {
  width: 100%;
  height: 100%;
  border-radius: 14px;
  pointer-events: none;
}

/* Collapse button */
#collapse-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  font-size: 18px;
  font-weight: bold;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-app-region: no-drag;
}

#collapse-btn:hover {
  background: rgba(255, 214, 10, 0.3);
  color: #ffd60a;
}

/* Panel */
#panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 59, 48, 0.3);
  border-radius: 8px;
  margin: 4px;
  background: linear-gradient(180deg, #1a1a1a 0%, #141414 100%);
}

.hidden {
  display: none !important;
}

/* Header - draggable */
.panel-header {
  background: linear-gradient(90deg, rgba(255, 59, 48, 0.2) 0%, rgba(255, 214, 10, 0.1) 50%, rgba(48, 209, 88, 0.1) 100%);
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 59, 48, 0.2);
  display: flex;
  align-items: center;
  gap: 10px;
  -webkit-app-region: drag;
  cursor: move;
}

.panel-header .logo {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}

.panel-header h1 {
  margin: 0;
  font-size: 13px;
  background: linear-gradient(90deg, #ff3b30 0%, #ffd60a 50%, #30d158 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

/* Search */
#search-container {
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

#search {
  width: 100%;
  padding: 9px 14px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  outline: none;
  transition: all 0.2s;
}

#search:focus {
  border-color: #ff3b30;
  box-shadow: 0 0 0 2px rgba(255, 59, 48, 0.2);
}

#search::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

/* Filters */
#filters {
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  flex-wrap: wrap;
  background: rgba(0, 0, 0, 0.15);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.filter-btn {
  padding: 5px 12px;
  font-size: 11px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.filter-btn:hover {
  border-color: #ff3b30;
  color: #ff3b30;
}

.filter-btn.active {
  background: linear-gradient(135deg, #ff3b30 0%, #ff6b5b 100%);
  border-color: #ff3b30;
  color: #fff;
  font-weight: 600;
}

/* Stats */
#stats {
  padding: 6px 16px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
  background: rgba(0, 0, 0, 0.15);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* List */
#list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
}

#list::-webkit-scrollbar {
  width: 5px;
}

#list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

#list::-webkit-scrollbar-thumb {
  background: rgba(255, 59, 48, 0.4);
  border-radius: 3px;
}

#list::-webkit-scrollbar-thumb:hover {
  background: #ff3b30;
}

/* List items - COMPACT single row */
.item {
  padding: 8px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  transition: background 0.15s;
}

.item:hover {
  background: rgba(255, 59, 48, 0.08);
}

/* Item icon */
.item-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.item-icon img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.item-left {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.item-name {
  font-size: 13px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
  min-width: 140px;
  max-width: 180px;
}

.item-meta {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
  display: flex;
  gap: 8px;
  white-space: nowrap;
}

.item-category {
  color: rgba(255, 214, 10, 0.8);
  font-weight: 500;
}

.item-desc {
  color: rgba(255, 255, 255, 0.35);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Tags */
.tag {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.tag-nechat {
  background: linear-gradient(135deg, #30d158 0%, #28a745 100%);
  color: #fff;
}

.tag-prodat {
  background: linear-gradient(135deg, #ffd60a 0%, #ffab00 100%);
  color: #000;
}

.tag-recyklovat {
  background: linear-gradient(135deg, #5ac8fa 0%, #32ade6 100%);
  color: #fff;
}

.tag-pouzit {
  background: linear-gradient(135deg, #bf5af2 0%, #9b4dca 100%);
  color: #fff;
}

/* Rarity indicators */
.rarity-legendary .item-name {
  color: #ff9f0a;
  text-shadow: 0 0 8px rgba(255, 159, 10, 0.4);
}

.rarity-epic .item-name {
  color: #bf5af2;
}

.rarity-rare .item-name {
  color: #5ac8fa;
}

.rarity-uncommon .item-name {
  color: #30d158;
}

.rarity-common .item-name {
  color: #8e8e93;
}

/* Empty state */
.empty-state {
  padding: 35px 20px;
  text-align: center;
  color: rgba(255, 255, 255, 0.4);
}

.empty-state .icon {
  font-size: 36px;
  margin-bottom: 8px;
  opacity: 0.5;
}

/* Legend */
#legend {
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  justify-content: space-around;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.5);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.legend-dot.nechat { background: #30d158; }
.legend-dot.prodat { background: #ffd60a; }
.legend-dot.recyklovat { background: #5ac8fa; }
.legend-dot.pouzit { background: #bf5af2; }

/* ========================================
   DETAIL VIEW
   ======================================== */

#detail-view {
  display: flex;
  flex-direction: column;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(90deg, rgba(255, 59, 48, 0.15) 0%, rgba(255, 214, 10, 0.1) 50%, rgba(48, 209, 88, 0.1) 100%);
  border-bottom: 1px solid rgba(255, 59, 48, 0.2);
}

#back-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

#back-btn:hover {
  background: rgba(255, 59, 48, 0.2);
  border-color: #ff3b30;
}

.detail-content {
  padding: 12px 16px;
  overflow-y: auto;
}

/* Detail top section with icon */
.detail-top {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.detail-icon {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(255, 59, 48, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.detail-icon img {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

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

.detail-content h2 {
  margin: 0 0 8px 0;
  font-size: 18px;
  color: #fff;
  font-weight: 600;
}

.detail-row {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 6px;
  display: flex;
  gap: 8px;
}

.detail-row .label {
  color: rgba(255, 255, 255, 0.4);
}

.detail-row .value {
  color: rgba(255, 214, 10, 0.9);
}

.detail-content > p {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.5;
  margin: 12px 0 16px 0;
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  border-left: 3px solid #ff3b30;
}

/* Detail sections */
.detail-section {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.detail-section h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.5);
  margin: 0 0 10px 0;
}

.detail-section ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.detail-section li {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-section li::before {
  content: "•";
  color: #ff3b30;
}

#detail-tip p {
  font-size: 12px;
  color: rgba(48, 209, 88, 0.9);
  padding: 10px;
  background: rgba(48, 209, 88, 0.1);
  border-radius: 8px;
  margin: 0;
  line-height: 1.4;
}

/* Rarity colors in detail */
.detail-rarity-legendary { color: #ff9f0a !important; }
.detail-rarity-epic { color: #bf5af2 !important; }
.detail-rarity-rare { color: #5ac8fa !important; }
.detail-rarity-uncommon { color: #30d158 !important; }
.detail-rarity-common { color: #8e8e93 !important; }

/* Clickable items */
.item {
  cursor: pointer;
  outline: none;
}

.item:active {
  transform: scale(0.98);
}

/* Remove focus outlines globally */
button:focus,
input:focus,
li:focus {
  outline: none;
}
