/* ========================================
   Amazon 除草剤商品データベース - カスタムCSS
   ダークテーマ + グリーンアクセント
   ======================================== */

/* --- CSS変数（デザイントークン） --- */
:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #1c2333;
    --bg-card: #1c2333;
    --bg-card-hover: #242d3d;
    --bg-input: #0d1117;
    --bg-sidebar: #131920;
    --bg-modal: #1c2333;

    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-tertiary: #6e7681;
    --text-link: #58a6ff;
    --text-white: #ffffff;

    --accent-green: #2ea043;
    --accent-green-light: #3fb950;
    --accent-green-dark: #238636;
    --accent-green-glow: rgba(46, 160, 67, 0.25);
    --accent-emerald: #10b981;
    --accent-teal: #14b8a6;
    --accent-lime: #84cc16;

    --accent-orange: #f59e0b;
    --accent-red: #ef4444;
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-pink: #ec4899;

    --border-default: #30363d;
    --border-light: #21262d;
    --border-active: #388bfd;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-glow-green: 0 0 20px rgba(46, 160, 67, 0.15);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;

    --font-sans: 'Inter', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* --- リセットとベース --- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    margin: 0;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- スクロールバー --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-default);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* --- ヘッダー --- */
.app-header {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-bottom: 1px solid var(--border-default);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1030;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.app-header .logo-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.app-header .logo-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--accent-green) 0%, var(--accent-emerald) 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: var(--shadow-glow-green);
}

.app-header .logo-text h1 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, var(--accent-green-light) 0%, var(--accent-emerald) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.app-header .logo-text .subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0;
}

/* --- ビュー切替ナビ --- */
.app-nav {
    display: inline-flex;
    gap: 0.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 0.2rem;
}

.app-nav button {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.35rem 0.85rem;
    border-radius: calc(var(--radius-md) - 3px);
    cursor: pointer;
    transition: all var(--transition-normal);
    white-space: nowrap;
}

.app-nav button:hover {
    color: var(--text-primary);
}

.app-nav button.active {
    background: var(--accent-green);
    color: #fff;
}

/* --- 統計ダッシュボードカード --- */
.stat-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.stat-card.green::before {
    background: linear-gradient(90deg, var(--accent-green) 0%, var(--accent-emerald) 100%);
}

.stat-card.blue::before {
    background: linear-gradient(90deg, var(--accent-blue) 0%, #60a5fa 100%);
}

.stat-card.orange::before {
    background: linear-gradient(90deg, var(--accent-orange) 0%, #fbbf24 100%);
}

.stat-card.purple::before {
    background: linear-gradient(90deg, var(--accent-purple) 0%, #a78bfa 100%);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-active);
}

.stat-card .stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
}

.stat-card.green .stat-icon {
    background: rgba(46, 160, 67, 0.15);
    color: var(--accent-green-light);
}

.stat-card.blue .stat-icon {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
}

.stat-card.orange .stat-icon {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-orange);
}

.stat-card.purple .stat-icon {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-purple);
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- 統計ダッシュボード（コンパクト横型・一行表示） --- */
.stat-card.compact {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.9rem;
}

.stat-card.compact .stat-icon {
    width: 34px;
    height: 34px;
    font-size: 1rem;
    margin-bottom: 0;
    flex-shrink: 0;
}

.stat-card.compact .stat-text {
    min-width: 0;
    overflow: hidden;
}

.stat-card.compact .stat-value {
    font-size: 1.2rem;
    margin-bottom: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-card.compact .stat-label {
    font-size: 0.68rem;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

@media (max-width: 575.98px) {
    .stat-card.compact {
        flex-direction: column;
        gap: 0.25rem;
        text-align: center;
        padding: 0.6rem 0.4rem;
    }
    .stat-card.compact .stat-value {
        font-size: 1rem;
    }
}

/* --- フィルタパネル（上部・横並び2行） --- */
.filter-panel {
    background: var(--bg-sidebar);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 0.9rem 1.1rem;
}

.filter-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.85rem;
}

.filter-bar-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.7rem 1rem;
}

.filter-bar-grid .filter-group {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.filter-bar-grid .filter-group-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}

.filter-history {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border-light);
}

.filter-history-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.5rem 1rem;
}

.filter-history-item {
    font-size: 0.72rem;
    padding: 0.35rem 0.5rem;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
}

@media (max-width: 1199.98px) {
    .filter-bar-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 991.98px) {
    .filter-bar-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 575.98px) {
    .filter-bar-grid { grid-template-columns: repeat(2, 1fr); }
}

