/* ============================================================
 * assets/css/client-dashboard.css
 *
 * Client UI v2 — Services Dashboard (home.php).
 *
 * Layout (Phase 2.1 — hero removed):
 *   .csd-announce      → admin announcement banner (modern card)
 *   .csd-quick-stats   → 4 stat cards row
 *   .csd-services      → 6 service cards grid (3 col → 2 → 1)
 *   .csd-tg-cta        → Telegram CTA bento (full width, conditional)
 *   .csd-activity      → recent activity 2-col widget
 *
 * Depends on tokens from client-sidebar.css (`--cs-red`, `--cs-radius`, ...).
 * Đặt sau client-sidebar.css trong header.php load order.
 *
 * NOTE: `.csd-hero` đã xoá — balance giờ ở topbar (`.cs-balance-btn`),
 * greeting redundant nên bỏ luôn.
 * ============================================================ */

/* ============================================================
 * Quick stats row (4 small KPI cards)
 * ============================================================ */
.csd-quick-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 1.5rem;
}

.csd-stat-card {
    background: var(--cs-surface);
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--cs-transition);
}

.csd-stat-card:hover {
    border-color: rgba(238, 77, 45, 0.3);
    box-shadow: var(--cs-shadow-md);
    transform: translateY(-2px);
}

.csd-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
    flex-shrink: 0;
}

.csd-stat-icon.is-red {
    background: linear-gradient(135deg, #f53d2d, #ff6633);
}

.csd-stat-icon.is-blue {
    background: linear-gradient(135deg, #3b82f6, #60a5fa);
}

.csd-stat-icon.is-green {
    background: linear-gradient(135deg, #10b981, #34d399);
}

.csd-stat-icon.is-purple {
    background: linear-gradient(135deg, #8b5cf6, #a78bfa);
}

.csd-stat-body {
    flex: 1;
    min-width: 0;
}

.csd-stat-label {
    font-size: 0.78rem;
    color: var(--cs-text-mute);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.csd-stat-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--cs-text);
    line-height: 1.2;
}

/* ============================================================
 * Section heading (used by services + activity)
 * ============================================================ */
.csd-sec-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 1.6rem 0 0.85rem;
}

.csd-sec-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--cs-text);
}

.csd-sec-title i {
    color: var(--cs-red);
}

.csd-sec-link {
    font-size: 0.85rem;
    color: var(--cs-red);
    text-decoration: none;
    font-weight: 600;
}

.csd-sec-link:hover {
    color: var(--cs-red-dark);
    text-decoration: underline;
}

/* ============================================================
 * Service cards grid (6 cards, 3 → 2 → 1 columns)
 * ============================================================ */
.csd-services {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 1.5rem;
}

.csd-service-card {
    background: var(--cs-surface);
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius);
    padding: 22px;
    text-decoration: none;
    color: var(--cs-text);
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    overflow: hidden;
    transition: var(--cs-transition);
    isolation: isolate;
}

.csd-service-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--csd-card-accent, var(--cs-red-grad));
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.csd-service-card:hover {
    border-color: rgba(238, 77, 45, 0.3);
    box-shadow: var(--cs-shadow-lg);
    transform: translateY(-3px);
    text-decoration: none;
    color: var(--cs-text);
}

.csd-service-card:hover::before {
    transform: scaleX(1);
}

.csd-service-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.csd-service-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    background: var(--csd-card-accent, var(--cs-red-grad));
    box-shadow: 0 6px 16px var(--csd-card-shadow, rgba(238, 77, 45, 0.25));
}

.csd-service-badge {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 6px;
}

.csd-service-badge.is-new {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
}

.csd-service-badge.is-hot {
    background: rgba(245, 61, 45, 0.12);
    color: #d73211;
}

.csd-service-badge.is-tool {
    background: rgba(139, 92, 246, 0.12);
    color: #6d28d9;
}

.csd-service-title {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
}

.csd-service-desc {
    font-size: 0.85rem;
    color: var(--cs-text-soft);
    line-height: 1.45;
    margin: 0;
    flex: 1;
}

