/* ============================================
   SearchOnline - Óticas Gassi
   ============================================ */

:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --success: #22c55e;
  --error: #ef4444;
  --warning: #f59e0b;
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-input: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #334155;
  --radius: 8px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand a {
  color: var(--text);
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: 700;
}

.nav-subtitle {
  color: var(--primary);
  font-size: 0.8rem;
  margin-left: 0.5rem;
}

.nav-links {
  display: flex;
  gap: 1rem;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  transition: all 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  background: var(--primary);
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-header h1 {
  font-size: 1.5rem;
}

.actions {
  display: flex;
  gap: 0.5rem;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: none;
  transition: all 0.2s;
  color: var(--text);
}

.btn-primary {
  background: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--bg-input);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-sm {
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
  background: var(--bg-input);
}

.btn-sm:hover {
  background: var(--primary);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Search */
.search-bar {
  margin-bottom: 1.5rem;
}

.search-bar input {
  width: 100%;
  padding: 0.8rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.95rem;
}

.search-bar input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Hashtag search box */
.hashtag-search-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin-bottom: 1.2rem;
}

.section-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
  font-weight: 600;
}

.keyword-box {
  border-left: 3px solid var(--warning);
}

.keyword-prefix {
  font-size: 1rem !important;
  color: var(--warning) !important;
  font-weight: 700;
}

.search-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hash-prefix {
  color: var(--primary);
  font-weight: 700;
  font-size: 1.3rem;
  padding: 0 0.3rem;
}

.search-row input {
  flex: 1;
  padding: 0.7rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.95rem;
}

.search-row input:focus {
  outline: none;
  border-color: var(--primary);
}

.quota-info {
  margin-top: 0.8rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.quota-label {
  margin-right: 0.3rem;
}

.quota-remaining {
  color: var(--success);
  margin-left: 0.3rem;
}

/* Hashtag chips */
.hashtag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.8rem;
  background: var(--bg-input);
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 20px;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.chip:hover {
  background: var(--border);
  color: var(--text);
}

.chip-active {
  background: var(--primary);
  color: white;
}

.chip-count {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.1rem 0.5rem;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
}

.post-hashtag-tag {
  display: inline-block;
  font-size: 0.7rem;
  color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

/* Status bar */
.status-bar {
  padding: 0.8rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.status-bar.info { background: #1e3a5f; color: #93c5fd; }
.status-bar.success { background: #14532d; color: #86efac; }
.status-bar.error { background: #450a0a; color: #fca5a5; }

/* Posts Grid */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s;
}

.post-card:hover {
  transform: translateY(-2px);
}

.post-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
}

.post-date {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.post-media {
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
}

.post-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-body {
  padding: 1rem;
}

.post-caption {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  word-break: break-word;
}

.post-footer {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 1rem;
  border-top: 1px solid var(--border);
}

.stat {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Badges */
.badge {
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-image { background: #3b82f6; color: white; }
.badge-video { background: #ef4444; color: white; }
.badge-carousel_album { background: #8b5cf6; color: white; }
.badge-mention { background: #f59e0b; color: white; }
.badge-success { background: #22c55e; color: white; }
.badge-error { background: #ef4444; color: white; }
.badge-running { background: #3b82f6; color: white; }

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
  padding: 1rem;
}

.pagination-info {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Stats Cards */
.stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  text-align: center;
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* Charts */
.charts-row {
  margin-bottom: 2rem;
}

.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.chart-container h3 {
  margin-bottom: 1rem;
  font-size: 1rem;
}

/* Tables */
.tables-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}

.table-container h3 {
  margin-bottom: 1rem;
  font-size: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 0.6rem 0.8rem;
  text-align: left;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--text-muted);
  font-weight: 600;
}

td a {
  color: var(--primary);
}

/* Empty state */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.empty-state p:first-child {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

/* Footer */
.footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

/* Responsive */
@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
  }

  .container {
    padding: 1rem;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

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

  .tables-row {
    grid-template-columns: 1fr;
  }

  .stats-cards {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .search-row input {
    width: 100%;
  }
}