/* --- サイドバーフィルタ --- */
.filter-sidebar {
    background: var(--bg-sidebar);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.filter-sidebar .filter-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-sidebar .filter-group {
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-light);
}

.filter-sidebar .filter-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.filter-sidebar .filter-group-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* --- フォームコントロール（Bootstrap 上書き） --- */
.form-control,
.form-select {
    background-color: var(--bg-input);
    border: 1px solid var(--border-default);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
    transition: all var(--transition-fast);
}

.form-control:focus,
.form-select:focus {
    background-color: var(--bg-input);
    border-color: var(--accent-green);
    color: var(--text-primary);
    box-shadow: 0 0 0 3px var(--accent-green-glow);
}

.form-control::placeholder {
    color: var(--text-tertiary);
}

.form-check-input {
    background-color: var(--bg-input);
    border-color: var(--border-default);
}

.form-check-input:checked {
    background-color: var(--accent-green);
    border-color: var(--accent-green);
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px var(--accent-green-glow);
    border-color: var(--accent-green);
}

.form-check-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* --- ボタン --- */
.btn-scrape {
    background: linear-gradient(135deg, var(--accent-green) 0%, var(--accent-green-dark) 100%);
    color: var(--text-white);
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.5rem 1.25rem;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-glow-green);
}

.btn-scrape:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--accent-green-light) 0%, var(--accent-green) 100%);
    color: var(--text-white);
    transform: translateY(-1px);
    box-shadow: 0 0 30px rgba(46, 160, 67, 0.3);
}

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

.btn-filter-reset {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
    transition: all var(--transition-fast);
}

.btn-filter-reset:hover {
    color: var(--accent-red);
    border-color: var(--accent-red);
    background: rgba(239, 68, 68, 0.1);
}

.btn-view-toggle .btn {
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
}

.btn-view-toggle .btn.active,
.btn-view-toggle .btn:hover {
    background: var(--accent-green);
    border-color: var(--accent-green);
    color: var(--text-white);
}

/* --- 商品カード --- */
.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition-normal);
    height: 100%;
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-green);
}

.product-card .card-img-wrapper {
    position: relative;
    width: 100%;
    padding-top: 100%; /* 1:1 アスペクト比 */
    background: #ffffff;
    overflow: hidden;
}

.product-card .card-img-wrapper img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 85%;
    max-height: 85%;
    object-fit: contain;
    transition: transform var(--transition-normal);
}

.product-card:hover .card-img-wrapper img {
    transform: translate(-50%, -50%) scale(1.05);
}

.product-card .card-badges {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 2;
}

.product-card .badge-fba {
    background: linear-gradient(135deg, #ff9900 0%, #ff6600 100%);
    color: #fff;
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
}

.product-card .badge-prime {
    background: linear-gradient(135deg, #00a8e1 0%, #0073b3 100%);
    color: #fff;
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
}

.product-card .badge-bestseller {
    background: linear-gradient(135deg, var(--accent-orange) 0%, #d97706 100%);
    color: #fff;
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
}

.product-card .badge-land-type {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    z-index: 2;
}

.badge-land-type.farm {
    background: rgba(46, 160, 67, 0.9);
    color: #fff;
}

.badge-land-type.non-farm {
    background: rgba(139, 92, 246, 0.9);
    color: #fff;
}

.badge-land-type.unknown {
    background: rgba(139, 148, 158, 0.85);
    color: #fff;
}

.product-card .card-body {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-card .card-title {
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card .card-brand {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.product-card .card-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-orange);
    margin-bottom: 0.25rem;
}

.product-card .card-price-unit {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    margin-bottom: 0.5rem;
}

.product-card .card-rating {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.product-card .card-rating .stars {
    color: var(--accent-orange);
    font-size: 0.8rem;
}

.product-card .card-rating .rating-value {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.product-card .card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: auto;
}

.product-card .meta-tag {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 3px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}

/* --- 商品テーブルビュー --- */
.product-table {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.product-table table {
    margin: 0;
    color: var(--text-primary);
}

.product-table thead th {
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-default);
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-fast);
    user-select: none;
}

.product-table thead th:hover {
    color: var(--accent-green-light);
    background: var(--bg-tertiary);
}

.product-table thead th.sorted {
    color: var(--accent-green-light);
}

.product-table tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition-fast);
    cursor: pointer;
}

.product-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.product-table tbody td {
    padding: 0.65rem 0.75rem;
    font-size: 0.82rem;
    vertical-align: middle;
    border-color: var(--border-light);
}

.product-table .table-img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 4px;
    background: #fff;
    padding: 2px;
}

.product-table .table-title {
    max-width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-table .table-price {
    font-weight: 700;
    color: var(--accent-orange);
    white-space: nowrap;
}

/* --- 検索バー --- */
.search-bar {
    position: relative;
}

.search-bar .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    font-size: 0.9rem;
    z-index: 2;
}

.search-bar input {
    padding-left: 2.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    height: 42px;
    font-size: 0.9rem;
}

.search-bar input:focus {
    border-color: var(--accent-green);
    box-shadow: 0 0 0 3px var(--accent-green-glow);
}

/* --- ページネーション --- */
.pagination-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem 0;
}

