// ────────────────────────────────────────
// Dashboard Admin — BlogWeb
// ────────────────────────────────────────

.bw-dashboard {
    max-width: 1200px;
}

// ── Tip contextuel ──
.bw-tip {
    margin-bottom: 1rem;

    &__inner {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
        background: linear-gradient(135deg, #eff6ff, #f5f3ff);
        border: 1px solid #c7d2fe;
        border-radius: 10px;
        font-size: 0.875rem;
        color: #334155;
    }

    &__icon {
        color: #d97706;
        font-size: 1.1rem;
        flex-shrink: 0;
    }

    &__text {
        flex: 1;
        line-height: 1.4;
    }

    &__next,
    &__close {
        background: none;
        border: none;
        cursor: pointer;
        padding: 0.25rem 0.5rem;
        border-radius: 6px;
        color: #64748b;
        transition: all 0.15s;
        flex-shrink: 0;

        &:hover {
            background: rgba(0, 0, 0, 0.06);
            color: #1e293b;
        }
    }
}

// ── KPI Cards ──
.bw-kpi {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1rem 1.125rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    transition: box-shadow 0.2s;

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

    &__icon {
        width: 44px;
        height: 44px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.1rem;
        flex-shrink: 0;
    }

    &__value {
        font-size: 1.5rem;
        font-weight: 700;
        line-height: 1.1;
        color: #0f172a;
    }

    &__label {
        font-size: 0.78rem;
        color: #64748b;
        margin-top: 2px;
    }

    &--compact {
        flex-direction: column;
        text-align: center;
        padding: 0.75rem;
        gap: 0.25rem;
    }

    &--compact &__value {
        font-size: 1.25rem;
    }
}

// ── Cards generiques ──
.bw-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;

    &--full {
        height: 100%;
        display: flex;
        flex-direction: column;
    }

    &__header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.875rem 1.125rem;
        border-bottom: 1px solid #f1f5f9;
    }

    &__title {
        font-size: 0.9rem;
        font-weight: 600;
        color: #1e293b;
        margin: 0;
    }

    &__link {
        font-size: 0.8rem;
        color: #2563eb;
        text-decoration: none;

        &:hover {
            text-decoration: underline;
        }
    }

    &__body {
        padding: 1rem 1.125rem;
        flex: 1;

        &--list {
            padding: 0;
        }
    }
}

// ── Activity items ──
.bw-activity-item {
    display: flex;
    align-items: center;
    padding: 0.625rem 1.125rem;
    border-bottom: 1px solid #f8fafc;
    transition: background 0.15s;

    &:last-child {
        border-bottom: none;
    }

    &:hover {
        background: #f8fafc;
    }

    &__content {
        min-width: 0;
        flex: 1;
    }

    &__title {
        font-size: 0.85rem;
        font-weight: 500;
        color: #1e293b;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    &__meta {
        font-size: 0.75rem;
        color: #94a3b8;
        margin-top: 2px;
    }
}

// ── Quick actions ──
.bw-quick-actions {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem !important;
}

.bw-quick-action {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: 8px;
    text-decoration: none;
    color: #334155;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.15s;

    &:hover {
        background: #f1f5f9;
        color: #1e293b;
        text-decoration: none;
    }

    &__icon {
        width: 34px;
        height: 34px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.8rem;
        flex-shrink: 0;
    }
}

// ── Info bar ──
.bw-info-bar {
    padding: 0.75rem 1rem;
    background: #fefce8;
    border: 1px solid #fde68a;
    border-radius: 10px;
    font-size: 0.85rem;
    color: #854d0e;

    a {
        color: #92400e;
        font-weight: 600;
        text-decoration: underline;
        margin-left: 0.25rem;
    }
}

// ── Chart container ──
#visitsChart {
    min-height: 200px;
}

// ── Help panel (contextuel) ──
.bw-help-toggle {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #2563eb;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    z-index: 1050;

    &:hover {
        transform: scale(1.08);
        box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
    }
}

.bw-help-panel {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    max-width: 90vw;
    height: 100vh;
    background: #fff;
    border-left: 1px solid #e2e8f0;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.08);
    z-index: 1060;
    transition: right 0.3s ease;
    overflow-y: auto;

    &.is-open {
        right: 0;
    }

    &__header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 1rem 1.25rem;
        border-bottom: 1px solid #e2e8f0;
        position: sticky;
        top: 0;
        background: #fff;
        z-index: 1;
    }

    &__title {
        font-size: 1rem;
        font-weight: 600;
        color: #1e293b;
        margin: 0;
    }

    &__close {
        background: none;
        border: none;
        cursor: pointer;
        color: #64748b;
        font-size: 1.1rem;
        padding: 0.25rem;

        &:hover {
            color: #1e293b;
        }
    }

    &__body {
        padding: 1.25rem;
        font-size: 0.875rem;
        line-height: 1.6;
        color: #475569;

        h4 {
            font-size: 0.9rem;
            font-weight: 600;
            color: #1e293b;
            margin: 1rem 0 0.5rem;

            &:first-child {
                margin-top: 0;
            }
        }

        ul {
            padding-left: 1.25rem;
            margin-bottom: 0.75rem;
        }

        li {
            margin-bottom: 0.25rem;
        }

        .bw-help-tip {
            padding: 0.625rem 0.75rem;
            background: #f0f9ff;
            border-left: 3px solid #2563eb;
            border-radius: 0 6px 6px 0;
            margin: 0.75rem 0;
            font-size: 0.82rem;
        }
    }
}

.bw-help-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.2);
    z-index: 1055;
    display: none;

    &.is-open {
        display: block;
    }
}

// ── Responsive ──
@media (max-width: 768px) {
    .bw-kpi {
        padding: 0.75rem;
        gap: 0.625rem;

        &__icon {
            width: 38px;
            height: 38px;
            font-size: 0.95rem;
        }

        &__value {
            font-size: 1.25rem;
        }
    }
}
