/* ===========================
   Company Watchlist - Styles
   =========================== */

/* Status colors defined once, reused throughout the file */
:root {
  --color-watching:   #4a90e2; /* blue */
  --color-top-choice: #e8a020; /* amber */
  --color-follow-up:  #e07020; /* orange */
}

body {
  font-family: sans-serif;
  margin: 0;
  padding: 40px 20px;
  background-color: #f5f5f5;
  color: #333;
}

header, main {
  max-width: 680px;
  margin: 0 auto;
}

header {
  margin-bottom: 40px;
}

header h1 {
  font-size: 28px;
  margin-bottom: 4px;
}

header p {
  color: #666;
  margin: 0;
}

header .disclaimer {
  font-size: 12px;
  color: #999;
  font-style: italic;
  margin-top: 6px;
}

h2 {
  font-size: 20px;
  margin-bottom: 16px;
}

/* ===========================
   Add Company Form
   =========================== */

#form-section {
  background: #fff;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 32px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-weight: bold;
  margin-bottom: 2px;
}

.form-group small {
  display: block;
  color: #888;
  font-size: 13px;
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-sizing: border-box;
  background-color: #fff;
}

.form-group textarea {
  height: 80px;
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: #4a90e2;
  box-shadow: 0 0 0 3px rgba(74,144,226,0.15);
}

.form-group select {
  cursor: pointer;
}

/* Row that holds the ticker input + its search button side by side */
.ticker-input-row {
  display: flex;
  gap: 8px;
}

.ticker-input-row input {
  flex: 1;
}

/* Small secondary button used to look up a ticker by company name */
.ticker-search-btn {
  background-color: #fff;
  color: #4a90e2;
  border: 1px solid #4a90e2;
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.ticker-search-btn:hover {
  background-color: #eef4fc;
}

/* Dropdown-style list of ticker search results (hidden when empty) */
.ticker-results {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  max-height: 160px;
  overflow-y: auto;
}

.ticker-results:empty {
  display: none;
  border: none;
}

.ticker-result-item {
  padding: 8px 10px;
  font-size: 13px;
  color: #555;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
}

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

.ticker-result-item:hover {
  background-color: #eef4fc;
  color: #4a90e2;
}

.ticker-result-message {
  padding: 8px 10px;
  font-size: 13px;
  color: #999;
  font-style: italic;
}

button[type="submit"] {
  background-color: #4a90e2;
  color: #fff;
  border: none;
  padding: 12px 24px;
  font-size: 15px;
  border-radius: 6px;
  cursor: pointer;
}

button[type="submit"]:hover {
  background-color: #357abd;
}

/* ===========================
   Filter Buttons
   =========================== */

#filter-section {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.filter-btn {
  background-color: #fff;
  border: 1px solid #ccc;
  padding: 8px 16px;
  font-size: 14px;
  border-radius: 20px;
  cursor: pointer;
  color: #555;
}

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

/* The currently selected filter button */
.filter-btn.active {
  background-color: #4a90e2;
  border-color: #4a90e2;
  color: #fff;
}

/* Count shown next to "Watchlist" heading */
#listCount {
  font-size: 14px;
  font-weight: normal;
  color: #888;
  margin-left: 4px;
}

/* ===========================
   Company Cards
   =========================== */

.company-card {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  /* Left border color changes by status class below */
  border-left: 4px solid #ccc;
}

.company-card.status-watching   { border-left-color: var(--color-watching); }
.company-card.status-top-choice { border-left-color: var(--color-top-choice); }
.company-card.status-follow-up  { border-left-color: var(--color-follow-up); }

/* Top row: name group on the left, status badge on the right */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

/* Holds the ticker badge + company name side by side */
.card-name-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0; /* prevents overflow on narrow screens */
}

