// Admin simplifiee : accueil "a faire", Contenus, Reglages, bascule expert,
// apercu Google. Classes prefixees bw- comme le reste de l'admin.

$bw-ink: #1f2430;
$bw-muted: #5b6475;
$bw-line: #e3e7ee;
$bw-line-soft: #eef1f5;
$bw-field: #d5dbe5;
$bw-blue: #2563eb;
$bw-blue-dark: #1d4ed8;
$bw-blue-soft: #e8effd;
$bw-orange: #c2410c;

// --- En-tete de page (titre + action principale) ---
.bw-page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;

    &__title {
        margin: 0;
        font-size: 1.5rem;
        font-weight: 600;
        color: $bw-ink;
    }

    &__text {
        margin: 2px 0 0;
        color: $bw-muted;
        font-size: 0.92rem;
    }
}

.bw-simple {
    max-width: 1080px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

// --- Boutons ---
.bw-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid $bw-field;
    border-radius: 8px;
    background: #fff;
    color: $bw-blue-dark;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;

    &:hover {
        background: #f4f6f9;
        color: $bw-blue-dark;
    }

    &--primary {
        border-color: $bw-blue;
        background: $bw-blue;
        color: #fff;
        font-weight: 600;

        &:hover {
            background: $bw-blue-dark;
            color: #fff;
        }
    }

    &--small {
        min-height: 36px;
        padding: 0 14px;
    }
}

// --- Bouton Creer ---
.bw-create {
    position: relative;

    > summary {
        list-style: none;
        min-height: 44px;

        &::-webkit-details-marker {
            display: none;
        }
    }

    &__panel {
        position: absolute;
        right: 0;
        z-index: 20;
        width: min(520px, calc(100vw - 32px));
        margin-top: 8px;
        padding: 16px;
        background: #fff;
        border: 1px solid $bw-line;
        border-radius: 12px;
        box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    }

    &__title {
        margin: 0 0 10px;
        font-weight: 600;
        color: $bw-ink;
    }

    &__grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    &__choice {
        display: flex;
        flex-direction: column;
        gap: 2px;
        min-height: 64px;
        padding: 12px 14px;
        border: 1px solid $bw-field;
        border-radius: 10px;
        color: $bw-ink;
        text-decoration: none;

        span {
            color: $bw-muted;
            font-size: 0.85rem;
        }

        &:hover,
        &:focus-visible {
            border-color: $bw-blue;
            background: $bw-blue-soft;
            color: $bw-ink;
        }
    }
}

// --- Panneaux ---
.bw-panel {
    background: #fff;
    border: 1px solid $bw-line;
    border-radius: 12px;
    padding: 6px 20px;

    &__head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 0 6px;
    }

    &__title {
        margin: 0;
        font-size: 1rem;
        font-weight: 600;
        color: $bw-ink;
    }
}

.bw-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    background: $bw-blue-soft;
    color: #1e3a8a;

    span {
        margin-left: 6px;
        color: $bw-muted;
    }
}

// --- A faire ---
.bw-todo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;

    & + & {
        border-top: 1px solid $bw-line-soft;
    }

    &__dot {
        flex: 0 0 auto;
        width: 10px;
        height: 10px;
        border-radius: 50%;
        background: #64748b;

        &--urgent {
            background: $bw-orange;
        }
    }

    &__label {
        flex: 1 1 auto;
        color: $bw-ink;
    }

    &__done {
        margin: 14px 0;
        color: #166534;
    }
}

// --- Chiffres cles ---
.bw-figures {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;

    &--inline {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding-bottom: 12px;
    }

    @media (max-width: 768px) {
        grid-template-columns: minmax(0, 1fr);
    }
}

.bw-figure {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 16px 18px;
    background: #fff;
    border: 1px solid $bw-line;
    border-radius: 12px;

    &__label {
        color: $bw-muted;
        font-size: 0.85rem;
    }

    &__value {
        font-size: 1.6rem;
        font-weight: 600;
        color: $bw-ink;

        &--text {
            overflow: hidden;
            padding-top: 6px;
            font-size: 1.05rem;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
    }

    &__sub {
        color: $bw-muted;
        font-size: 0.85rem;
    }
}

// --- Filtres de la page Contenus ---
.bw-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;

    &__search {
        height: 38px;
        width: 220px;
        max-width: 100%;
        margin-left: auto;
        padding: 0 12px;
        border: 1px solid $bw-field;
        border-radius: 8px;
    }
}

.bw-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid $bw-field;
    border-radius: 19px;
    background: #fff;
    color: $bw-ink;
    font-weight: 500;
    text-decoration: none;

    &__count {
        color: $bw-muted;
        font-size: 0.85rem;
    }

    &:hover {
        border-color: $bw-blue;
        color: $bw-ink;
    }

    &.is-active {
        border-color: $bw-blue;
        background: $bw-blue;
        color: #fff;

        .bw-pill__count {
            color: #dbeafe;
        }
    }
}

// --- Liste des contenus ---
.bw-list {
    overflow-x: auto;
    background: #fff;
    border: 1px solid $bw-line;
    border-radius: 12px;

    &--flat {
        border: 0;
        border-radius: 0;
    }

    &__row {
        display: flex;
        align-items: center;
        gap: 14px;
        min-width: 520px;
        padding: 13px 20px;
        border-bottom: 1px solid $bw-line-soft;
        color: $bw-ink;
        text-decoration: none;

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

        &:hover,
        &:focus-visible {
            background: #f8fafc;
            color: $bw-ink;
        }
    }

    &--flat &__row {
        padding-left: 0;
        padding-right: 0;
    }

    &__title {
        flex: 1 1 auto;
        min-width: 0;
        font-weight: 500;
    }

    &__date {
        flex: 0 0 110px;
        color: $bw-muted;
        font-size: 0.85rem;
    }
}

