/* ============================================================
   Plugin Hiển Thị Mã Giảm Giá v2.4
   Tất cả màu sắc dùng CSS variables — được inject từ settings
   ============================================================ */

/* ── Reset cục bộ: chống theme/WooCommerce override layout ── */
.cdp-carousel,
.cdp-carousel * {
    box-sizing: border-box;
}
.cdp-carousel p {
    margin: 0 0 4px !important;
    padding: 0 !important;
    line-height: 1.4 !important;
    float: none !important;
    clear: none !important;
    width: auto !important;
}
.cdp-carousel ul,
.cdp-carousel ol {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Wrapper ngoài cùng: chứa cả mũi tên + list theo chiều ngang */
.cdp-carousel {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

/* ── Danh sách coupon ── */
.cdp-list {
    display: flex;
    flex-direction: row;
    gap: 14px;
    flex: 1;
    min-width: 0;                       /* quan trọng: cho phép flex child co lại */
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    padding: 8px 2px 8px;
    /* Ẩn scrollbar — dùng nút mũi tên để điều hướng */
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.cdp-list::-webkit-scrollbar { display: none; }

@media (max-width: 767px) {
    .cdp-carousel { gap: 0; }
}

/* ── Thẻ coupon ── */
.cdp-card {
    display: flex;
    flex: 0 0 auto;
    width: 280px;
    background-color: var(--cdp-bg, #fff5f5);
    border: 1px solid var(--cdp-border, #ddd);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
    transition: box-shadow 0.2s ease;
}
.cdp-card:hover { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12); }

.cdp-card.cdp-expired {
    opacity: 0.55;
    filter: grayscale(40%);
}

/* ── Nội dung trái ── */
.cdp-card-left {
    padding: 14px 12px;
    flex: 1;
    min-width: 0;
}

.cdp-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--cdp-primary, #e60000);
    margin: 0 0 4px;
    line-height: 1.2;
}

.cdp-subtitle {
    font-size: 13px;
    color: var(--cdp-primary, #e60000);
    margin: 0 0 4px;
    opacity: 0.85;
}

.cdp-desc {
    font-size: 12px;
    color: var(--cdp-muted, #666);
    margin: 0 0 4px;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.cdp-expiry {
    font-size: 11px;
    color: var(--cdp-muted, #666);
    margin: 4px 0 0;
}
.cdp-expiry.cdp-expired-label {
    color: #b00;
    font-weight: 600;
}

/* ── Nút bên phải ── */
.cdp-card-right {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 12px;
    border-left: 1px dashed var(--cdp-border, #ddd);
    min-width: 78px;
}

.cdp-btn {
    background-color: var(--cdp-primary, #e60000);
    color: #fff;
    border: none;
    padding: 9px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition: background-color 0.15s ease, transform 0.1s ease;
    user-select: none;
}
.cdp-btn:hover { filter: brightness(0.88); }
.cdp-btn:active { transform: scale(0.96); }
.cdp-btn.cdp-copied {
    background-color: #28a745;
    cursor: default;
}
.cdp-btn-disabled {
    background-color: #aaa;
    color: #fff;
    padding: 9px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

/* ── Mũi tên carousel — flex item, KHÔNG absolute ── */
.cdp-arrow {
    flex: 0 0 auto;
    background: #fff;
    border: 1px solid var(--cdp-border, #ddd);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    color: #444;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    transition: background 0.15s, opacity 0.2s;
    padding: 0;
    line-height: 1;
    align-self: center;
    margin-bottom: 6px; /* bù cho padding-bottom của scrollbar */
}
.cdp-arrow:hover { background: #f5f5f5; }
.cdp-arrow[hidden] { visibility: hidden; pointer-events: none; }   /* giữ chỗ, không nhảy layout */

@media (max-width: 767px) {
    .cdp-arrow { display: none; }
}

/* ── Trống ── */
.cdp-empty {
    color: #888;
    font-style: italic;
}