.csd-service-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--cs-red);
    margin-top: 4px;
}

.csd-service-cta i {
    transition: transform 0.25s;
}

.csd-service-card:hover .csd-service-cta i {
    transform: translateX(4px);
}

/* Per-card accent overrides (gradient + shadow color). */
.csd-service-card.accent-red {
    --csd-card-accent: linear-gradient(135deg, #f53d2d, #ff6633);
    --csd-card-shadow: rgba(238, 77, 45, 0.25);
}

.csd-service-card.accent-blue {
    --csd-card-accent: linear-gradient(135deg, #3b82f6, #60a5fa);
    --csd-card-shadow: rgba(59, 130, 246, 0.25);
}

.csd-service-card.accent-green {
    --csd-card-accent: linear-gradient(135deg, #10b981, #34d399);
    --csd-card-shadow: rgba(16, 185, 129, 0.25);
}

.csd-service-card.accent-purple {
    --csd-card-accent: linear-gradient(135deg, #8b5cf6, #a78bfa);
    --csd-card-shadow: rgba(139, 92, 246, 0.25);
}

.csd-service-card.accent-orange {
    --csd-card-accent: linear-gradient(135deg, #f97316, #fb923c);
    --csd-card-shadow: rgba(249, 115, 22, 0.25);
}

.csd-service-card.accent-teal {
    --csd-card-accent: linear-gradient(135deg, #14b8a6, #5eead4);
    --csd-card-shadow: rgba(20, 184, 166, 0.25);
}

/* ============================================================
 * Telegram CTA bento (conditional — hidden if user linked)
 * ============================================================ */
.csd-tg-cta {
    background: linear-gradient(135deg, #0088cc 0%, #00a8e8 100%);
    border-radius: var(--cs-radius-lg);
    padding: 28px 32px;
    color: #fff;
    margin: 1.75rem 0 1.5rem;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    box-shadow: 0 10px 30px rgba(0, 136, 204, 0.18);
}

.csd-tg-cta::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 85% 30%, rgba(255, 255, 255, 0.18) 0%, transparent 40%),
        radial-gradient(circle at 15% 80%, rgba(255, 255, 255, 0.12) 0%, transparent 35%);
    pointer-events: none;
}

.csd-tg-cta-content {
    position: relative;
    z-index: 1;
    flex: 1 1 auto;
    min-width: 280px;
}

.csd-tg-cta-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.csd-tg-cta-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 8px;
    line-height: 1.2;
}

.csd-tg-cta-desc {
    font-size: 0.95rem;
    opacity: 0.95;
    max-width: 580px;
    line-height: 1.5;
    margin-bottom: 0;
}

.csd-tg-cta-actions {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
    min-width: 220px;
}

.csd-tg-cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #fff;
    color: #0088cc;
    padding: 12px 22px;
    border-radius: 30px;
    font-weight: 700;
    text-decoration: none;
    font-size: 0.95rem;
    transition: var(--cs-transition);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.csd-tg-cta-btn:hover {
    color: #006699;
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
    text-decoration: none;
}

.csd-tg-cta-btn i {
    font-size: 1.1rem;
}

.csd-tg-cta-mini {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.95);
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.82rem;
    border: 1px solid rgba(255, 255, 255, 0.4);
    transition: var(--cs-transition);
}

.csd-tg-cta-mini:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    text-decoration: none;
}

/* ============================================================
 * Recent activity 2-col widget
 * ============================================================ */
.csd-activity {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 1.5rem;
}

.csd-activity-card {
    background: var(--cs-surface);
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius);
    overflow: hidden;
}

.csd-activity-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--cs-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(180deg, #fafafa, #fff);
}

.csd-activity-head-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--cs-text);
}

.csd-activity-head-title i {
    color: var(--cs-red);
}

.csd-activity-head-link {
    font-size: 0.8rem;
    color: var(--cs-red);
    text-decoration: none;
    font-weight: 600;
}

.csd-activity-head-link:hover {
    color: var(--cs-red-dark);
    text-decoration: underline;
}

.csd-activity-list {
    padding: 6px 0;
    max-height: 340px;
    overflow-y: auto;
}

