/**
 * GP Assembly Builder Pro v9.0 - Styles
 * Redesigned: Horizontal filters, 2-column results, side-by-side SVGs
 */

/* ==========================================================================
   CSS VARIABLES
   ========================================================================== */
:root {
  --gp-blue: #0066b2;
  --gp-blue-dark: #004d86;
  --gp-blue-light: #e6f2fa;
  --gp-blue-gradient: linear-gradient(135deg, #0066b2 0%, #004d86 100%);
  
  --success-green: #10b981;
  --success-light: #d1fae5;
  --warning-amber: #f59e0b;
  --warning-light: #fef3c7;
  
  --fire-gradient: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
  --stc-gradient: linear-gradient(135deg, #00b4d8 0%, #0077b6 100%);
  --stc-not-tested: linear-gradient(135deg, #6c757d 0%, #495057 100%);
  
  --text-dark: #1a1a1a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --panel-bg: #ffffff;
  --body-bg: #f8fafc;
  
  --card-shadow: 0 4px 6px -1px rgba(0,102,178,0.1), 0 2px 4px -1px rgba(0,102,178,0.06);
  --card-hover-shadow: 0 20px 25px -5px rgba(0,102,178,0.1), 0 10px 10px -5px rgba(0,102,178,0.04);
}

/* ==========================================================================
   BASE STYLES
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  background: linear-gradient(180deg, #f8fafc 0%, #e6f2fa 100%);
  min-height: 100vh;
  color: var(--text-dark);
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.header {
  background: var(--gp-blue-gradient);
  box-shadow: 0 4px 20px rgba(0,102,178,0.3);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-top {
  padding: 16px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1800px;
  margin: 0 auto;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  width: 52px;
  height: 52px;
  background: white;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  color: var(--gp-blue);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.header-title {
  color: white;
}

.header-title h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 2px;
}

.header-title p {
  font-size: 13px;
  opacity: 0.9;
}

.header-stats {
  display: flex;
  gap: 12px;
}

.stat-badge {
  background: rgba(255,255,255,0.12);
  padding: 10px 18px;
  border-radius: 10px;
  color: white;
  text-align: center;
}

.stat-badge .number {
  font-size: 22px;
  font-weight: 700;
  display: block;
}

.stat-badge .label {
  font-size: 10px;
  opacity: 0.9;
  text-transform: uppercase;
}

/* ==========================================================================
   MAIN CONTAINER
   ========================================================================== */
.main-container {
  max-width: 1800px;
  margin: 0 auto;
  padding: 24px 40px;
}

/* ==========================================================================
   FILTER SECTION - Horizontal 2 Rows
   ========================================================================== */
.filter-section {
  background: var(--panel-bg);
  border-radius: 16px;
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: var(--card-shadow);
}

.filter-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.filter-row:first-child {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-group label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.filter-group label .required {
  color: #ef4444;
}

.filter-group select {
  padding: 8px 12px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 13px;
  background: white;
  min-width: 100px;
  cursor: pointer;
}

.filter-group select:focus {
  outline: none;
  border-color: var(--gp-blue);
}

/* Small Button Groups */
.btn-group-sm {
  display: flex;
  gap: 4px;
}

.btn-option-sm {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border: 2px solid var(--border-color);
  background: white;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-option-sm:hover {
  border-color: var(--gp-blue);
  background: var(--gp-blue-light);
}

.btn-option-sm.selected {
  border-color: var(--gp-blue);
  background: var(--gp-blue);
  color: white;
}

.btn-option-sm svg {
  flex-shrink: 0;
}

/* Toggle Button */
.toggle-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 2px solid var(--border-color);
  background: white;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.toggle-btn:hover {
  border-color: var(--gp-blue);
}

.toggle-btn.active {
  border-color: var(--gp-blue);
  background: var(--gp-blue-light);
}

.toggle-switch {
  width: 32px;
  height: 18px;
  background: var(--border-color);
  border-radius: 9px;
  position: relative;
  transition: all 0.2s;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  background: white;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: all 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-btn.active .toggle-switch {
  background: var(--gp-blue);
}

.toggle-btn.active .toggle-switch::after {
  left: 16px;
}

/* Side Configuration Accordion */
.filter-group.side-config {
  flex: 1;
  min-width: 200px;
  max-width: 350px;
}

.side-accordion {
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background: white;
  overflow: hidden;
}

.side-accordion-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  background: #f8fafc;
  transition: background 0.2s;
}

.side-accordion-header:hover {
  background: #f1f5f9;
}

.side-accordion.open .side-accordion-header {
  background: var(--gp-blue-light);
  border-bottom: 1px solid var(--border-color);
}

.side-icon {
  width: 20px;
  height: 20px;
  background: var(--gp-blue);
  color: white;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.side-title {
  font-size: 12px;
  font-weight: 600;
}

.side-accordion-header .side-summary {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
}

.side-accordion-header .side-summary.configured {
  color: var(--success-green);
  font-weight: 600;
}

.side-accordion-header .chevron {
  color: var(--text-muted);
  transition: transform 0.2s;
}

.side-accordion.open .side-accordion-header .chevron {
  transform: rotate(180deg);
}

.side-accordion-content {
  display: none;
  padding: 12px;
}

.side-accordion.open .side-accordion-content {
  display: block;
}

.side-config-inner {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.layer-select {
  display: flex;
  align-items: center;
  gap: 8px;
}

.config-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.btn-group-xs {
  display: flex;
  gap: 4px;
}

.btn-xs {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-color);
  background: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-xs:hover {
  border-color: var(--gp-blue);
  background: var(--gp-blue-light);
}

.btn-xs.selected {
  border-color: var(--gp-blue);
  background: var(--gp-blue);
  color: white;
}

.layer-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.layer-row-compact {
  display: flex;
  gap: 6px;
}

.layer-row-compact.hidden {
  display: none;
}

.layer-row-compact select {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 11px;
}

/* Reset Button */
.reset-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 2px solid var(--border-color);
  background: white;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s;
  margin-top: auto;
}

.reset-btn:hover {
  border-color: #ef4444;
  color: #ef4444;
  background: #fee2e2;
}

/* ==========================================================================
   RESULTS SECTION
   ========================================================================== */
.results-section {
  min-height: 400px;
}

/* Welcome State */
.welcome-state {
  text-align: center;
  padding: 80px 40px;
  background: var(--panel-bg);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
}

.welcome-icon {
  width: 100px;
  height: 100px;
  margin: 0 auto 24px;
  background: var(--gp-blue-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gp-blue);
}

.welcome-state h2 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 12px;
}

.welcome-state p {
  color: var(--text-muted);
  font-size: 15px;
  max-width: 450px;
  margin: 0 auto;
}

/* Results Summary */
.results-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel-bg);
  border-radius: 12px;
  padding: 16px 24px;
  margin-bottom: 24px;
  box-shadow: var(--card-shadow);
}

.results-summary h2 {
  font-size: 18px;
  font-weight: 600;
}

.results-badges {
  display: flex;
  gap: 12px;
}

.badge {
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.badge.exact {
  background: var(--success-light);
  color: #047857;
}

.badge.similar {
  background: var(--warning-light);
  color: #b45309;
}

/* Results Groups */
.results-group {
  margin-bottom: 32px;
}

.group-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #f1f5f9;
}

.group-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.group-header .count {
  background: var(--gp-blue);
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
}

.group-header.exact .count {
  background: var(--success-green);
}

.group-header.similar .count {
  background: var(--warning-amber);
}

/* Assembly Cards Grid - 2 columns */
.assemblies-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

/* No Results */
.no-results {
  text-align: center;
  padding: 60px 40px;
  background: var(--panel-bg);
  border-radius: 16px;
}

.no-results h3 {
  font-size: 18px;
  margin-bottom: 8px;
}

.no-results p {
  color: var(--text-muted);
}

/* ==========================================================================
   ASSEMBLY CARD - New Layout
   ========================================================================== */
.assembly-card {
  background: var(--panel-bg);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: all 0.25s;
  border: 2px solid transparent;
}

.assembly-card:hover {
  box-shadow: var(--card-hover-shadow);
  transform: translateY(-2px);
}

.assembly-card.exact-match {
  border-color: var(--success-green);
}

.assembly-card.similar-match {
  border-color: var(--warning-amber);
}

/* Card Header */
.card-header {
  background: var(--gp-blue-gradient);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.assembly-card.exact-match .card-header {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.assembly-card.similar-match .card-header {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

.card-title-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.assembly-id {
  background: rgba(255,255,255,0.2);
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  font-family: monospace;
}

.assembly-name {
  color: white;
  font-size: 15px;
  font-weight: 600;
}

.rating-pills {
  display: flex;
  gap: 8px;
}

.rating-pill {
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 700;
  color: white;
}

.rating-pill.fire {
  background: var(--fire-gradient);
}

.rating-pill.stc {
  background: var(--stc-gradient);
}

.rating-pill.stc.not-tested {
  background: var(--stc-not-tested);
}

/* Card Body */
.card-body {
  padding: 20px;
}

/* SVG Section - Side by Side */
.drawings-row {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}

.drawing-box {
  flex: 1;
  background: #f8fafc;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.drawing-box.single {
  max-width: 60%;
  margin: 0 auto;
}

/* Design Label Pills - v9.2 */
.design-label-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 18px 6px 6px;
  border-radius: 25px;
  font-size: 13px;
  font-weight: 700;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.design-label-pill.fire {
  background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
  box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

.design-label-pill.sound {
  background: linear-gradient(135deg, #00b4d8 0%, #0077b6 100%);
  box-shadow: 0 2px 8px rgba(0, 180, 216, 0.3);
}

.pill-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.25);
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  font-size: 7px;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
}

.pill-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.25);
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
}

.pill-icon svg {
  stroke: white;
}

.pill-text {
  padding-right: 4px;
}

.design-label-pill.fire {
  background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
  box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

.design-label-pill.sound {
  background: linear-gradient(135deg, #00b4d8 0%, #0077b6 100%);
  box-shadow: 0 2px 8px rgba(0, 180, 216, 0.3);
}

/* Design References - v9.2 */
.design-reference {
  font-size: 12px;
  color: #64748b;
  text-align: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
  font-family: 'Inter', sans-serif;
  word-break: break-word;
  line-height: 1.4;
}

.design-note {
  font-size: 10px;
  color: #94a3b8;
  text-align: center;
  margin-top: 6px;
  font-style: italic;
  line-height: 1.4;
  padding: 0 8px;
}

/* Legacy drawing labels (kept for compatibility) */
.drawing-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.drawing-sublabel {
  font-size: 9px;
  color: #94a3b8;
  margin-bottom: 12px;
}

.svg-container {
  background: white;
  border-radius: 8px;
  padding: 16px;
  border: 1px solid #e2e8f0;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.svg-container svg {
  max-width: 100%;
  height: auto;
}

/* Details Grid - Updated for Load Bearing field */
.details-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f1f5f9;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.detail-value {
  font-size: 13px;
  font-weight: 500;
}

/* Assembly Description */
.assembly-description {
  margin-bottom: 16px;
}

.assembly-description h4 {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.assembly-description p {
  font-size: 12px;
  line-height: 1.5;
  color: #475569;
}

.assembly-description .fire-design-ref {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
  font-size: 12px;
  color: #475569;
}

/* Differences Box */
.differences-box {
  background: var(--warning-light);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
}

.differences-box h5 {
  font-size: 10px;
  font-weight: 700;
  color: #b45309;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.differences-box .diff-item {
  font-size: 12px;
  color: #b45309;
  margin-bottom: 2px;
}

/* PDF Link */
.links-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.pdf-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #dc6b2f;
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  transition: background 0.2s;
}

.pdf-link:hover {
  background: #b85a28;
}

.pdf-link.ul-link {
  background: #dc6b2f;
}

.pdf-link.ul-link:hover {
  background: #b85a28;
}

/* Approved Products */
.approved-products {
  background: var(--gp-blue-light);
  margin: -20px;
  margin-top: 0;
  padding: 16px 20px;
}

.approved-products h4 {
  font-size: 10px;
  font-weight: 700;
  color: var(--gp-blue);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.products-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.product-tag {
  background: white;
  color: var(--gp-blue);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.footer {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 12px;
}

.footer a {
  color: var(--gp-blue);
  text-decoration: none;
}

/* Version Badge */
.version-badge {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--gp-blue);
  color: white;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1400px) {
  .assemblies-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1000px) {
  .header-top {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }
  
  .filter-row {
    flex-direction: column;
  }
  
  .filter-group.side-config {
    max-width: none;
  }
  
  .details-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .drawings-row {
    flex-direction: column;
  }
  
  .drawing-box.single {
    max-width: none;
  }
}

@media (max-width: 600px) {
  .main-container {
    padding: 16px;
  }
  
  .details-grid {
    grid-template-columns: 1fr;
  }
}
