/* ========================================
   BUTTONS
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  border-color: transparent;
}

.btn-primary:hover {
  box-shadow: 0 0 24px rgba(255, 140, 50, 0.25);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
  background: var(--bg-elevated);
  border-color: var(--glass-border-hover);
}

.btn-danger {
  background: rgba(255, 71, 87, 0.12);
  color: var(--danger);
  border: 1px solid rgba(255, 71, 87, 0.2);
}

.btn-danger:hover {
  background: rgba(255, 71, 87, 0.2);
  border-color: rgba(255, 71, 87, 0.4);
}

.btn-sm {
  padding: 7px 12px;
  font-size: 0.8rem;
}

.btn-icon {
  padding: 8px;
  min-width: 36px;
}

/* ========================================
   INPUTS
   ======================================== */
.input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 140, 50, 0.08);
}

.input::placeholder {
  color: var(--text-muted);
}

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7694' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

/* ========================================
   NAME INPUT WITH HINT BULB
   ======================================== */
.name-input-wrap {
  position: relative;
}

.name-input-wrap .input {
  padding-right: 40px;
}

.hint-bulb {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2ed573;
  animation: bulb-glow 2s ease-in-out infinite;
}

@keyframes bulb-glow {
  0%, 100% {
    filter: drop-shadow(0 0 2px rgba(46, 213, 115, 0.3));
  }
  50% {
    filter: drop-shadow(0 0 8px rgba(46, 213, 115, 0.7)) drop-shadow(0 0 16px rgba(46, 213, 115, 0.3));
  }
}

.hint-bulb:hover {
  color: #7bed9f;
  animation: none;
  filter: drop-shadow(0 0 10px rgba(46, 213, 115, 0.8));
}

/* Hint popup */
.hint-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.hint-popup-overlay.active {
  opacity: 1;
}

.hint-popup {
  background: var(--bg-card-solid);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-xl);
  max-width: 480px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.hint-popup h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #2ed573;
  margin-bottom: var(--sp-md);
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
}

.hint-popup p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: var(--sp-md);
}

.hint-popup strong {
  color: var(--text-primary);
}

.hint-popup .hint-example {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid #2ed573;
  border-radius: var(--radius-md);
  padding: var(--sp-sm) var(--sp-md);
  font-size: 0.82rem;
  color: var(--text-primary);
  margin-bottom: var(--sp-md);
  font-family: var(--font-mono);
  line-height: 1.5;
}

.hint-popup ul {
  list-style: none;
  padding: 0;
  margin-bottom: var(--sp-md);
}

.hint-popup ul li {
  font-size: 0.83rem;
  color: var(--text-secondary);
  padding: 4px 0;
  padding-left: 16px;
  position: relative;
}

.hint-popup ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 11px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2ed573;
}

.hint-popup .hint-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--sp-md);
  line-height: 1.5;
}

.hint-popup .hint-close {
  display: block;
  width: 100%;
  margin-top: var(--sp-md);
  padding: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.hint-popup .hint-close:hover {
  background: var(--bg-elevated);
  border-color: #2ed573;
  color: #2ed573;
}

/* ========================================
   FORM GROUPS
   ======================================== */
.form-group {
  margin-bottom: var(--sp-md);
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.form-row {
  display: flex;
  gap: var(--sp-sm);
}

.form-row > * {
  flex: 1;
}

/* ========================================
   TABS
   ======================================== */
.tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 3px;
  margin-bottom: var(--sp-lg);
}

.tab {
  flex: 1;
  padding: 8px 12px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  background: var(--accent-gradient);
  color: #fff;
  font-weight: 600;
}

/* ========================================
   SEARCH RESULTS
   ======================================== */
.search-results {
  max-height: 220px;
  overflow-y: auto;
  background: var(--bg-primary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  margin-top: 6px;
}

.search-result-item {
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--border-subtle);
}

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

.search-result-item:hover {
  background: var(--accent-bg);
}

.search-result-item .result-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
}

.search-result-item .result-detail {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ========================================
   ITEM LIST
   ======================================== */
.item-list-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background var(--transition-fast);
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
}

.item-list-entry:hover {
  background: var(--bg-hover);
}

.item-mode-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--accent-bg);
  color: var(--accent);
  border: 1px solid rgba(255, 140, 50, 0.15);
}

/* ========================================
   COMPOSITE COMPONENTS
   ======================================== */
.component-row {
  display: flex;
  gap: var(--sp-sm);
  align-items: center;
  margin-bottom: var(--sp-sm);
  padding: var(--sp-sm) var(--sp-md);
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.component-row .input {
  font-size: 0.85rem;
}

.component-remove {
  color: var(--text-muted);
  font-size: 1.1rem;
  flex-shrink: 0;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.component-remove:hover {
  color: var(--danger);
  background: rgba(255, 71, 87, 0.08);
}

/* ========================================
   STATS PERIOD SELECTOR
   ======================================== */
.period-selector {
  display: flex;
  gap: 3px;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 3px;
  margin-bottom: var(--sp-lg);
}

.period-btn {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.period-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.period-btn.active {
  background: var(--accent-gradient);
  color: #fff;
  font-weight: 600;
}

/* ========================================
   STATS SUMMARY
   ======================================== */
.stats-summary {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: var(--sp-xs);
  margin-top: var(--sp-lg);
}

@media (max-width: 900px) {
  .stats-summary {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stats-summary .summary-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  padding: var(--sp-sm) var(--sp-xs);
  border-radius: var(--radius-md);
  text-align: center;
}

.stats-summary .summary-card .summary-value {
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent-bright);
}

.stats-summary .summary-card .summary-label {
  font-size: 0.6rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */
.toast {
  position: fixed;
  bottom: var(--sp-lg);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-card-solid);
  color: var(--text-primary);
  padding: 10px var(--sp-lg);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 200;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--glass-border);
  border-left: 3px solid var(--accent);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  border-left-color: var(--danger);
}

/* ========================================
   RESPONSIVE MOBILE (max-width: 768px)
   ======================================== */
@media (max-width: 768px) {

  /* Bigger touch targets for inputs */
  .input {
    padding: 12px 14px;
    font-size: 1rem;
  }

  .btn {
    padding: 12px 18px;
    font-size: 0.9rem;
  }

  /* Tabs: smaller text to fit 4 tabs */
  .tab {
    padding: 8px 6px;
    font-size: 0.72rem;
  }

  /* Period selector */
  .period-selector {
    flex-wrap: wrap;
  }

  .period-btn {
    padding: 8px 10px;
    font-size: 0.75rem;
  }

  /* Stats summary: 2 columns on mobile */
  .stats-summary {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Component rows */
  .component-row {
    flex-wrap: wrap;
  }

  /* Toast: wider on mobile */
  .toast {
    left: var(--sp-md);
    right: var(--sp-md);
    transform: translateX(0) translateY(100px);
    text-align: center;
  }

  .toast.show {
    transform: translateX(0) translateY(0);
  }
}