/* Ticker symbol badge (e.g. AAPL) */
.ticker-badge {
  flex-shrink: 0;
  background-color: #f0faf3;
  color: #27ae60;
  border: 1px solid #b8e8c8;
  font-size: 11px;
  font-weight: bold;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

/* Ticker badge becomes clickable to edit */
.ticker-badge.ticker-editable {
  cursor: pointer;
}

.ticker-badge.ticker-editable:hover {
  background-color: #d6f5e0;
}

/* Hint shown when no ticker is set */
.add-ticker-hint {
  font-size: 11px;
  color: #ccc;
  font-style: italic;
  cursor: pointer;
}

.add-ticker-hint:hover {
  color: #27ae60;
}

/* Inline input that appears when editing the ticker */
.ticker-editor {
  width: 80px;
  padding: 2px 6px;
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
  border: 1px solid #4a90e2;
  border-radius: 4px;
  outline: none;
  letter-spacing: 0.5px;
  box-shadow: 0 0 0 2px rgba(74,144,226,0.15);
}

/* Wraps the inline ticker input + its search button so results can drop down below it */
.ticker-editor-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  position: relative;
}

/* Smaller variant of the search button for the inline editor */
.ticker-search-btn-inline {
  padding: 1px 5px;
  font-size: 11px;
}

/* Results dropdown for the inline editor floats below it instead of pushing layout */
.ticker-editor-wrapper .ticker-results {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 5;
  min-width: 220px;
  background-color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

/* "Check price →" link in card footer */
.check-price-btn {
  font-size: 13px;
  font-weight: bold;
  color: #27ae60;
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 4px;
  background-color: #f0faf3;
  border: 1px solid #b8e8c8;
}

.check-price-btn:hover {
  background-color: #d6f5e0;
}

/* Company name as a clickable link */
.card-name {
  font-size: 18px;
  font-weight: bold;
  color: #333;
  text-decoration: none;
}

.card-name:hover {
  text-decoration: underline;
}

/* Company name when no URL is available */
.card-name-plain {
  font-size: 18px;
  font-weight: bold;
  color: #333;
}

/* Status badge — also acts as a button to cycle status */
.status-badge {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: bold;
  padding: 4px 12px;
  border-radius: 12px;
  border: none;
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}

.status-badge.status-watching   { background-color: var(--color-watching); }
.status-badge.status-top-choice { background-color: var(--color-top-choice); }
.status-badge.status-follow-up  { background-color: var(--color-follow-up); }

.status-badge:hover {
  opacity: 0.85;
}

/* Field label (INDUSTRY, NOTES, etc.) */
.card-label {
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
  color: #888;
  margin: 12px 0 2px;
}

.card-text {
  margin: 0;
  line-height: 1.5;
}

/* Bottom row: date on left, remove button on right */
.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #f0f0f0;
}

.card-date {
  font-size: 12px;
  color: #aaa;
  margin: 0;
}

.delete-btn {
  background: none;
  border: none;
  color: #bbb;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.delete-btn:hover {
  background-color: #fff0f0;
  color: #e74c3c;
}

/* Empty state */
.empty-message {
  text-align: center;
  color: #aaa;
  padding: 40px 0;
  margin: 0;
}

/* ===========================
   Industry Search Input
   =========================== */

#search-section {
  margin-bottom: 16px;
}

#industrySearch {
  width: 100%;
  padding: 10px 12px;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-sizing: border-box;
}

#industrySearch:focus {
  outline: none;
  border-color: #4a90e2;
  box-shadow: 0 0 0 3px rgba(74,144,226,0.15);
}

/* ===========================
   Inline Note Editing
   =========================== */

/* Notes area on a card — cursor shows it's clickable */
.card-notes {
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 4px;
  min-height: 24px;
}

.card-notes:hover {
  background-color: #f5f8ff;
}

/* Placeholder shown when notes is empty */
.add-note-hint {
  color: #bbb;
  font-style: italic;
  font-size: 14px;
}

/* Textarea that appears when editing a note inline */
.note-editor {
  width: 100%;
  padding: 6px 8px;
  font-size: 16px;
  font-family: sans-serif;
  border: 1px solid #4a90e2;
  border-radius: 4px;
  box-sizing: border-box;
  resize: vertical;
  min-height: 80px;
  outline: none;
  box-shadow: 0 0 0 3px rgba(74,144,226,0.15);
}

/* ===========================
   Backup (export/import)
   =========================== */

#backup-section {
  margin-top: 32px;
}

.backup-note {
  color: #888;
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 12px;
}

.backup-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.secondary-btn {
  background-color: #fff;
  color: #4a90e2;
  border: 1px solid #4a90e2;
  padding: 8px 16px;
  font-size: 14px;
  border-radius: 6px;
  cursor: pointer;
}

.secondary-btn:hover {
  background-color: #eef4fc;
}
