/* OnlyFanOuts - Shared Styles */

/* Reset & Base */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { 
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; 
  background: #f3f4f6; 
  padding: 20px;
  line-height: 1.5;
}

/* Container */
.container {
  margin: 0 auto; 
  background: white; 
  border-radius: 8px; 
  box-shadow: 0 2px 8px rgba(0,0,0,0.1); 
  padding: 30px; 
}

/* Header */
.header { 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  margin-bottom: 30px; 
  border-bottom: 2px solid #e0e0e0; 
  padding-bottom: 20px; 
}

/* Typography */
h1 { color: #333; font-size: 28px; margin-bottom: 20px; }
h2 { font-size: 20px; margin-bottom: 15px; color: #444; }
h3 { font-size: 16px; margin-bottom: 10px; color: #555; }
.small { color: #666; font-size: 12px; }

/* Links */
a { color: #007bff; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Forms */
.form-section { 
  margin-bottom: 30px; 
  padding: 20px; 
  background: #f9f9f9; 
  border-radius: 6px; 
}
.form-section h2 { font-size: 20px; margin-bottom: 15px; color: #444; }
.form-group { margin-bottom: 15px; }

label { 
  display: block; 
  margin-bottom: 5px; 
  font-weight: 600; 
  color: #555; 
}

input[type="text"], 
input[type="email"],
input[type="password"],
input[type="date"], 
input[type="number"],
select,
textarea { 
  width: 100%; 
  padding: 10px; 
  border: 1px solid #ddd; 
  border-radius: 4px; 
  font-size: 14px; 
  font-family: inherit;
}

input[type="text"]:focus, 
input[type="email"]:focus,
input[type="password"]:focus,
input[type="date"]:focus, 
input[type="number"]:focus,
select:focus,
textarea:focus { 
  outline: none; 
  border-color: #007bff; 
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Buttons */
.btn { 
  display: inline-block;
  padding: 10px 20px; 
  border: none; 
  border-radius: 4px; 
  cursor: pointer; 
  font-size: 14px; 
  font-weight: 600; 
  text-decoration: none;
  text-align: center;
  transition: background-color 0.2s;
}

.btn-primary { background: #007bff; color: white; }
.btn-primary:hover { background: #0056b3; text-decoration: none; }

.btn-secondary { background: #6c757d; color: white; }
.btn-secondary:hover { background: #545b62; text-decoration: none; }

.btn-success { background: #28a745; color: white; }
.btn-success:hover { background: #218838; text-decoration: none; }

.btn-danger { background: #dc3545; color: white; }
.btn-danger:hover { background: #c82333; text-decoration: none; }

.btn-info { background: #17a2b8; color: white; }
.btn-info:hover { background: #138496; text-decoration: none; }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }

/* Action buttons row */
.action-buttons { display: flex; gap: 15px; margin-top: 20px; }

/* Tables */
table { width: 100%; border-collapse: collapse; margin-top: 20px; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid #ddd; }
th { background: #f8f9fa; font-weight: 600; color: #333; }
thead th { position: sticky; top: 0; background: #f8f9fa; z-index: 10; }
tbody tr:nth-child(odd) { background: #ffffff; }
tbody tr:nth-child(even) { background: #f5f5f5; }
tbody tr:hover { background: #eef6ff; }

/* Rotated table headers */
th.rotate { height: 180px; white-space: nowrap; vertical-align: bottom; padding: 8px 4px; }
th.rotate > div { transform: rotate(-90deg); transform-origin: bottom; margin-bottom: 10px; margin-left: 10px; width: 20px; text-align: left; }

/* Cards & Panels */
.card, .panel { 
  border: 1px solid #e5e7eb; 
  border-radius: 8px; 
  padding: 16px; 
  background: #fff; 
  margin-bottom: 20px;
}

.stats-card { 
  border: 1px solid #e5e7eb; 
  border-radius: 10px; 
  padding: 16px; 
  background: #fff; 
  box-shadow: 0 1px 2px rgba(0,0,0,0.03); 
}

/* KPI Grid */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
@media (max-width: 960px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 560px) { .kpi-grid { grid-template-columns: 1fr; } }

.kpi { 
  border: 1px solid #eef0f3; 
  background: #fafafa; 
  border-radius: 10px; 
  padding: 12px; 
}
.kpi .label { color: #6b7280; font-size: 12px; margin-bottom: 6px; }
.kpi .value { font-size: 20px; font-weight: 600; }
.kpi .muted { color: #9ca3af; font-size: 12px; margin-left: 6px; }

/* Grid layouts */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; }
@media (max-width: 768px) { 
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } 
}

.date-range { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
@media (max-width: 560px) { .date-range { grid-template-columns: 1fr; } }

/* Config grid */
.config-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 15px; }
.config-item { background: white; padding: 10px; border-radius: 4px; }
.config-item strong { display: block; margin-bottom: 5px; color: #555; }

/* Tags & Chips */
.chip { 
  display: inline-block; 
  padding: 2px 8px; 
  border: 1px solid #e5e7eb; 
  border-radius: 9999px; 
  background: #f9fafb; 
  font-size: 12px; 
  color: #374151; 
  margin: 2px 6px 2px 0; 
}
.chip-primary { background: #007bff; color: #fff; border-color: #0056b3; }
.chip-recency { background: #22c55e; color: #fff; border-color: #16a34a; cursor: help; }

.competitor-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 5px; }
.competitor-tag { 
  display: inline-block; 
  padding: 4px 12px; 
  background: #e9ecef; 
  border-radius: 12px; 
  font-size: 13px; 
  color: #495057; 
}

/* Dashboard */
.dashboard { margin-top: 30px; }
.dashboard-config { background: #e7f3ff; padding: 20px; border-radius: 6px; margin-bottom: 20px; }
.dashboard-config h3 { margin-bottom: 15px; color: #0056b3; }

/* Saved configs */
.saved-configs { margin-bottom: 20px; }
.saved-configs select { max-width: 400px; }

/* Search bar */
.search-bar { 
  display: flex; 
  gap: 8px; 
  align-items: flex-end; 
  flex-wrap: wrap; 
  margin-bottom: 16px;
}
.search-bar .fld { min-width: 0; height: 36px; box-sizing: border-box; }
.search-bar button { height: 36px; white-space: nowrap; }
.fld-q { flex: 1 1 380px; }
.fld-s { flex: 1 1 260px; }
.fld-f { flex: 0 0 180px; }

/* Top toolbar */
.top-row { 
  display: flex; 
  gap: 12px; 
  align-items: flex-end; 
  flex-wrap: wrap; 
  margin-bottom: 12px; 
}

/* Export bar */
.export-bar { 
  display: flex; 
  gap: 8px; 
  align-items: flex-end; 
  padding-left: 12px; 
  margin-left: auto; 
}
.export-bar h3 { margin: 0; font-size: 16px; font-weight: 600; }
.export-bar select, .export-bar button { height: 36px; box-sizing: border-box; }

/* Navigation */
.nav { display: flex; justify-content: space-between; margin: 12px 0; }

/* Filter banner */
.filter-banner { margin: 12px 0; font-size: 15px; color: #1f2937; }

/* Row actions */
.row-actions { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.row-actions a { margin-right: 8px; }

/* No data message */
.no-data { text-align: center; padding: 40px; color: #6c757d; font-size: 16px; }

/* Weight section (visibility builder) */
.weight-section { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 15px; }
.weight-item { background: white; padding: 15px; border-radius: 4px; }
.weight-item label { display: flex; justify-content: space-between; margin-bottom: 8px; }
.weight-value { color: #007bff; font-weight: bold; }
input[type="range"] { width: 100%; }

/* Competitor rows */
.competitor-row { 
  display: grid; 
  grid-template-columns: 1fr 1fr 1fr auto; 
  gap: 10px; 
  align-items: end; 
  margin-bottom: 10px; 
  padding: 10px; 
  background: white; 
  border-radius: 4px; 
}

/* Score & percentage display */
.score { font-size: 18px; font-weight: bold; }
.percentage { font-size: 18px; }
.mentions { font-size: 14px; }
.brand-name { font-weight: bold; color: #007bff; }

/* Stats row */
.stats-row { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; margin-top: 12px; text-align: left; }
@media (max-width: 960px) { .stats-row { grid-template-columns: 1fr; } }

.panel h3 { margin: 0 0 8px 0; font-size: 14px; color: #374151; }
.list-compact { margin: 0; padding-left: 18px;}

/* Responsive */
@media (max-width: 900px) {
  .fld-s, .fld-f, .search-bar button { flex-basis: 100%; }
  .export-bar { padding-left: 0; border-left: none; }
  th.actions-col, td.actions-col { width: 340px; }
}

@media (max-width: 640px) {
  .row-actions { flex-direction: column; align-items: flex-start; gap: 8px; }
  .row-actions .btn { width: auto; }
  .container { padding: 15px; border-radius: 0; }
}

/* Utility classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.hidden { display: none; }
