﻿@import url('https://fonts.googleapis.com/css2?family=Rubik:wght@400;500;600;700;800;900&display=swap');

    /* ===== BASE ===== */
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    :root {
      /* Colores reales de integradosargentinos.com (extraídos del tema Brasilia) */
      --purple-from: #1BA9E2;   /* cyan-azul principal de la tienda */
      --purple-to: #34b7ec;     /* cyan accent */
      --purple-grad: linear-gradient(135deg, #1BA9E2, #34b7ec);
      --cyan: #34b7ec;
      --cyan-dark: #1BA9E2;
      --teal: #1BA9E2;
      --header-bg: #1a1a1a;
      --footer-bg: #1B1717;
      --adbar-bg: #1BA9E2;
      --body-bg: #f5f5f5;
      --white: #ffffff;
      --text-main: #3F3D38;
      --text-muted: #888;
      --text-light: #bbb;
      --border: #e8e8e8;
      --border-hover: #1BA9E2;
      --card-bg: #ffffff;
      --green: #2ecc71;
      --red: #e74c3c;
      --orange: #f97316;
      --shadow-sm: 0 1px 4px rgba(0,0,0,.07);
      --shadow: 0 4px 16px rgba(0,0,0,.10);
      --shadow-lg: 0 8px 40px rgba(0,0,0,.18);
      --radius: 10px;
      --radius-sm: 8px;
      --radius-price: 14px;
    }

    body {
      font-family: 'Rubik', sans-serif;
      background: var(--body-bg);
      color: var(--text-main);
      min-height: 100vh;
    }

    /* ===== BUILDER HEADER ===== */
    .builder-header {
      background: var(--header-bg);
      color: var(--white);
      padding: 22px 24px 20px;
      text-align: center;
      border-bottom: 3px solid var(--cyan);
    }
    .builder-header-logo {
      display: flex;
      justify-content: center;
      align-items: center;
      margin-bottom: 14px;
    }
    .builder-header-logo img {
      height: 44px;
      width: auto;
      object-fit: contain;
      filter: brightness(0) invert(1); /* logo blanco sobre fondo oscuro */
    }
    .builder-header h1 {
      font-size: clamp(20px, 4vw, 30px);
      font-weight: 900;
      letter-spacing: -0.5px;
      margin-bottom: 6px;
      line-height: 1.15;
    }
    .builder-header h1 span {
      color: var(--cyan);
    }
    .builder-header p {
      font-size: 14px;
      color: var(--text-light);
      font-weight: 400;
    }
    .header-steps {
      display: flex;
      justify-content: center;
      gap: 6px;
      margin-top: 16px;
      flex-wrap: wrap;
    }
    .header-step {
      font-size: 11px;
      font-weight: 600;
      padding: 4px 12px;
      border-radius: 20px;
      background: rgba(255,255,255,.08);
      color: var(--text-light);
      border: 1px solid rgba(255,255,255,.12);
    }
    .header-step.active {
      background: var(--purple-grad);
      color: white;
      border-color: transparent;
    }

    /* ===== MAIN LAYOUT ===== */
    .builder-body {
      display: grid;
      grid-template-columns: 1fr 360px;
      gap: 20px;
      max-width: 1240px;
      margin: 20px auto;
      padding: 0 16px 40px;
    }
    @media (max-width: 900px) {
      .builder-body { grid-template-columns: 1fr; }
    }

    /* ===== COMPONENT SLOTS ===== */
    .slots-panel {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .slots-section-title {
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 1.5px;
      color: var(--text-muted);
      padding: 4px 0 6px;
    }

    .slot {
      background: var(--white);
      border: 1.5px solid var(--border);
      border-radius: var(--radius);
      padding: 12px 14px;
      cursor: pointer;
      transition: border-color .18s, box-shadow .18s, transform .12s;
      display: flex;
      align-items: center;
      gap: 12px;
      position: relative;
      overflow: hidden;
    }
    .slot::before {
      content: '';
      position: absolute;
      left: 0; top: 0; bottom: 0;
      width: 3px;
      background: transparent;
      transition: background .18s;
    }
    .slot:hover { border-color: var(--purple-from); box-shadow: var(--shadow); transform: translateY(-1px); }
    .slot:hover::before { background: var(--purple-grad); }
    .slot.selected { border-color: var(--purple-from); }
    .slot.selected::before { background: var(--purple-grad); }
    .slot.empty-slot { border-style: dashed; border-color: #ddd; }

    .slot-thumb {
      width: 52px;
      height: 52px;
      border-radius: var(--radius-sm);
      overflow: hidden;
      background: var(--body-bg);
      flex-shrink: 0;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .slot-thumb img {
      width: 100%;
      height: 100%;
      object-fit: contain;
    }
    .slot-thumb-icon {
      font-size: 26px;
      opacity: .35;
    }
    .slot-thumb-icon svg {
      width: 30px; height: 30px;
      color: var(--text-muted);
      opacity: .7;
    }

    .slot-info { flex: 1; min-width: 0; }
    .slot-label {
      font-size: 10px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: .8px;
      color: var(--text-muted);
      margin-bottom: 2px;
    }
    .slot-name {
      font-size: 13px;
      font-weight: 600;
      color: var(--text-main);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      line-height: 1.3;
    }
    .slot.empty-slot .slot-name { color: var(--text-light); font-weight: 400; font-size: 13px; }
    .slot-price {
      font-size: 13px;
      font-weight: 700;
      color: var(--purple-from);
      margin-top: 3px;
    }
    .slot-price-regular {
      font-size: 10px;
      color: var(--text-muted);
      text-decoration: line-through;
      margin-top: 1px;
    }
    .slot-optional-tag {
      font-size: 10px;
      padding: 1px 6px;
      border-radius: 20px;
      font-weight: 600;
      background: #f0f0f0;
      color: var(--text-muted);
      margin-top: 3px;
      display: inline-block;
    }

    .slot-actions { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }
    .qty-stepper { display: flex; align-items: center; gap: 4px; }
    .qty-btn {
      width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--purple-from);
      background: transparent; color: var(--purple-from); font-size: 14px; font-weight: 700;
      cursor: pointer; display: flex; align-items: center; justify-content: center; line-height: 1;
      transition: background .15s, color .15s;
    }
    .qty-btn:hover { background: var(--purple-from); color: white; }
    .qty-val { font-size: 12px; font-weight: 700; color: var(--text); min-width: 20px; text-align: center; }
    .btn-remove {
      width: 26px; height: 26px;
      border-radius: 50%;
      border: none;
      background: #f0f0f0;
      color: var(--text-muted);
      cursor: pointer;
      font-size: 12px;
      display: flex; align-items: center; justify-content: center;
      transition: background .15s, color .15s;
    }
    .btn-remove:hover { background: var(--red); color: white; }
    .btn-change {
      font-size: 11px; font-weight: 700;
      padding: 5px 12px;
      border-radius: 20px;
      border: 1.5px solid var(--purple-from);
      background: transparent;
      color: var(--purple-from);
      cursor: pointer;
      transition: background .15s, color .15s;
      white-space: nowrap;
    }
    .btn-change:hover { background: var(--purple-grad); color: white; border-color: transparent; }

    .slot-cta {
      font-size: 11px;
      font-weight: 700;
      color: var(--cyan-dark);
      display: flex;
      align-items: center;
      gap: 4px;
      flex-shrink: 0;
    }
    .slot-cta::after { content: '›'; font-size: 16px; }

    /* ===== LOADING / ERROR ===== */
    .state-banner {
      background: var(--white);
      border: 1.5px solid var(--border);
      border-radius: var(--radius);
      padding: 40px 24px;
      text-align: center;
      color: var(--text-muted);
    }
    .spinner {
      width: 36px; height: 36px;
      border: 3px solid var(--border);
      border-top-color: var(--purple-from);
      border-radius: 50%;
      animation: spin .7s linear infinite;
      margin: 0 auto 16px;
    }
    @keyframes spin { to { transform: rotate(360deg); } }
    .state-banner.error { border-color: #fca5a5; background: #fff5f5; color: var(--red); }

    /* ===== SUMMARY PANEL ===== */
    .summary-panel {
      position: sticky;
      top: 16px;
      align-self: start;
      display: flex;
      flex-direction: column;
      gap: 12px;
    }
    .summary-card {
      background: var(--white);
      border: 1.5px solid var(--border);
      border-radius: var(--radius);
      overflow: hidden;
      box-shadow: var(--shadow-sm);
    }
    .summary-header {
      background: var(--header-bg);
      color: white;
      padding: 14px 18px;
      font-weight: 700;
      font-size: 14px;
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .summary-header-dot {
      width: 8px; height: 8px;
      border-radius: 50%;
      background: var(--cyan);
    }
    .summary-items {
      padding: 8px 0;
      max-height: 380px;
      overflow-y: auto;
    }
    .summary-item {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 7px 16px;
      border-bottom: 1px solid #f5f5f5;
    }
    .summary-item:last-child { border-bottom: none; }
    .summary-item-thumb {
      width: 34px; height: 34px;
      border-radius: 6px;
      background: var(--body-bg);
      flex-shrink: 0;
      overflow: hidden;
      display: flex; align-items: center; justify-content: center;
      font-size: 16px;
    }
    .summary-item-thumb img { width: 100%; height: 100%; object-fit: contain; }
    .summary-item-info { flex: 1; min-width: 0; }
    .summary-item-label { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted); }
    .summary-item-name { font-size: 11px; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
    .summary-item-price { font-size: 12px; font-weight: 800; color: var(--purple-from); flex-shrink: 0; }
    .summary-item.empty .summary-item-name { color: #ccc; font-style: italic; }
    .summary-item.empty .summary-item-price { display: none; }
    .summary-item.empty .summary-item-thumb { opacity: .25; }

    .summary-footer { padding: 14px 18px; background: #fafafa; border-top: 1.5px solid var(--border); }
    .summary-total-row {
      display: flex;
      justify-content: space-between;
      align-items: baseline;
      margin-bottom: 2px;
    }
    .summary-total-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
    .summary-total-price {
      font-size: 26px;
      font-weight: 900;
      color: var(--text-main);
      letter-spacing: -1px;
    }
    .summary-parts-count { font-size: 11px; color: var(--text-muted); margin-bottom: 12px; }

    .power-estimate {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 11px;
      color: var(--text-muted);
      background: #fff8f0;
      border: 1px solid #ffe0b2;
      border-radius: 8px;
      padding: 8px 10px;
      margin-bottom: 12px;
    }
    .power-estimate strong { color: var(--orange); font-weight: 800; }

    /* Botón carrito — igual al de la tienda */
    .btn-cart {
      width: 100%;
      padding: 14px;
      border-radius: var(--radius-price);
      border: none;
      background: var(--purple-grad);
      color: white;
      font-family: 'Rubik', sans-serif;
      font-size: 14px;
      font-weight: 800;
      letter-spacing: .4px;
      cursor: pointer;
      transition: opacity .15s, transform .1s, box-shadow .15s;
      box-shadow: 0 4px 20px rgba(27,169,226,.40);
    }
    .btn-cart:hover { opacity: .9; transform: translateY(-1px); box-shadow: 0 6px 24px rgba(27,169,226,.55); }
    .btn-cart:active { transform: translateY(0); }
    .btn-cart:disabled { background: #ddd; color: #aaa; cursor: not-allowed; transform: none; box-shadow: none; }

    .btn-clear {
      width: 100%;
      padding: 9px;
      border-radius: var(--radius-sm);
      border: 1.5px solid var(--border);
      background: transparent;
      color: var(--text-muted);
      font-family: 'Rubik', sans-serif;
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      margin-top: 8px;
      transition: background .15s, color .15s;
    }
    .btn-clear:hover { background: #f5f5f5; color: var(--red); border-color: var(--red); }

    /* ===== MODAL ===== */
    .builder-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,.65);
      z-index: 900;
      display: flex;
      align-items: flex-end;
      justify-content: center;
      animation: fadeIn .15s ease;
    }
    @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
    @media (min-width: 640px) {
      .builder-overlay { align-items: center; }
    }

    .builder-modal {
      background: var(--white);
      border-radius: 20px 20px 0 0;
      width: 100%;
      max-width: 900px;
      max-height: 92vh;
      display: flex;
      flex-direction: column;
      animation: slideUp .22s ease;
      box-shadow: var(--shadow-lg);
    }
    @media (min-width: 640px) {
      .builder-modal { border-radius: var(--radius); max-height: 88vh; }
    }
    @keyframes slideUp { from { transform: translateY(50px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

    .modal-header {
      padding: 18px 22px 14px;
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-shrink: 0;
      background: var(--header-bg);
      border-radius: 20px 20px 0 0;
    }
    @media (min-width: 640px) {
      .modal-header { border-radius: var(--radius) var(--radius) 0 0; }
    }
    .modal-title { font-size: 17px; font-weight: 800; color: white; }
    .modal-subtitle { font-size: 12px; color: var(--text-light); margin-top: 2px; }
    .modal-close {
      width: 32px; height: 32px;
      border-radius: 50%;
      border: none;
      background: rgba(255,255,255,.12);
      font-size: 16px;
      cursor: pointer;
      display: flex; align-items: center; justify-content: center;
      color: white;
      transition: background .15s;
    }
    .modal-close:hover { background: rgba(255,255,255,.22); }

    .modal-filters {
      padding: 12px 22px;
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      gap: 10px;
      flex-shrink: 0;
      background: #fafafa;
    }
    .filter-search {
      flex: 1;
      padding: 9px 14px;
      border: 1.5px solid var(--border);
      border-radius: 22px;
      font-size: 13px;
      font-family: 'Rubik', sans-serif;
      outline: none;
      transition: border-color .15s;
      background: white;
    }
    .filter-search:focus { border-color: var(--purple-from); }
    .filter-count {
      font-size: 12px;
      color: var(--text-muted);
      white-space: nowrap;
      font-weight: 600;
    }

    .modal-body {
      overflow-y: auto;
      flex: 1;
      padding: 16px 22px;
    }

    .compat-notice {
      background: linear-gradient(135deg, rgba(27,169,226,.06), rgba(123,47,242,.06));
      border: 1.5px solid rgba(27,169,226,.20);
      border-radius: var(--radius-sm);
      padding: 10px 14px;
      font-size: 12px;
      color: var(--purple-from);
      margin-bottom: 14px;
      font-weight: 500;
    }

    /* ===== PRODUCT GRID ===== */
    .products-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
      gap: 12px;
    }
    @media (max-width: 500px) {
      .products-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    }

    .product-card {
      border: 1.5px solid var(--border);
      border-radius: var(--radius);
      overflow: hidden;
      cursor: pointer;
      transition: border-color .15s, box-shadow .15s, transform .12s;
      display: flex;
      flex-direction: column;
      background: var(--white);
      position: relative;
    }
    .product-card:hover {
      border-color: var(--purple-from);
      box-shadow: 0 4px 20px rgba(27,169,226,.20);
      transform: translateY(-2px);
    }
    .product-card.incompatible {
      opacity: .4;
      filter: grayscale(50%);
    }
    .product-card.incompatible:hover {
      border-color: var(--border);
      transform: none;
      box-shadow: none;
      cursor: not-allowed;
    }
    .product-card.currently-selected {
      border-color: var(--green);
      box-shadow: 0 0 0 2px rgba(46,204,113,.2);
    }
    .product-card.currently-selected::after {
      content: '✓';
      position: absolute;
      top: 8px; right: 8px;
      width: 22px; height: 22px;
      background: var(--green);
      color: white;
      border-radius: 50%;
      font-size: 12px;
      font-weight: 900;
      display: flex; align-items: center; justify-content: center;
      line-height: 1;
    }

    /* imagen grande y real */
    .product-img-wrap {
      width: 100%;
      aspect-ratio: 1;
      background: var(--body-bg);
      display: flex;
      align-items: center;
      justify-content: center;
      overflow: hidden;
      padding: 12px;
    }
    .product-img {
      width: 100%;
      height: 100%;
      object-fit: contain;
      transition: transform .25s ease;
    }
    .product-card:hover .product-img { transform: scale(1.05); }
    .product-img-placeholder {
      font-size: 42px;
      opacity: .25;
    }
    .product-img-placeholder svg {
      width: 52px; height: 52px;
      color: var(--text-muted);
    }
    .summary-item-thumb svg {
      width: 20px; height: 20px;
      color: var(--text-muted);
    }

    .product-body {
      padding: 10px 12px 12px;
      flex: 1;
      display: flex;
      flex-direction: column;
      border-top: 1px solid var(--border);
    }
    .product-cuotas {
      font-size: 10px;
      color: var(--text-muted);
      margin-bottom: 4px;
      font-weight: 400;
    }
    .product-name {
      font-size: 12px;
      font-weight: 500;
      color: var(--text-main);
      line-height: 1.4;
      flex: 1;
      margin-bottom: 8px;
      display: -webkit-box;
      -webkit-line-clamp: 3;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }
    .product-tags { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 8px; }
    .product-tag {
      font-size: 9px;
      font-weight: 700;
      padding: 2px 5px;
      border-radius: 4px;
      background: rgba(27,169,226,.12);
      color: var(--purple-from);
      text-transform: uppercase;
      letter-spacing: .3px;
    }
    .product-tag.tag-ddr4 { background: #dbeafe; color: #1d4ed8; }
    .product-tag.tag-ddr5 { background: #dcfce7; color: #15803d; }
    .product-tag.tag-am4 { background: #fff3e0; color: #e65100; }
    .product-tag.tag-am5 { background: #fce4ec; color: #c62828; }
    .product-tag.tag-lga { background: #e3f2fd; color: #0277bd; }
    .product-tag.tag-atx { background: #f3f3f3; color: #555; }
    .product-tag.tag-watts { background: #fff8e1; color: #f57f17; }

    .product-incompat {
      font-size: 10px;
      color: var(--red);
      margin-bottom: 6px;
      font-style: italic;
      line-height: 1.3;
    }

    /* precios — dos bloques como la tienda */
    .product-prices { display: flex; flex-direction: column; gap: 4px; margin-top: auto; }

    .product-price-wrap {
      background: var(--purple-grad);
      border-radius: var(--radius-price);
      padding: 7px 10px 5px;
    }
    .product-price {
      font-size: 15px;
      font-weight: 900;
      color: white;
      letter-spacing: -.3px;
      line-height: 1.1;
    }
    .product-price-sub {
      font-size: 9px;
      color: rgba(255,255,255,0.80);
      font-weight: 600;
      margin-top: 1px;
    }

    .product-price-card {
      background: #f0f0f4;
      border-radius: var(--radius-price);
      padding: 5px 10px 4px;
    }
    .product-price-card-amount {
      font-size: 13px;
      font-weight: 700;
      color: var(--text);
      line-height: 1.1;
    }
    .product-price-card-label {
      font-size: 9px;
      color: var(--text-muted);
      font-weight: 500;
      margin-top: 1px;
    }

    .product-stock {
      font-size: 10px;
      color: var(--green);
      font-weight: 600;
      margin-top: 6px;
      display: flex;
      align-items: center;
      gap: 3px;
    }
    .product-stock.out { color: var(--red); }
    .product-stock::before { content: '●'; font-size: 7px; }
    .product-stock.out::before { content: '●'; }

    .no-products {
      text-align: center;
      padding: 50px 20px;
      color: var(--text-muted);
    }
    .no-products .np-icon { font-size: 44px; margin-bottom: 12px; opacity: .4; }

    /* ===== CONFIG WARNING ===== */
    .config-warning {
      background: #fffbf0;
      border: 1.5px solid #ffe082;
      border-radius: var(--radius);
      padding: 28px;
      text-align: center;
    }
    .config-warning h3 { color: #e65100; margin-bottom: 8px; font-size: 16px; }
    .config-warning p { color: var(--text-main); font-size: 14px; line-height: 1.7; }
    .config-warning code {
      background: #f0f0f0;
      padding: 2px 6px;
      border-radius: 4px;
      font-size: 13px;
      color: var(--purple-from);
      font-family: monospace;
    }

    /* ===== TOAST ===== */
    .toast {
      position: fixed;
      bottom: 28px;
      left: 50%;
      transform: translateX(-50%);
      background: var(--header-bg);
      color: white;
      padding: 12px 22px;
      border-radius: 30px;
      font-family: 'Rubik', sans-serif;
      font-size: 13px;
      font-weight: 600;
      z-index: 9999;
      animation: toastIn .2s ease;
      white-space: nowrap;
      box-shadow: var(--shadow-lg);
      border-left: 3px solid var(--cyan);
    }
    @keyframes toastIn {
      from { opacity: 0; transform: translateX(-50%) translateY(12px); }
      to   { opacity: 1; transform: translateX(-50%) translateY(0); }
    }