.pagination .page-link {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    transition: all var(--transition-fast);
    margin: 0 2px;
}

.pagination .page-link:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-green);
    color: var(--text-primary);
}

.pagination .page-item.active .page-link {
    background: var(--accent-green);
    border-color: var(--accent-green);
    color: var(--text-white);
}

.pagination .page-item.disabled .page-link {
    background: var(--bg-secondary);
    color: var(--text-tertiary);
    border-color: var(--border-light);
}

/* --- 商品詳細モーダル --- */
.modal-content {
    background: var(--bg-modal);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
}

.modal-header {
    border-bottom: 1px solid var(--border-default);
    padding: 1.25rem 1.5rem;
}

.modal-header .btn-close {
    filter: invert(1) grayscale(1) brightness(0.8);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border-default);
    padding: 1rem 1.5rem;
}

.detail-image {
    width: 100%;
    max-height: 350px;
    object-fit: contain;
    background: #ffffff;
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1.25rem;
}

.detail-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.detail-info-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
}

.detail-info-item .label {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.detail-info-item .value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* --- ローディング --- */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(13, 17, 23, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-default);
    border-top-color: var(--accent-green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-text {
    margin-top: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- スクレイピング進捗パネル --- */
.scrape-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: min(92vw, 460px);
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 1.75rem 1.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.scrape-panel .loading-text {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 600;
    text-align: center;
}

.scrape-bar {
    width: 100%;
    height: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: 6px;
    overflow: hidden;
    margin-top: 1rem;
}

.scrape-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-green) 0%, var(--accent-green-light) 100%);
    border-radius: 6px;
    transition: width 0.3s ease;
}

.scrape-bar-label {
    margin-top: 0.4rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent-green-light);
}

.scrape-stats {
    display: flex;
    gap: 1.25rem;
    margin-top: 0.75rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.scrape-stats strong {
    color: var(--text-primary);
}

.scrape-detail {
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

.scrape-log {
    margin-top: 1rem;
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.75rem;
    max-height: 132px;
    overflow-y: auto;
}

.scrape-log-line {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-family: ui-monospace, monospace;
    line-height: 1.6;
}

/* --- スクレイピング進捗 --- */
.scrape-progress {
    background: var(--bg-card);
    border: 1px solid var(--accent-green);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1rem;
    animation: fadeIn 0.3s ease;
}

.scrape-progress .progress {
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    margin-top: 0.75rem;
}

.scrape-progress .progress-bar {
    background: linear-gradient(90deg, var(--accent-green) 0%, var(--accent-emerald) 100%);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* --- 空状態 --- */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.9rem;
    max-width: 400px;
    margin: 0 auto;
}

/* --- トースト通知 --- */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    min-width: 300px;
}

.toast.success {
    border-left: 4px solid var(--accent-green);
}

.toast.error {
    border-left: 4px solid var(--accent-red);
}

.toast .toast-header {
    background: transparent;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}

.toast .toast-body {
    font-size: 0.85rem;
}

/* --- フッター --- */
.app-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-default);
    padding: 1.5rem 0;
    margin-top: 2rem;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.8rem;
}

/* --- レスポンシブ --- */
@media (max-width: 991.98px) {
    .filter-sidebar {
        position: static;
        max-height: none;
        margin-bottom: 1rem;
    }

    .stat-card .stat-value {
        font-size: 1.4rem;
    }
}

@media (max-width: 767.98px) {
    .app-header .logo-text h1 {
        font-size: 1rem;
    }

    .detail-info-grid {
        grid-template-columns: 1fr;
    }

    .product-table tbody td {
        font-size: 0.75rem;
        padding: 0.5rem;
    }

    .product-table .table-img {
        width: 36px;
        height: 36px;
    }
}