.csd-activity-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 18px;
    border-bottom: 1px solid var(--cs-border-light);
    transition: var(--cs-transition);
    text-decoration: none;
    color: var(--cs-text);
}

.csd-activity-row:last-child {
    border-bottom: none;
}

.csd-activity-row:hover {
    background: var(--cs-red-softer);
    text-decoration: none;
    color: var(--cs-text);
}

.csd-activity-thumb {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--cs-red-soft);
    color: var(--cs-red);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.csd-activity-body {
    flex: 1;
    min-width: 0;
}

.csd-activity-title {
    font-size: 0.88rem;
    font-weight: 600;
    margin: 0 0 2px;
    color: var(--cs-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.csd-activity-meta {
    font-size: 0.76rem;
    color: var(--cs-text-mute);
    display: flex;
    align-items: center;
    gap: 10px;
}

.csd-activity-meta i {
    margin-right: 3px;
}

.csd-activity-amount {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--cs-red);
    white-space: nowrap;
}

.csd-activity-empty {
    padding: 32px 18px;
    text-align: center;
    color: var(--cs-text-mute);
    font-size: 0.88rem;
}

.csd-activity-empty i {
    display: block;
    font-size: 28px;
    color: #cbd5e1;
    margin-bottom: 8px;
}

/* Status pill on activity row */
.csd-activity-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.csd-activity-pill.is-pending {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
}

.csd-activity-pill.is-processing {
    background: rgba(59, 130, 246, 0.12);
    color: #1d4ed8;
}

.csd-activity-pill.is-completed {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.csd-activity-pill.is-failed {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}

.csd-activity-pill.is-refunded {
    background: rgba(139, 92, 246, 0.12);
    color: #6d28d9;
}

/* ============================================================
 * Announcement banner (admin "thongbao") — modern professional
 *
 * Design tokens:
 *  - Clean white card với subtle gradient overlay
 *  - Left accent bar 3px (Shopee red gradient)
 *  - Icon container 40x40, soft red wash + thin border
 *  - Tag pill UPPERCASE letter-spacing cho phần "Thông báo"
 *  - Typography hierarchy: tag → body (no redundant title)
 *  - Close button minimal hover state
 *
 * Pattern reference: Linear / Vercel announcement cards.
 * ============================================================ */
.csd-announce {
    position: relative;
    background: #fff;
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius);
    padding: 16px 20px 16px 22px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 12px rgba(15, 23, 42, 0.04);
    overflow: hidden;
}

.csd-announce::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(238, 77, 45, 0.04) 0%, transparent 55%);
    pointer-events: none;
}

/* Left accent bar */
.csd-announce::after {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, #f53d2d 0%, #ff6633 100%);
}

.csd-announce-icon {
    position: relative;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #fff5f2 0%, #ffe5dc 100%);
    border: 1px solid rgba(238, 77, 45, 0.18);
    color: var(--cs-red);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}

.csd-announce-body {
    position: relative;
    flex: 1;
    min-width: 0;
}

.csd-announce-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(238, 77, 45, 0.1);
    color: var(--cs-red-dark);
    border-radius: 4px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.csd-announce-text {
    font-size: 0.9rem;
    color: var(--cs-text);
    line-height: 1.6;
    word-wrap: break-word;
}

.csd-announce-text a {
    color: var(--cs-red);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px dashed currentColor;
}

.csd-announce-text a:hover {
    color: var(--cs-red-dark);
    border-bottom-style: solid;
}

.csd-announce-close {
    position: relative;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: 0;
    background: transparent;
    border-radius: 6px;
    color: var(--cs-text-mute);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: var(--cs-transition);
}

.csd-announce-close:hover {
    background: rgba(15, 23, 42, 0.06);
    color: var(--cs-text);
}

/* ============================================================
 * Telegram bot notice banner (Phase 2.2)
 * ============================================================
 * Sibling của `.csd-announce` — đặt ngay dưới, cùng vị trí
 * top-of-page. Brand color Telegram blue thay cho red.
 * Có CTA button + close (dismissible với localStorage key versioned).
 * ============================================================ */
