@import url('root_variables.css');
@import url('themes.css');
@import url('buttons.css');
@import url('components.css');

/* Base Styles */
body {
  font-family: var(--font-body);
  margin: 0;
  padding: 20px;
  background-color: var(--bg-colour);
  background-image: var(--bg-image);
  background-attachment: fixed;
  background-size: contain;
  min-height: 100vh;
  color: var(--sales-text-primary);

}

.container {
  max-width: 1600px;
  margin: 0 auto;
}

.title img {
  width: clamp(150px, 20vw, 300px);
  height: auto;
  display: block;
  margin: 0 auto;
  filter: var(--logo-colour);
}

h1 {
  color: var(--sales-text-secondary);
  font-size: 2.5em;
  margin: 0;
  text-shadow: var(--sales-text-shadow);
}

.header {
  background: var(--sales-dark-bg);
  border: 2px dotted var(--sales-red);
  padding: 20px;
  margin: 0 auto 20px;
  border-radius: 10px;
  text-align: center;
}

.blurb {
  font-size: 1.1em;
  color: var(--sales-text-secondary);
  margin: 0 0 -10px 0;
  line-height: 1.4;
}

.countdown {
  font-size: 1.1em;
  color: var(--sales-red);
  margin: 15px 0 0 0;
}

.stats {
  font-size: 1.1em;
  color: var(--sales-text-secondary);
  margin: 10px 0;
}

.stats span {
  color: var(--sales-red);
  font-weight: bold;
}

/* Links */
.listing-link {
  color: var(--sales-red);
  text-decoration: none;
  font-weight: bold;
}

.listing-link:hover {
  color: var(--sales-bright-red);
  text-decoration: underline;
}

/* Status and Loading */
.status {
  text-align: center;
  margin: 20px 0;
  font-size: 1em;
  color: var(--sales-red);
  font-weight: bold;
}

#calculating {
  color: var(--sales-red);
  font-style: italic;
}

.loading {
  text-align: center;
  margin: 50px 0;
  padding: 50px;
  font-style: italic;
  color: var(--sales-red);
}

