/*
 * Adpick Auto Affiliate - Card styles
 * For [aff_card] and [adpick_list] shortcodes
 */

/* ====== Grid layout ====== */
.aff-grid {
    display: grid;
    gap: 16px;
    margin: 20px 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.aff-grid--cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.aff-grid--cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.aff-grid--cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.aff-grid--cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.aff-grid--cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.aff-grid--cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }

@media (max-width: 1024px) {
    .aff-grid--cols-4,
    .aff-grid--cols-5,
    .aff-grid--cols-6 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
@media (max-width: 768px) {
    .aff-grid,
    .aff-grid--cols-3,
    .aff-grid--cols-4,
    .aff-grid--cols-5,
    .aff-grid--cols-6 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }
}
@media (max-width: 480px) {
    .aff-grid,
    .aff-grid--cols-2,
    .aff-grid--cols-3,
    .aff-grid--cols-4,
    .aff-grid--cols-5,
    .aff-grid--cols-6 {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
}

/* ====== Card base ====== */
.aff-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    text-decoration: none !important;
    color: inherit;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}
.aff-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    border-color: #d8d8d8;
}
.aff-card * { box-sizing: border-box; }

/* ====== Thumbnail ====== */
.aff-card__thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f6f6f6;
    overflow: hidden;
}
.aff-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.25s ease;
}
.aff-card:hover .aff-card__thumb img {
    transform: scale(1.04);
}

/* Discount badge */
.aff-card__badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #ef4444;
    color: #fff;
    font-weight: 700;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 6px;
    line-height: 1;
    letter-spacing: 0.02em;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* ====== Body ====== */
.aff-card__body {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

/* Mall row */
.aff-card__mall {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #888;
    line-height: 1.2;
    margin-bottom: 2px;
}
.aff-card__mall img {
    width: 16px;
    height: 16px;
    object-fit: contain;
    border-radius: 2px;
}

/* Title */
.aff-card__title {
    font-size: 14px;
    font-weight: 600;
    color: #222;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: keep-all;
}

/* Subtitle */
.aff-card__sub {
    font-size: 12px;
    color: #6b6b6b;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Price */
.aff-card__price {
    margin-top: auto;
    padding-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.aff-card__price-org {
    font-size: 12px;
    color: #b0b0b0;
    text-decoration: line-through;
    line-height: 1.2;
}
.aff-card__price-now {
    font-size: 16px;
    font-weight: 700;
    color: #111;
    line-height: 1.2;
}
.aff-card__price-now .currency {
    font-size: 13px;
    font-weight: 600;
    color: #444;
    margin-left: 2px;
}

/* CTA button */
.aff-card__cta {
    display: inline-block;
    margin-top: 10px;
    padding: 9px 12px;
    background: #2563eb;
    color: #fff !important;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    border-radius: 8px;
    line-height: 1.2;
    text-decoration: none !important;
    transition: background 0.15s ease;
}
.aff-card:hover .aff-card__cta {
    background: #1d4ed8;
}

/* ====== Compact variant ====== */
.aff-card--compact {
    flex-direction: row;
    align-items: stretch;
}
.aff-card--compact .aff-card__thumb {
    width: 110px;
    flex-shrink: 0;
    aspect-ratio: 1 / 1;
}
.aff-card--compact .aff-card__body {
    padding: 10px 12px;
    gap: 4px;
}
.aff-card--compact .aff-card__title {
    font-size: 13px;
    -webkit-line-clamp: 2;
}
.aff-card--compact .aff-card__sub {
    display: none;
}
.aff-card--compact .aff-card__price-now {
    font-size: 15px;
}
.aff-card--compact .aff-card__cta {
    margin-top: 6px;
    padding: 6px 10px;
    font-size: 12px;
}

/* ====== Auto-injected blocks (top/middle/bottom of post) ====== */
.aff-auto {
    margin: 28px 0;
    padding: 18px 18px 20px;
    background: #fafbfc;
    border: 1px solid #ececec;
    border-radius: 14px;
}
.aff-auto--top {
    background: #f3f8ff;
    border-color: #dbe7fb;
}
.aff-auto--middle {
    background: #fffdf3;
    border-color: #f3ecc4;
}
.aff-auto--bottom {
    background: #f5faf5;
    border-color: #d9ead9;
}
.aff-auto__title {
    margin: 0 0 14px;
    font-size: 17px;
    font-weight: 700;
    color: #222;
    line-height: 1.3;
    padding-left: 10px;
    border-left: 4px solid #2563eb;
}
.aff-auto .aff-grid {
    margin: 0;
}
@media (prefers-color-scheme: dark) {
    .aff-auto {
        background: #1a1a1a;
        border-color: #333;
    }
    .aff-auto--top { background: #15203a; border-color: #2c3a5f; }
    .aff-auto--middle { background: #2a2418; border-color: #4a3f1f; }
    .aff-auto--bottom { background: #1a261c; border-color: #2c402f; }
    .aff-auto__title { color: #f0f0f0; }
}

/* ====== Sidebar widget container ====== */
.aff-widget {
    margin: 0;
}
.aff-widget .aff-grid {
    margin: 0;
    gap: 10px;
}
/* 위젯 안에서는 폰트 살짝 축소 (사이드바 좁음) */
.aff-widget .aff-card__title { font-size: 13px; }
.aff-widget .aff-card__price-now { font-size: 14px; }
.aff-widget .aff-card__cta { padding: 7px 10px; font-size: 12px; }
.aff-widget .aff-card--compact .aff-card__thumb { width: 88px; }
.aff-widget .aff-card--compact .aff-card__title { font-size: 12px; }
.aff-widget .aff-card--compact .aff-card__price-now { font-size: 13px; }
.aff-widget .aff-card--compact .aff-card__cta { padding: 5px 8px; font-size: 11px; }

/* ====== Empty state ====== */
.aff-empty {
    padding: 24px;
    text-align: center;
    color: #888;
    font-size: 14px;
    background: #fafafa;
    border: 1px dashed #ddd;
    border-radius: 10px;
    margin: 16px 0;
}

/* ====== Dark mode (optional) ====== */
@media (prefers-color-scheme: dark) {
    .aff-card {
        background: #1f1f1f;
        border-color: #333;
    }
    .aff-card:hover {
        border-color: #555;
    }
    .aff-card__thumb {
        background: #2a2a2a;
    }
    .aff-card__title {
        color: #f0f0f0;
    }
    .aff-card__sub {
        color: #b0b0b0;
    }
    .aff-card__mall {
        color: #999;
    }
    .aff-card__price-org {
        color: #777;
    }
    .aff-card__price-now {
        color: #fff;
    }
    .aff-card__price-now .currency {
        color: #ccc;
    }
    .aff-empty {
        background: #1a1a1a;
        border-color: #444;
        color: #999;
    }
}