.csd-tg-notice {
    position: relative;
    background: #fff;
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius);
    padding: 16px 20px 16px 22px;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 12px rgba(15, 23, 42, 0.04);
    overflow: hidden;
}

.csd-tg-notice::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0, 136, 204, 0.05) 0%, transparent 55%);
    pointer-events: none;
}

.csd-tg-notice::after {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, #0088cc 0%, #229ED9 100%);
}

.csd-tg-notice-icon {
    position: relative;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #0088cc 0%, #229ED9 100%);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(0, 136, 204, 0.28);
}

.csd-tg-notice-body {
    position: relative;
    flex: 1;
    min-width: 0;
}

.csd-tg-notice-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(0, 136, 204, 0.1);
    color: #0064a3;
    border-radius: 4px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.csd-tg-notice-text {
    font-size: 0.9rem;
    color: var(--cs-text);
    line-height: 1.55;
    word-wrap: break-word;
}

.csd-tg-notice-text strong {
    color: #0064a3;
    font-weight: 700;
}

.csd-tg-notice-actions {
    position: relative;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.csd-tg-notice-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 14px;
    background: linear-gradient(135deg, #0088cc 0%, #229ED9 100%);
    color: #fff;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0, 136, 204, 0.25);
    transition: var(--cs-transition, all 0.18s ease);
    white-space: nowrap;
}

.csd-tg-notice-btn:hover,
.csd-tg-notice-btn:focus {
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 136, 204, 0.4);
}

.csd-tg-notice-btn i {
    font-size: 14px;
}

.csd-tg-notice-close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: 0;
    background: transparent;
    border-radius: 6px;
    color: var(--cs-text-mute);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: var(--cs-transition, all 0.18s ease);
}

.csd-tg-notice-close:hover {
    background: rgba(15, 23, 42, 0.06);
    color: var(--cs-text);
}

/* ============================================================
 * Responsive
 * ============================================================ */
@media (max-width: 1199.98px) {
    .csd-quick-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 991.98px) {
    .csd-services {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767.98px) {
    .csd-activity {
        grid-template-columns: 1fr;
    }
    .csd-tg-cta {
        padding: 22px;
    }
    .csd-tg-cta-actions {
        width: 100%;
    }
    /* Stack notice vertically: icon row + text + actions row full-width */
    .csd-tg-notice {
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 12px;
    }
    .csd-tg-notice-body {
        flex-basis: calc(100% - 54px);
    }
    .csd-tg-notice-actions {
        flex-basis: 100%;
        justify-content: space-between;
    }
    .csd-tg-notice-btn {
        flex: 1;
        justify-content: center;
    }
}

@media (max-width: 575.98px) {
    .csd-services {
        grid-template-columns: 1fr;
    }
    .csd-quick-stats {
        grid-template-columns: 1fr;
    }
    /* Section heading: keep title + view-all on same row but allow wrap if needed */
    .csd-sec-head {
        flex-wrap: wrap;
        gap: 8px;
    }
    /* Smaller stat icons — give body more horizontal room */
    .csd-stat-icon {
        width: 38px;
        height: 38px;
        font-size: 15px;
        border-radius: 10px;
    }
    .csd-stat-value {
        font-size: 1.1rem;
    }
    /* TG notice: tighter padding + smaller icon for small phones */
    .csd-tg-notice {
        padding: 14px 14px 14px 18px;
    }
    .csd-tg-notice-icon {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    .csd-tg-notice-text {
        font-size: 0.85rem;
    }
    .csd-tg-notice-btn span {
        font-size: 12px;
    }
}

/* Tiny phones (iPhone SE / 320px). Keep typography readable without overflow. */
@media (max-width: 374.98px) {
    .csd-stat-card {
        padding: 12px;
    }
    .csd-tg-cta {
        padding: 18px;
        border-radius: 14px;
    }
    /* Telegram CTA buttons go full-width on micro screens */
    .csd-tg-cta-actions .csd-tg-cta-btn {
        width: 100%;
        justify-content: center;
    }
}