.bw-type {
    flex: 0 0 96px;
    padding: 2px 0;
    border-radius: 6px;
    background: #f1f5f9;
    color: #1f2937;
    font-size: 0.78rem;
    font-weight: 500;
    text-align: center;

    &--article { background: $bw-blue-soft; color: #1e3a8a; }
    &--page { background: #ede9fe; color: #4c1d95; }
    &--service { background: #dcfce7; color: #14532d; }
    &--event { background: #fef3c7; color: #78350f; }
    &--landing { background: #fce7f3; color: #831843; }
}

.bw-status {
    flex: 0 0 auto;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 500;

    &--on { background: #dcfce7; color: #14532d; }
    &--off { background: #fef3c7; color: #78350f; }
}

.bw-empty {
    padding: 32px 20px;
    background: #fff;
    border: 1px dashed $bw-field;
    border-radius: 12px;
    color: $bw-muted;
    text-align: center;

    p {
        margin: 0 0 6px;
    }
}

// --- Tuiles de la page Reglages ---
.bw-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;

    @media (max-width: 768px) {
        grid-template-columns: minmax(0, 1fr);
    }
}

.bw-tile {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 96px;
    padding: 18px 20px;
    background: #fff;
    border: 1px solid $bw-line;
    border-radius: 12px;
    color: $bw-ink;
    text-decoration: none;

    &:hover,
    &:focus-visible {
        border-color: $bw-blue;
        color: $bw-ink;
    }

    &--static:hover {
        border-color: $bw-line;
    }

    &--expert {
        background: #fffbeb;
        border-color: #f4d58d;
    }

    &__icon {
        color: $bw-blue;
        font-size: 1.1rem;
    }

    &__title {
        font-size: 1rem;
        font-weight: 600;
    }

    &__text {
        color: $bw-muted;
        font-size: 0.88rem;
    }

    &__links {
        display: flex;
        flex-wrap: wrap;
        gap: 4px 16px;
        margin: 6px 0 0;
        padding: 0;
        list-style: none;

        a {
            display: inline-block;
            padding: 4px 0;
            font-weight: 500;
        }
    }
}

.bw-hint {
    margin: 0;
    color: $bw-muted;
    font-size: 0.85rem;
}

.bw-link-button {
    min-height: 32px;
    padding: 0;
    border: 0;
    background: none;
    color: $bw-blue-dark;
    font-weight: 500;
    text-decoration: underline;
    cursor: pointer;
}

// Options du mode expert dans les formulaires
.bw-fieldset-expert {
    padding: 12px;
    border: 1px solid #f4d58d;
    border-radius: 10px;
    background: #fffbeb;
}

// --- Bascule mode expert (sous le menu) ---
.bw-expert-toggle {
    margin: 12px 12px 16px;
    padding-top: 12px;
    border-top: 1px solid $bw-line;

    &__btn {
        display: flex;
        align-items: center;
        gap: 10px;
        min-height: 40px;
        padding: 0;
        border: 0;
        background: none;
        color: $bw-ink;
        font-weight: 500;
        cursor: pointer;
    }

    &__track {
        position: relative;
        width: 36px;
        height: 20px;
        border-radius: 10px;
        background: #cbd5e1;
        transition: background 0.15s;
    }

    &__thumb {
        position: absolute;
        top: 2px;
        left: 2px;
        width: 16px;
        height: 16px;
        border-radius: 50%;
        background: #fff;
        transition: transform 0.15s;
    }

    &__btn[aria-checked='true'] &__track {
        background: $bw-blue;
    }

    &__btn[aria-checked='true'] &__thumb {
        transform: translateX(16px);
    }

    &__hint {
        display: block;
        color: $bw-muted;
        font-size: 0.78rem;
    }
}

// --- Apercu Google dans les formulaires ---
.bw-google {
    margin-bottom: 14px;

    &__label {
        margin: 0 0 6px;
        font-weight: 600;
        color: $bw-ink;
    }

    &__result {
        padding: 12px 14px;
        border: 1px solid $bw-line-soft;
        border-radius: 8px;
        background: #f8fafc;
    }

    &__url {
        color: #3f4756;
        font-size: 0.8rem;
    }

    &__title {
        color: #1a0dab;
        font-size: 1.1rem;
        line-height: 1.3;
    }

    &__desc {
        color: #3f4756;
        font-size: 0.85rem;
    }
}

.bw-counter {
    margin-left: 4px;
    color: $bw-muted;
    font-weight: 400;

    &.is-over {
        color: $bw-orange;
        font-weight: 600;
    }
}

// Texte d'aide d'une page, sous son titre (remplace l'infobulle d'EasyAdmin)
.bw-page-help {
    margin: 4px 0 12px;
    color: $bw-muted;
    font-size: 0.9rem;

    a {
        font-weight: 500;
    }
}

// Logo BlogWeb de l'en-tete admin (le PNG a une marge basse : on cadre par la hauteur)
.bw-admin-logo {
    display: block;
    height: 64px;
    width: auto;
}

// Identite du site client dans la barre du haut de la zone principale
.content-top {
    gap: 16px;
}

.bw-site-identity {
    display: flex;
    flex: 0 1 auto;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: $bw-ink;
    text-decoration: none;

    &:hover {
        color: $bw-blue-dark;
    }

    &__logo {
        flex: 0 0 auto;
        max-width: 140px;
        height: 36px;
        object-fit: contain;
    }

    &__name {
        overflow: hidden;
        font-size: 1rem;
        font-weight: 600;
        white-space: nowrap;
        text-overflow: ellipsis;
    }
}
