/* ================================================================
   CommunityWelcomeModal — cwm-* namespace
   Shown once per login session when user first lands on dashboard.
================================================================ */

/* --- Backdrop --- */
.cwm-backdrop {
    position: fixed;
    inset: 0;
    box-sizing: border-box;
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(4px) saturate(0.9);
    -webkit-backdrop-filter: blur(4px) saturate(0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 4vh, 32px);
    overflow-y: auto;
    animation: cwm-backdrop-in 200ms ease-out;
}

.page-content > .cwm-backdrop {
    inset: 0;
}

/* --- Modal panel --- */
.cwm-modal {
    position: relative;
    background: var(--bg-surface, #fff);
    border-radius: 16px;
    padding: 26px 28px 22px;
    width: 100%;
    max-width: 440px;
    max-height: calc(var(--app-dvh, 100vh) - clamp(32px, 8vh, 64px));
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.72);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18), 0 4px 16px rgba(0, 0, 0, 0.08);
    animation: cwm-modal-in 250ms ease-out;
}

.cwm-modal:focus {
    outline: none;
}

/* --- Close button --- */
.cwm-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary, #888780);
    cursor: pointer;
    transition: background 150ms, color 150ms;
}

.cwm-close:hover {
    background: var(--bg-muted, #F1EFE8);
    color: var(--text-primary, #1A1A18);
}

.cwm-modal :where(a, button):focus {
    outline: none;
}

.cwm-modal .cwm-close:focus-visible,
.cwm-modal .cwm-btn:focus-visible {
    outline: 2px solid var(--brand-primary, #085041);
    outline-offset: 2px;
    box-shadow: none;
}

.cwm-modal .cwm-item:focus-visible {
    outline: 2px solid rgba(8, 80, 65, 0.55);
    outline-offset: 2px;
    border-color: rgba(8, 80, 65, 0.28);
    box-shadow: none;
}

/* --- Hero header --- */
.cwm-h {
    text-align: center;
    margin-bottom: 20px;
}

.cwm-h-ic {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, #085041, #0F6E56);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    color: #fff;
    font-size: 22px;
}

.cwm-h-tag {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--text-tertiary, #888780);
    margin: 0 0 6px;
    text-transform: uppercase;
}

.cwm-h-t {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary, #1A1A18);
    line-height: 1.3;
    margin: 0 0 8px;
}

.cwm-h-s {
    font-size: 13px;
    color: var(--text-secondary, #5F5E5A);
    line-height: 1.5;
    margin: 0;
}

/* --- Group list --- */
.cwm-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.cwm-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 13px;
    border: 0.5px solid var(--border-subtle, rgba(0,0,0,0.08));
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: border-color 150ms, background 150ms;
}

.cwm-item:hover {
    border-color: var(--border-default, rgba(0,0,0,0.15));
    background: var(--bg-muted, #F1EFE8);
    text-decoration: none;
    color: inherit;
}

.cwm-item-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.cwm-item-body {
    flex: 1;
    min-width: 0;
}

.cwm-item-h {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}

.cwm-item-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary, #1A1A18);
    margin: 0;
}

.cwm-item-platform {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 2px 6px;
    border-radius: 4px;
}

.cwm-item-platform--fb {
    background: #E4ECF7;
    color: #1F4E96;
}

.cwm-item-platform--zalo {
    background: #DDF1FB;
    color: #0E5A88;
}

.cwm-item-meta {
    font-size: 11px;
    color: var(--text-tertiary, #888780);
    margin: 0;
}

.cwm-item-arr {
    color: var(--text-tertiary, #888780);
    font-size: 14px;
    flex-shrink: 0;
    transition: transform 150ms;
}

.cwm-item:hover .cwm-item-arr {
    transform: translate(2px, -2px);
}

/* --- Tip box --- */
.cwm-tip {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: var(--brand-primary-soft, #E1F5EE);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 16px;
    font-size: 11.5px;
    color: var(--text-secondary, #5F5E5A);
}

.cwm-tip i {
    color: var(--brand-primary, #085041);
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 1px;
}

.cwm-tip-t {
    margin: 0;
    line-height: 1.5;
}

/* --- Actions --- */
.cwm-actions {
    display: flex;
    justify-content: center;
}

.cwm-btn {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary, #5F5E5A);
    background: transparent;
    border: none;
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 150ms, color 150ms;
}

.cwm-btn:hover {
    background: var(--bg-muted, #F1EFE8);
    color: var(--text-primary, #1A1A18);
}

/* --- Animations --- */
@keyframes cwm-backdrop-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes cwm-modal-in {
    from { transform: scale(0.95) translateY(8px); opacity: 0; }
    to   { transform: scale(1) translateY(0); opacity: 1; }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
    .cwm-backdrop,
    .cwm-modal {
        animation: none;
    }
}

/* --- Mobile: slide from bottom --- */
@media (max-width: 480px) {
    .cwm-backdrop {
        align-items: flex-end;
        padding: 0;
    }

    .cwm-modal {
        max-width: 100%;
        border-radius: 16px 16px 0 0;
        padding: 22px 20px 18px;
        max-height: 92vh;
        overflow-y: auto;
    }

    .cwm-h-ic {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }

    .cwm-h-t {
        font-size: 17px;
    }

    .cwm-h-s {
        font-size: 12px;
    }

    .cwm-item {
        padding: 10px 12px;
    }

    .cwm-item-name {
        font-size: 13px;
    }

    .cwm-item-meta {
        font-size: 10.5px;
    }

    @keyframes cwm-modal-in {
        from { transform: translateY(20px); opacity: 0; }
        to   { transform: translateY(0); opacity: 1; }
    }
}

@media (max-height: 600px) {
    .cwm-modal {
        max-height: 92vh;
        overflow-y: auto;
    }
}