/* --- アニメーション --- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.fade-in {
    animation: fadeIn 0.4s ease forwards;
}

.product-card {
    animation: fadeIn 0.4s ease forwards;
}

/* アイテムの遅延アニメーション */
.product-card:nth-child(1) { animation-delay: 0.02s; }
.product-card:nth-child(2) { animation-delay: 0.04s; }
.product-card:nth-child(3) { animation-delay: 0.06s; }
.product-card:nth-child(4) { animation-delay: 0.08s; }
.product-card:nth-child(5) { animation-delay: 0.10s; }
.product-card:nth-child(6) { animation-delay: 0.12s; }
.product-card:nth-child(7) { animation-delay: 0.14s; }
.product-card:nth-child(8) { animation-delay: 0.16s; }

/* --- スクレイピング履歴テーブル --- */
.history-table {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-top: 1rem;
}

.history-table table {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.82rem;
}

.history-table thead th {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-default);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.6rem 0.75rem;
}

.history-table tbody td {
    padding: 0.5rem 0.75rem;
    border-color: var(--border-light);
}

.status-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 3px;
    font-weight: 600;
}

.status-badge.success {
    background: rgba(46, 160, 67, 0.15);
    color: var(--accent-green-light);
}

.status-badge.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.status-badge.partial {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-orange);
}

.status-badge.running {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
}

/* --- ソートアイコン --- */
.sort-icon {
    font-size: 0.7rem;
    margin-left: 4px;
    opacity: 0.4;
}

.sort-icon.active {
    opacity: 1;
    color: var(--accent-green-light);
}

/* --- フィルタアクティブ表示 --- */
.filter-active-count {
    background: var(--accent-green);
    color: var(--text-white);
    font-size: 0.65rem;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* --- ツールバー --- */
.toolbar {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.toolbar .result-count {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.toolbar .result-count strong {
    color: var(--text-primary);
}

/* --- Amazon リンクボタン --- */
.btn-amazon {
    background: linear-gradient(135deg, #ff9900 0%, #e68a00 100%);
    color: #111;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    font-weight: 700;
    font-size: 0.85rem;
    transition: all var(--transition-normal);
    text-decoration: none;
}

.btn-amazon:hover {
    background: linear-gradient(135deg, #ffad33 0%, #ff9900 100%);
    color: #111;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 153, 0, 0.3);
}

/* --- 価格レンジスライダー --- */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    background: var(--border-default);
    border-radius: 2px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-green);
    cursor: pointer;
    box-shadow: 0 0 6px rgba(46, 160, 67, 0.4);
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-green);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 6px rgba(46, 160, 67, 0.4);
}

/* --- 分類チャート（分析ビュー） --- */
.analytics-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.analytics-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.analytics-card {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
}

.analytics-card-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0.85rem;
}

.chart-wrap {
    position: relative;
    height: 320px;
}

/* 内訳リスト */
.breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.breakdown-item {
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.breakdown-item:hover {
    border-color: var(--accent-green);
    background: var(--bg-secondary);
}

.breakdown-item.active {
    border-color: var(--accent-green);
    background: rgba(46, 160, 67, 0.08);
}

.breakdown-item .bi-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: var(--text-primary);
}

.breakdown-item .bi-swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.breakdown-item .bi-label {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.breakdown-item .bi-pct {
    font-weight: 700;
    color: var(--accent-green-light);
    flex-shrink: 0;
}

.breakdown-item .bi-count {
    color: var(--text-tertiary);
    font-size: 0.75rem;
    flex-shrink: 0;
    min-width: 48px;
    text-align: right;
}

.breakdown-item .bi-bar {
    margin-top: 0.4rem;
    height: 6px;
    background: var(--border-default);
    border-radius: 3px;
    overflow: hidden;
}

.breakdown-item .bi-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}

/* 選択した分類の商品リスト */
.breakdown-products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.6rem;
}

.bp-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.bp-item:hover {
    border-color: var(--accent-green);
    background: var(--bg-secondary);
}

.bp-item img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    background: #fff;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.bp-item .bp-info {
    min-width: 0;
    flex: 1;
}

.bp-item .bp-title {
    font-size: 0.78rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.3;
}

.bp-item .bp-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.2rem;
    font-size: 0.72rem;
}

.bp-item .bp-price {
    color: var(--accent-orange);
    font-weight: 700;
}

