/* Pill Runs feature styles (scaffold) */
/* Root card and IDs inherit from global .card; specific styles below */

/* Location buttons grid and states */
.location-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 10px 0; }
.location-btn { padding: 8px 10px; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 6px; cursor: pointer; transition: all var(--transition-normal); text-align: center; font-size: 0.9rem; position: relative; overflow: hidden; flex: 1; color: var(--text); }
.location-btn::after { content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 2px; background: var(--accent); transform: scaleX(0); transition: transform var(--transition-normal); }
.location-btn.active { background: var(--accent-light); color: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 2px 6px rgba(39, 174, 96, 0.1); font-weight: 600; transform: translateY(-1px); }
.location-btn.active::after { transform: scaleX(1); }
.location-btn:hover:not(.active) { border-color: var(--accent); transform: translateY(-1px); }
.location-btn:hover::after { transform: scaleX(0.5); }
.location-btn.disabled{opacity:.45;cursor:not-allowed;pointer-events:none}

/* History Item Styles */
.history-item { background: rgba(255, 255, 255, 0.03); padding: 10px 15px; margin-bottom: 8px; border-radius: 6px; border-left: 3px solid var(--accent); display: flex; justify-content: space-between; align-items: center; gap: 15px; transition: all 0.2s ease; }
.history-item:hover { background: rgba(255, 255, 255, 0.05); transform: translateX(2px); }
.history-item .location { font-weight: 600; color: var(--accent); min-width: 80px; }
.history-item .time { color: var(--text-secondary); font-size: 0.9em; flex: 1; }
.history-item .time-ago { color: var(--text-secondary); font-size: 0.85em; font-style: italic; white-space: nowrap; }
.empty-history { color: var(--text-secondary); text-align: center; padding: 20px; font-style: italic; }

/* Structured layout regions inside a history row */
.history-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.history-date-badge { background: var(--accent); color: #000; width: 40px; height: 40px; border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: bold; margin-left: 6px; flex: 0 0 auto; }
.history-date-month { font-size: 12px; line-height: 1; }
.history-date-day { font-size: 16px; }
.history-time-row { display: flex; align-items: center; gap: 6px; white-space: nowrap; }

/* Note column: fixed width on the right (non-sticky) */
.history-note-col { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; width: 260px; position: static; padding-left: 0; background: transparent; z-index: auto; }
.history-note-input { width: 100%; padding: 6px 8px; border-radius: 6px; border: 1px solid var(--border-color); background: var(--card-bg); color: var(--text); font-size: 0.9em; box-sizing: border-box; }
.history-note-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.history-note-status { margin-top: 2px; font-size: 0.8em; color: var(--text-secondary); display: none; }

/* History list container */
#historyList { flex: 1; min-height: 220px; overflow-y: auto; overflow-x: auto; padding: 12px; background: rgba(255,255,255,0.02); border-radius: 6px; margin-bottom: 8px; }
/* Ensure items can extend horizontally if needed (so the note column is reachable) */
#historyList .history-item { min-width: 560px; }
/* Visible scrollbar styling for history list (both axes) */
#historyList::-webkit-scrollbar { height: 10px; width: 10px; }
#historyList::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--accent) 70%, #000 0%); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
#historyList::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--accent) 85%, #000 0%); }
#historyList::-webkit-scrollbar-track { background: var(--card-hover); border-radius: 6px; }
#historyList { scrollbar-width: thin; scrollbar-color: var(--accent) var(--card-hover); }

/* Pill Run card variants and status styles */
.pill-run-card { transition: all 0.3s ease; border-radius: 12px; overflow: hidden; }
.pill-run-card.ready { box-shadow: none; border: 1px solid var(--border-color); }
.pill-run-card.almost-ready { box-shadow: none; border: 1px solid var(--border-color); }
.pill-run-card.on-cooldown { border: 1px solid var(--border-color); }
.pill-run-card.error { box-shadow: none; border: 1px solid var(--border-color); }
.status-available { color: var(--success); font-weight: 600; }
.status-cooldown { color: var(--warning); font-weight: 600; }
.end-time { font-size: 0.85em; opacity: 0.8; display: block; margin-top: 3px; }

/* Pill-run timer display tweak */
.pill-run-card .timer-display {
  font-family: 'Poppins', monospace;
  background: rgba(255, 119, 0, 0.08);
  padding: 15px;
  border-radius: 10px;
  text-align: center;
  font-weight: 700;
  letter-spacing: 1px;
  font-size: 1.2em;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

/* History note responsive tweaks */
@media (max-width: 768px) {
  .history-item { flex-wrap: wrap !important; }
  .history-note-col { width: 100% !important; align-items: stretch !important; margin-top: 6px; }
  .history-note-input { width: 100% !important; }
}
/* Responsive: adjust location button grid and history layout */
@media (max-width: 1024px) {
  .location-buttons { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
}
@media (max-width: 768px) {
  .location-buttons { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) and (orientation: landscape) {
  .location-buttons { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 480px) {
  .location-buttons { grid-template-columns: 1fr 1fr; }
  .history-item { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
  .history-location-tag { max-width: 60vw; overflow: hidden; text-overflow: ellipsis; }
}