.spinner {
  border: 4px dotted var(--sales-spinner-border);
  border-top: 4px solid var(--sales-spinner-top);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 10px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.error {
  color: var(--sales-error-red);
  text-align: center;
  margin: 20px 0;
  padding: 20px;
  font-weight: bold;
  background: var(--sales-bg-overlay);
  border-radius: 5px;
}

/* Gallery Styles */
.gallery-wrapper {
  background: var(--sales-dark-bg);
  border: 2px dotted var(--sales-red);
  padding: 30px;
  margin: 0 auto 30px;
  max-width: 1400px;
  border-radius: 10px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 15px;
  max-width: 100%;
  margin: 0 auto;
}

.gallery-item {
  display: flex;
  flex-direction: column;
}

.gallery img {
  width: 100%;
  height: auto;
  border: 2px dotted var(--sales-red);
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.3s ease, border-color 0.3s ease;
  display: block;
  background: var(--sales-black);
}

.gallery img:hover {
  transform: scale(1.05);
  border-color: var(--sales-white);
}

.timestamp {
  font-size: 0.85em;
  color: var(--sales-text-tertiary);
  text-align: center;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.copy-btn {
  background: var(--sales-red);
  color: var(--sales-white);
  border: 1px solid var(--sales-red);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.8em;
  cursor: pointer;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.copy-btn:hover {
  background: var(--sales-bright-red);
}

.copy-btn:active {
  background: var(--sales-dark-red);
}

.copy-btn.copied {
  background: var(--sales-copy-success);
  border-color: var(--sales-copy-success);
  animation: flash-green 0.5s ease;
}

@keyframes flash-green {
  0% {
    background: var(--sales-red);
    border-color: var(--sales-red);
  }

  50% {
    background: var(--sales-copy-success);
    border-color: var(--sales-copy-success);
    transform: scale(1.05);
  }

  100% {
    background: var(--sales-copy-success);
    border-color: var(--sales-copy-success);
  }
}

/* Controls and Filters — shared styles live in components.css */
.controls {
  margin: 0 auto 20px;
}

.filter-right {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Stays here, not components.css — see the input note in components.css */
.search-box input {
  width: 95%;
  padding: 10px;
  border: 2px solid var(--sales-red);
  border-radius: 5px;
  background: var(--sales-bg-overlay);
  color: var(--sales-text-primary);
  font-size: 1em;
  font-family: var(--font-body);
}

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

/* Table Styles */
.table-wrapper {
  background: var(--sales-dark-bg);
  border: 2px dotted var(--sales-red);
  padding: 20px;
  margin: 0 auto;
  border-radius: 10px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  color: var(--sales-text-primary);
}

th {
  background: var(--sales-light-red);
  padding: 12px;
  text-align: left;
  cursor: pointer;
  user-select: none;
  border-bottom: 2px solid var(--sales-red);
  position: relative;
}

th:hover {
  background: var(--sales-hover-red);
}

th.sortable::after {
  content: ' ⇅';
  color: var(--sales-text-dark);
  font-size: 0.8em;
}

th.sorted-asc::after {
  content: ' ↑';
  color: var(--sales-red);
}

th.sorted-desc::after {
  content: ' ↓';
  color: var(--sales-red);
}

th.status-column {
  cursor: default;
}

th.status-column:hover {
  background: var(--sales-light-red);
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--sales-border-subtle);
}

tr:hover {
  background: var(--sales-hover-overlay);
}

.price {
  color: var(--sales-price-green);
  font-weight: bold;
}

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 0.85em;
  font-weight: bold;
  background: var(--sales-status-good);
  color: var(--sales-price-green);
}

.seller-cell {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.no-results {
  text-align: center;
  padding: 30px;
  color: var(--sales-text-muted);
  font-style: italic;
}

/* Lightbox Styles */
#lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--sales-bg-lightbox);
  z-index: var(--z-modal);
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.lightbox-content {
  position: relative;
  max-width: 90%;
  max-height: 80%;
  display: flex;
  align-items: center;
  gap: 20px;
}

#lightbox-img {
  max-width: 100%;
  max-height: 80vh;
  cursor: pointer;
  border-radius: 10px;
  box-shadow: var(--sales-box-shadow);
}

.lightbox-arrow {
  background: var(--sales-lightbox-arrow-bg);
  border: none;
  color: var(--sales-lightbox-text);
  font-size: 40px;
  padding: 20px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.3s;
  user-select: none;
}

.lightbox-arrow:hover {
  background: var(--sales-lightbox-arrow-hover);
}

.lightbox-arrow:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.lightbox-counter {
  color: var(--sales-lightbox-text);
  font-size: 18px;
  margin-top: 15px;
  text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  h1 {
    font-size: 2em;
  }

  .gallery {
    grid-template-columns: 1fr;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    min-width: 100%;
  }

  table {
    font-size: 0.9em;
  }

  th,
  td {
    padding: 8px;
  }

  .seller-cell {
    max-width: 80px;
  }

  .lightbox-arrow {
    font-size: 30px;
    padding: 15px;
  }

  .lightbox-counter {
    font-size: 16px;
  }
}

@media (max-width: 600px) {
  .seller-cell {
    max-width: 50px;
  }
}

@media (max-width: 480px) {
  .status-column {
    display: none;
  }

  .status-cell {
    display: none;
  }
}

.lightbox-title {
  color: var(--sales-lightbox-text);
  font-size: 18px;
  font-weight: bold;
  text-align: center;
  margin-bottom: 10px;
  max-width: 90%;
  word-wrap: break-word;
}

@media (max-width: 768px) {
  .lightbox-title {
    font-size: 16px;
  }
}

/* ===========================
 Flag Mode Styles
 =========================== */

/* Flag icon buttons (gallery card & table row) */
.flag-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 2px 5px;
  border-radius: 3px;
  transition: all 0.2s;
  opacity: 0.5;
  line-height: 1;
}

.flag-btn:hover {
  opacity: 1;
  transform: scale(1.2);
}

.flag-btn.flagged {
  opacity: 1;
}

/* Lightbox flag button */
.lightbox-flag {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--sales-white);
  font-size: 22px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  transition: all 0.2s;
  z-index: var(--z-flag-btn);
  line-height: 1;
  display: none;
}

.lightbox-flag:hover {
  background: rgba(160, 0, 0, 0.5);
  border-color: var(--sales-red);
  transform: scale(1.1);
}

.lightbox-flag.flagged {
  background: rgba(160, 0, 0, 0.6);
  border-color: #ff6b6b;
}

/* Flag auth modal */
.flag-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: var(--z-flag-modal);
}

.flag-modal-content {
  background: #222;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 30px;
  max-width: 360px;
  width: 90%;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.flag-modal-content h3 {
  margin: 0 0 10px 0;
  color: var(--sales-white);
  font-size: 20px;
}

.flag-modal-content p {
  color: var(--sales-text-secondary);
  margin: 0 0 20px 0;
  font-size: 14px;
}

.flag-modal-content input[type="password"] {
  width: 100%;
  padding: 10px;
  background: #333;
  border: 1px solid #555;
  color: var(--sales-white);
  border-radius: 4px;
  box-sizing: border-box;
  font-size: 14px;
  margin-bottom: 15px;
}

.flag-modal-content input[type="password"]:focus {
  border-color: var(--sales-red);
  outline: none;
}

.flag-auth-error {
  color: #ff6b6b;
  font-size: 13px;
  margin-bottom: 10px;
  padding: 6px;
  background: rgba(255, 107, 107, 0.1);
  border-radius: 4px;
}

.flag-modal-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.flag-modal-btn {
  padding: 8px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
}

.flag-modal-confirm {
  background: var(--sales-red);
  color: var(--sales-white);
}

.flag-modal-confirm:hover {
  background: #c00;
}

.flag-modal-cancel {
  background: #555;
  color: var(--sales-white);
}

.flag-modal-cancel:hover {
  background: #666;
}

