/* ==========================================================================
   Catawiki Analytics — Front-end Styles
   SWELL テーマに自然に馴染むデザイン
   ========================================================================== */

.cata-wrap {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 16px;
    font-family: inherit;
}

/* ---------- Filter ---------- */
.cata-filter {
    background: #f8f9fa;
    border: 1px solid #e2e6ea;
    border-radius: 8px;
    padding: 20px 24px;
    margin-bottom: 24px;
}

.cata-filter__row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.cata-filter__col label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}

.cata-filter__col select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccd0d5;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    appearance: auto;
    cursor: pointer;
    transition: border-color 0.2s;
}

.cata-filter__col select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.cata-filter__col select:disabled {
    background: #eee;
    color: #999;
    cursor: not-allowed;
}

/* Date filter row */
.cata-filter__row--date {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e6ea;
}

.cata-date-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccd0d5;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    transition: border-color 0.2s;
}

.cata-date-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Price filter row */
.cata-filter__row--price {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e6ea;
}

.cata-number-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccd0d5;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    transition: border-color 0.2s;
}

.cata-number-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* スピンボタンの非表示（すっきり見せる） */
.cata-number-input::-webkit-outer-spin-button,
.cata-number-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.cata-number-input[type=number] {
    -moz-appearance: textfield;
}

.cata-filter__col--btn {
    display: flex;
    align-items: flex-end;
}

.cata-btn-reset {
    padding: 8px 16px;
    border: 1px solid #ccd0d5;
    border-radius: 6px;
    background: #fff;
    font-size: 13px;
    color: #666;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.cata-btn-reset:hover {
    background: #f0f0f0;
    border-color: #999;
}

/* ---------- BlockUI Overlay ---------- */
.cata-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    border-radius: 8px;
}

.cata-overlay.is-active {
    opacity: 1;
    pointer-events: auto;
}

.cata-overlay .cata-spinner {
    width: 28px;
    height: 28px;
    border-width: 3px;
    margin: 0;
}

.cata-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #ddd;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: cata-spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

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

/* ---------- Date Error ---------- */
.cata-date-error {
    color: #dc2626;
    font-size: 12px;
    margin-top: 8px;
    min-height: 18px;
}

/* ---------- Exchange Rate ---------- */
.cata-exchange {
    font-size: 12px;
    color: #888;
    text-align: right;
    margin-bottom: 12px;
}

/* ---------- Stats Cards ---------- */
.cata-stats {
    margin-bottom: 32px;
}

.cata-stats__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.cata-card {
    background: #fff;
    border: 1px solid #e2e6ea;
    border-radius: 8px;
    padding: 16px 20px;
    text-align: center;
    transition: box-shadow 0.2s;
}

.cata-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.cata-card__label {
    font-size: 12px;
    color: #888;
    margin-bottom: 4px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.cata-card__value {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1.2;
}

.cata-card__sub {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

/* ---------- Charts ---------- */
.cata-charts {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.cata-chart-block {
    background: #fff;
    border: 1px solid #e2e6ea;
    border-radius: 8px;
    padding: 20px 24px;
}

.cata-chart-block__title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0 0 16px;
    padding: 0;
}

.cata-chart-block canvas {
    width: 100% !important;
    max-height: 360px;
}

/* ---------- Pie Chart Row ---------- */
.cata-pie-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.cata-pie-col {
    position: relative;
    text-align: center;
}

.cata-pie-label {
    font-size: 12px;
    font-weight: 600;
    color: #888;
    margin-bottom: 8px;
}

.cata-pie-col canvas {
    max-height: 220px !important;
}

.cata-pie-inactive {
    position: absolute;
    inset: 0;
    top: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(248, 249, 250, 0.9);
    border-radius: 6px;
    font-size: 12px;
    color: #aaa;
    pointer-events: none;
    line-height: 1.6;
}

.cata-pie-inactive.is-hidden {
    display: none;
}

/* ---------- Heatmap ---------- */
.cata-heatmap {
    overflow-x: auto;
}

.cata-heatmap table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    text-align: center;
}

.cata-heatmap th {
    padding: 4px 2px;
    font-weight: 600;
    color: #666;
    font-size: 11px;
}

.cata-heatmap td {
    padding: 6px 2px;
    border-radius: 3px;
    min-width: 28px;
    transition: background 0.2s;
}

.cata-heatmap__row-label {
    text-align: right;
    padding-right: 8px;
    font-weight: 600;
    color: #666;
    white-space: nowrap;
}

/* ---------- Top Items ---------- */
.cata-top-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cata-top-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid #e2e6ea;
    border-radius: 8px;
    transition: box-shadow 0.2s;
}

.cata-top-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.cata-top-item__rank {
    font-size: 20px;
    font-weight: 700;
    color: #ccc;
    min-width: 32px;
    text-align: center;
}

.cata-top-item__rank--1 { color: #f59e0b; }
.cata-top-item__rank--2 { color: #94a3b8; }
.cata-top-item__rank--3 { color: #b45309; }

.cata-top-item__body {
    flex: 1;
    min-width: 0;
}

.cata-top-item__title {
    font-size: 13px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cata-top-item__title a {
    color: #3b82f6;
    text-decoration: none;
}

.cata-top-item__title a:hover {
    text-decoration: underline;
}

.cata-top-item__meta {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
}

.cata-top-item__price {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
    white-space: nowrap;
}

.cata-top-item__price-jpy {
    font-size: 11px;
    color: #999;
    font-weight: 400;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .cata-filter__row {
        grid-template-columns: 1fr;
    }
    .cata-stats__grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .cata-card__value {
        font-size: 20px;
    }
    .cata-pie-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .cata-stats__grid {
        grid-template-columns: 1fr;
    }
}
