/* ===== CSS テーマ変数（JS で種別ごとに切り替え） ===== */
:root {
  --clr-primary:       #0284c7;
  --clr-primary-hover: #0369a1;
  --clr-light:         #e0f2fe;
  --clr-xlight:        #f0f9ff;
  --clr-border:        #b6d9f0;
  --clr-soft:          #d0eaf8;
  --clr-muted:         #7ec8e3;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: sans-serif; background: #f9fffe; color: #1a1a1a; display: flex; flex-direction: column; min-height: 100vh; }

/* ===== HEADER ===== */
.site-header { background: #fff; border-bottom: 2px solid var(--clr-primary); box-shadow: 0 1px 4px rgba(0,0,0,0.05); }
.header-inner { max-width: 1100px; margin: 0 auto; padding: 12px 1rem; display: flex; align-items: center; gap: 16px; }
.site-logo { height: 48px; width: auto; }
.header-tagline { font-size: 13px; color: var(--clr-primary); font-weight: 500; letter-spacing: 0.02em; }

/* ===== MAIN LAYOUT ===== */
.app { max-width: 1000px; margin: 0 auto; padding: 1.25rem 1rem 6rem; width: 100%; flex: 1; }

/* ===== TYPE TABS ===== */
.product-type-tabs { display: flex; gap: 0; margin-bottom: 1.25rem; border: 0.5px solid var(--clr-border); border-radius: 10px; overflow: hidden; }
.type-tab { flex: 1; padding: 9px 8px; font-size: 13px; font-weight: 500; text-align: center; cursor: pointer; background: transparent; border: none; color: var(--clr-primary); border-right: 0.5px solid var(--clr-border); transition: all 0.12s; }
.type-tab:last-child { border-right: none; }
.type-tab:hover { background: var(--clr-light); }
.type-tab.active { background: var(--clr-primary); color: #fff; }

/* ===== SEARCH / FILTERS ===== */
.top-bar { display: flex; gap: 10px; margin-bottom: 1rem; }
.search-wrap { flex: 1; position: relative; }
.search-wrap input { width: 100%; padding: 8px 12px 8px 32px; font-size: 14px; border: 0.5px solid var(--clr-border); border-radius: 8px; outline: none; background: #fff; }
.search-wrap input:focus { border-color: var(--clr-primary); }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--clr-muted); font-size: 14px; pointer-events: none; }

.filter-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; align-items: center; }
.filter-label { font-size: 11px; color: var(--clr-muted); min-width: 36px; }
.filter-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { font-size: 12px; padding: 4px 12px; border-radius: 99px; border: 0.5px solid var(--clr-border); background: transparent; cursor: pointer; color: var(--clr-primary); transition: all 0.12s; }
.tab:hover { background: var(--clr-light); }
.tab.active { background: var(--clr-primary); color: #fff; border-color: var(--clr-primary); }

/* ===== PRODUCT GRID ===== */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-top: 14px; }

.card { background: #fff; border: 0.5px solid var(--clr-soft); border-radius: 10px; padding: 14px 12px; cursor: pointer; transition: border-color 0.12s; position: relative; }
.card:hover { border-color: var(--clr-primary); }
.card.selected { border: 2px solid var(--clr-primary); background: var(--clr-xlight); }
.card-maker { font-size: 11px; color: var(--clr-muted); margin-bottom: 3px; }
.card-model { font-size: 13px; font-weight: 500; margin-bottom: 4px; word-break: break-all; }
.card-spec { font-size: 11px; color: #666; margin-bottom: 10px; }
.card-price { font-size: 17px; font-weight: 500; color: var(--clr-primary); }
.card-price-note { font-size: 10px; color: #aaa; margin-top: 1px; }
.card-check { position: absolute; top: 8px; right: 8px; width: 18px; height: 18px; border-radius: 50%; background: var(--clr-primary); display: none; align-items: center; justify-content: center; }
.card.selected .card-check { display: flex; }
.card-check svg { width: 10px; height: 10px; stroke: #fff; fill: none; stroke-width: 3; }
.no-result { font-size: 13px; color: #888; padding: 2rem; text-align: center; }
.load-more-wrap { grid-column: 1 / -1; text-align: center; margin-top: 4px; }
.btn-load-more { background: transparent; border: 0.5px solid var(--clr-border); border-radius: 8px; padding: 9px 24px; font-size: 13px; color: var(--clr-primary); cursor: pointer; width: 100%; }
.btn-load-more:hover { background: var(--clr-light); }

/* ===== ESTIMATE PANEL ===== */
.panel { background: #fff; border: 0.5px solid var(--clr-soft); border-radius: 10px; padding: 1rem 1.25rem; position: sticky; top: 16px; }
.panel h2 { font-size: 14px; font-weight: 600; color: var(--clr-primary); margin-bottom: 6px; }
.admin-link { display: block; font-size: 11px; color: var(--clr-border); text-decoration: none; margin-bottom: 12px; }
.admin-link:hover { color: var(--clr-primary); }
.panel-empty { font-size: 12px; color: #aaa; text-align: center; padding: 1.5rem 0; }

.est-item { padding: 10px 0; border-bottom: 0.5px solid var(--clr-soft); }
.est-item:last-of-type { border-bottom: none; }
.est-item-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; }
.est-item-name { font-size: 12px; font-weight: 500; flex: 1; }
.est-item-cat { font-size: 10px; color: #aaa; margin-top: 1px; }
.est-item-del { font-size: 14px; cursor: pointer; color: #aaa; padding: 1px 3px; }
.est-item-del:hover { color: #e53e3e; }
.est-item-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.qty-ctrl { display: flex; align-items: center; gap: 6px; }
.qbtn { width: 22px; height: 22px; border: 0.5px solid var(--clr-border); border-radius: 6px; background: #f9fffe; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; color: var(--clr-primary); }
.qbtn:hover { background: var(--clr-light); }
.qty-num { font-size: 13px; font-weight: 500; min-width: 16px; text-align: center; }
.est-subtotal { font-size: 13px; font-weight: 500; }

.est-footer { margin-top: 12px; padding-top: 12px; border-top: 0.5px solid var(--clr-border); }
.total-row { display: flex; justify-content: space-between; margin-bottom: 4px; }
.total-label { font-size: 12px; color: #666; }
.total-val { font-size: 12px; color: #666; }
.total-main { display: flex; justify-content: space-between; align-items: baseline; margin-top: 8px; }
.total-main-label { font-size: 13px; }
.total-main-val { font-size: 22px; font-weight: 600; color: var(--clr-primary); }
.tax-note { font-size: 10px; color: #aaa; text-align: right; margin-top: 2px; }

.est-actions { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.btn-main { background: var(--clr-primary); color: #fff; border: none; width: 100%; padding: 9px; border-radius: 8px; font-size: 13px; cursor: pointer; }
.btn-main:hover { background: var(--clr-primary-hover); }
.btn-sub { background: transparent; color: var(--clr-primary); border: 0.5px solid var(--clr-border); width: 100%; padding: 8px; border-radius: 8px; font-size: 12px; cursor: pointer; }
.btn-sub:hover { background: var(--clr-light); }

/* ===== FOOTER（ブランドカラー固定） ===== */
.site-footer { background: #0284c7; color: #fff; margin-top: auto; }
.footer-inner { max-width: 1100px; margin: 0 auto; padding: 24px 1rem; display: flex; gap: 32px; flex-wrap: wrap; justify-content: flex-start; }
.footer-branch { min-width: 200px; }
.branch-name { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.branch-addr { font-size: 12px; color: #bae6fd; line-height: 1.6; }
.footer-copy { text-align: center; padding: 10px 1rem 14px; font-size: 11px; color: #bae6fd; border-top: 1px solid rgba(255,255,255,0.15); }

/* ===== CONTACT MODAL ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 1rem; }
.modal-card { background: #fff; border-radius: 12px; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; box-shadow: 0 8px 32px rgba(0,0,0,0.18); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 12px; border-bottom: 0.5px solid var(--clr-soft); }
.modal-title { font-size: 15px; font-weight: 600; color: var(--clr-primary); }
.modal-close { background: none; border: none; font-size: 18px; color: #aaa; cursor: pointer; padding: 2px 6px; }
.modal-close:hover { color: #333; }

.modal-estimate-summary { background: var(--clr-xlight); border-bottom: 0.5px solid var(--clr-soft); padding: 12px 20px; }
.summary-title { font-size: 11px; color: var(--clr-primary); font-weight: 600; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.05em; }
.summary-row { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: #444; padding: 3px 0; }
.summary-total { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--clr-primary); margin-top: 8px; padding-top: 8px; border-top: 0.5px solid var(--clr-border); }

#contact-form { padding: 16px 20px 20px; }
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 500; color: #444; margin-bottom: 5px; }
.required { color: #e53e3e; font-size: 11px; }
.form-input, .form-textarea { width: 100%; padding: 8px 10px; font-size: 13px; border: 0.5px solid var(--clr-border); border-radius: 7px; outline: none; background: #fff; }
.form-input:focus, .form-textarea:focus { border-color: var(--clr-primary); }
.form-textarea { resize: vertical; font-family: sans-serif; }
.cf-error { font-size: 12px; color: #dc2626; background: #fef2f2; border-radius: 6px; padding: 8px 12px; margin-bottom: 12px; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; }
.modal-actions .btn-sub { flex: 1; }
.modal-actions .btn-main { flex: 2; }

.cf-success { padding: 32px 20px; text-align: center; }
.cf-success-icon { font-size: 40px; color: var(--clr-primary); margin-bottom: 12px; }
.cf-success-msg { font-size: 14px; color: #444; line-height: 1.7; }

/* ===== 商品詳細ポップアップ ===== */
.pm-card { max-width: 380px; }
.pm-maker-text { font-size: 12px; color: var(--clr-muted); font-weight: 500; }
.pm-body { padding: 16px 20px 8px; }
.pm-model { font-size: 20px; font-weight: 700; margin-bottom: 6px; line-height: 1.3; }
.pm-spec { font-size: 13px; color: #666; margin-bottom: 18px; }
.pm-price { font-size: 28px; font-weight: 700; color: var(--clr-primary); }
.pm-note { font-size: 11px; color: #aaa; margin-top: 3px; margin-bottom: 4px; }
.pm-actions { display: flex; gap: 8px; padding: 12px 20px 20px; }
.pm-actions .btn-sub  { flex: 1; }
.pm-actions .btn-main { flex: 1; }
.pm-btn-remove { color: #dc2626 !important; border-color: #dc2626 !important; }
.pm-btn-remove:hover { background: #fef2f2 !important; }

/* ===== 選択一覧パネル ===== */
#selection-list-panel {
  position: fixed; left: 0; right: 0;
  background: #fff;
  border-top: 2px solid var(--clr-primary);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.13);
  z-index: 199;
  max-height: 50vh; overflow-y: auto;
}
.sl-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 1.5rem; border-bottom: 0.5px solid var(--clr-soft);
  position: sticky; top: 0; background: #fff; z-index: 1;
}
.sl-title { font-size: 13px; font-weight: 700; color: var(--clr-primary); }
.sl-close { background: none; border: none; font-size: 18px; color: #aaa; cursor: pointer; line-height: 1; }
.sl-close:hover { color: #333; }
.sl-body { padding: 4px 0; }
.sl-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 1.5rem; border-bottom: 0.5px solid var(--clr-soft);
}
.sl-item:last-child { border-bottom: none; }
.sl-item-info { flex: 1; min-width: 0; }
.sl-item-name { font-size: 13px; font-weight: 600; }
.sl-item-sub  { font-size: 11px; color: #aaa; margin-top: 2px; }
.sl-item-price { font-size: 13px; font-weight: 600; color: var(--clr-primary); white-space: nowrap; }
.sl-item-del {
  background: none; border: 1px solid #e0e0e0; border-radius: 50%;
  width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: #aaa; cursor: pointer; flex-shrink: 0; transition: all 0.12s;
}
.sl-item-del:hover { background: #fef2f2; border-color: #dc2626; color: #dc2626; }

/* ===== フローティングバナー ===== */
#float-banner {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--clr-primary); color: #fff;
  padding: 12px 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  z-index: 200; box-shadow: 0 -3px 20px rgba(0,0,0,0.18);
}
.fb-info { flex: 1; min-width: 0; }
.fb-count { font-size: 14px; font-weight: 700; display: block; }
.fb-names { font-size: 11px; opacity: 0.75; display: block;
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.fb-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.fb-list-btn {
  background: rgba(255,255,255,0.2); color: #fff; border: 1px solid rgba(255,255,255,0.4);
  padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: background 0.12s;
}
.fb-list-btn:hover { background: rgba(255,255,255,0.3); }
.fb-list-btn.active { background: rgba(255,255,255,0.35); }
.fb-btn {
  background: #fff; color: var(--clr-primary); border: none;
  padding: 10px 18px; border-radius: 8px; font-size: 13px; font-weight: 700;
  cursor: pointer; white-space: nowrap; transition: background 0.12s;
}
.fb-btn:hover { background: var(--clr-xlight); }

/* ===== 見積もりモーダル ===== */
.est-modal-card {
  max-width: 500px; width: 100%;
  max-height: 90vh; display: flex; flex-direction: column;
}
.est-modal-body { padding: 4px 20px 20px; overflow-y: auto; flex: 1; }

/* ===== DROP ZONE ===== */
.drop-zone { border: 1.5px dashed var(--clr-border); border-radius: 8px; padding: 10px; text-align: center; font-size: 12px; color: #aaa; cursor: pointer; transition: all 0.15s; margin-top: 10px; }
.drop-zone:hover, .drop-zone.drag-over { border-color: var(--clr-primary); background: var(--clr-xlight); color: var(--clr-primary); }
.drop-status { font-size: 12px; margin-top: 6px; padding: 6px 10px; border-radius: 6px; }
.drop-status.success { background: #f0fdf4; color: #16a34a; }
.drop-status.error   { background: #fef2f2; color: #dc2626; }
