/* =========================================================
   CAMU SERVICES — ADMIN ANNONCES
   ========================================================= */

/* =========================
   VARIABLES
========================= */

.admin-main-wrapper {
    min-height: 100vh;
}


/* =========================
   HEADER PAGE
========================= */

.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.admin-topbar-label {
    display: inline-block;
    margin-bottom: 5px;
    font-size: 13px;
    font-weight: 700;
    color: #16a34a;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.admin-topbar h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1.2;
}

.admin-back-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    color: #374151;
    text-decoration: none;
    font-weight: 600;
    transition: .2s ease;
}

.admin-back-button:hover {
    border-color: #16a34a;
    color: #16a34a;
}


/* =========================
   INTRO
========================= */

.admin-page-intro {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 25px;
    margin-bottom: 25px;
    padding: 25px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
}

.admin-section-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 700;
    color: #16a34a;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.admin-page-intro h2 {
    margin: 0 0 7px;
    font-size: 23px;
    color: #111827;
}

.admin-page-intro p {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
}


/* =========================
   TOTAL ANNONCES
========================= */

.admin-total-badge {
    min-width: 145px;
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 15px 18px;
    border-radius: 13px;
    background: #f0fdf4;
}

.admin-total-badge > i {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #dcfce7;
    color: #16a34a;
    font-size: 18px;
}

.admin-total-badge div {
    display: flex;
    flex-direction: column;
}

.admin-total-badge strong {
    font-size: 22px;
    color: #111827;
    line-height: 1;
}

.admin-total-badge span {
    margin-top: 4px;
    color: #6b7280;
    font-size: 12px;
}


/* =========================
   FILTRES
========================= */

.admin-filters-card {
    display: grid;
    grid-template-columns: minmax(220px, 1.5fr)
                           minmax(170px, 1fr)
                           minmax(170px, 1fr)
                           auto;
    gap: 15px;
    align-items: end;
    margin-bottom: 28px;
    padding: 20px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
}

.admin-filter-group {
    min-width: 0;
}

.admin-filter-group label {
    display: block;
    margin-bottom: 7px;
    color: #374151;
    font-size: 13px;
    font-weight: 700;
}

.admin-filter-input {
    position: relative;
}

.admin-filter-input i {
    position: absolute;
    top: 50%;
    left: 13px;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
}

.admin-filter-input input,
.admin-filter-group select {
    width: 100%;
    height: 44px;
    padding: 0 13px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    outline: none;
    background: #fff;
    color: #111827;
    font-family: inherit;
    font-size: 14px;
    transition: .2s ease;
}

.admin-filter-input input {
    padding-left: 38px;
}

.admin-filter-input input:focus,
.admin-filter-group select:focus {
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, .08);
}

.admin-reset-button {
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #fff;
    color: #374151;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: .2s ease;
}

.admin-reset-button:hover {
    border-color: #16a34a;
    color: #16a34a;
    background: #f0fdf4;
}


/* =========================
   SECTION ANNONCES
========================= */

.admin-ads-section {
    margin-bottom: 30px;
}

.admin-ads-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 15px;
}

.admin-ads-header h2 {
    margin: 0 0 4px;
    font-size: 20px;
    color: #111827;
}

.admin-ads-header span {
    color: #6b7280;
    font-size: 13px;
}

.admin-refresh-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #fff;
    color: #374151;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: .2s ease;
}

.admin-refresh-button:hover {
    border-color: #16a34a;
    color: #16a34a;
}

.admin-refresh-button:disabled {
    opacity: .6;
    cursor: not-allowed;
}


/* =========================
   CHARGEMENT
========================= */

.admin-ads-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    padding: 30px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    color: #6b7280;
}

.admin-ads-loading i {
    margin-bottom: 12px;
    color: #16a34a;
    font-size: 25px;
}

.admin-ads-loading p {
    margin: 0;
    font-size: 14px;
}


/* =========================
   LISTE DES ANNONCES
========================= */

.admin-ads-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}


/* =========================
   CARTE ANNONCE
========================= */

.admin-ad-card {
    display: grid;
    grid-template-columns: 105px minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
    padding: 15px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    transition: .2s ease;
}

.admin-ad-card:hover {
    border-color: #d1d5db;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .05);
}


/* =========================
   IMAGE
========================= */

.admin-ad-image {
    width: 105px;
    height: 85px;
    overflow: hidden;
    border-radius: 10px;
    background: #f3f4f6;
}

.admin-ad-image img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}


/* =========================
   INFORMATIONS
========================= */

.admin-ad-content {
    min-width: 0;
}

.admin-ad-top {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 5px;
}

.admin-ad-category {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    background: #f0fdf4;
    color: #15803d;
    font-size: 11px;
    font-weight: 700;
}

.admin-ad-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.admin-ad-status.active,
.admin-ad-status.published {
    background: #ecfdf5;
    color: #047857;
}

.admin-ad-status.inactive {
    background: #fef2f2;
    color: #b91c1c;
}

.admin-ad-content h3 {
    overflow: hidden;
    margin: 0 0 7px;
    color: #111827;
    font-size: 16px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-ad-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    color: #6b7280;
    font-size: 12px;
}

.admin-ad-meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.admin-ad-meta i {
    color: #9ca3af;
}

.admin-ad-price {
    margin-top: 8px;
    color: #16a34a;
    font-size: 16px;
    font-weight: 800;
}


/* =========================
   ACTIONS
========================= */

.admin-ad-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-ad-actions a,
.admin-ad-actions button {
    min-width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 11px;
    border: 1px solid #e5e7eb;
    border-radius: 9px;
    background: #fff;
    color: #374151;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: .2s ease;
}

.admin-ad-view:hover {
    border-color: #16a34a !important;
    background: #f0fdf4 !important;
    color: #15803d !important;
}

.admin-ad-delete:hover {
    border-color: #dc2626 !important;
    background: #fef2f2 !important;
    color: #dc2626 !important;
}


/* =========================
   EMPTY STATE
========================= */

.admin-ads-empty {
    min-height: 230px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    text-align: center;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
}

.admin-empty-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    border-radius: 50%;
    background: #f0fdf4;
    color: #16a34a;
    font-size: 23px;
}

.admin-ads-empty h3 {
    margin: 0 0 7px;
    color: #111827;
    font-size: 18px;
}

.admin-ads-empty p {
    max-width: 420px;
    margin: 0;
    color: #6b7280;
    font-size: 14px;
}


/* =========================
   HIDDEN
========================= */

[hidden] {
    display: none !important;
}


/* =========================================================
   TABLET
========================================================= */

@media (max-width: 1000px) {

    .admin-filters-card {
        grid-template-columns: 1fr 1fr;
    }

    .admin-reset-button {
        width: 100%;
    }

    .admin-ad-card {
        grid-template-columns: 90px minmax(0, 1fr);
    }

    .admin-ad-image {
        width: 90px;
        height: 80px;
    }

    .admin-ad-actions {
        grid-column: 2;
        justify-content: flex-start;
    }

}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 700px) {

    .admin-topbar {
        align-items: flex-start;
    }

    .admin-topbar h1 {
        font-size: 23px;
    }

    .admin-back-button {
        padding: 9px 11px;
        font-size: 12px;
    }

    .admin-back-button {
        font-size: 0;
    }

    .admin-back-button i {
        margin: 0;
        font-size: 15px;
    }


    .admin-page-intro {
        align-items: stretch;
        flex-direction: column;
        padding: 20px;
    }

    .admin-total-badge {
        width: 100%;
    }


    .admin-filters-card {
        grid-template-columns: 1fr;
        gap: 13px;
        padding: 16px;
    }


    .admin-ads-header {
        align-items: flex-start;
    }

    .admin-ads-header h2 {
        font-size: 18px;
    }

    .admin-refresh-button {
        padding: 9px 11px;
        font-size: 0;
    }

    .admin-refresh-button i {
        font-size: 15px;
    }


    .admin-ad-card {
        grid-template-columns: 75px minmax(0, 1fr);
        gap: 12px;
        padding: 12px;
    }

    .admin-ad-image {
        width: 75px;
        height: 75px;
    }

    .admin-ad-content h3 {
        font-size: 14px;
    }

    .admin-ad-meta {
        gap: 6px 10px;
        font-size: 11px;
    }

    .admin-ad-price {
        font-size: 14px;
    }

    .admin-ad-top {
        flex-wrap: wrap;
        gap: 5px;
    }

    .admin-ad-actions {
        grid-column: 1 / -1;
        width: 100%;
    }

    .admin-ad-actions a,
    .admin-ad-actions button {
        flex: 1;
        height: 38px;
    }

}


/* =========================================================
   PETIT TÉLÉPHONE
========================================================= */

@media (max-width: 420px) {

    .admin-topbar {
        gap: 10px;
    }

    .admin-topbar-label {
        font-size: 11px;
    }

    .admin-topbar h1 {
        font-size: 20px;
    }

    .admin-page-intro h2 {
        font-size: 20px;
    }

    .admin-page-intro p {
        font-size: 13px;
    }

    .admin-total-badge {
        padding: 12px;
    }

    .admin-ad-card {
        grid-template-columns: 65px minmax(0, 1fr);
    }

    .admin-ad-image {
        width: 65px;
        height: 65px;
    }

    .admin-ad-category,
    .admin-ad-status {
        font-size: 10px;
    }

    .admin-ad-content h3 {
        font-size: 13px;
    }

    .admin-ad-meta {
        display: block;
    }

    .admin-ad-meta span {
        margin-bottom: 3px;
    }

}

/* =========================================================
   BOUTON MODIFIER
========================================================= */

.admin-ad-edit:hover {
    border-color: #2563eb !important;
    background: #eff6ff !important;
    color: #2563eb !important;
}


/* =========================================================
   MODAL MODIFICATION ANNONCE
========================================================= */

.admin-edit-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.admin-edit-modal[hidden] {
    display: none !important;
}

.admin-edit-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, .55);
    backdrop-filter: blur(3px);
}

.admin-edit-modal-card {
    position: relative;
    z-index: 1;
    width: min(680px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .18);
}

.admin-edit-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.admin-edit-modal-header h2 {
    margin: 0;
    color: #111827;
    font-size: 22px;
}

.admin-edit-modal-close {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    color: #6b7280;
    font-size: 17px;
    cursor: pointer;
    transition: .2s ease;
}

.admin-edit-modal-close:hover {
    border-color: #dc2626;
    background: #fef2f2;
    color: #dc2626;
}

.admin-edit-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.admin-edit-form-group {
    min-width: 0;
}

.admin-edit-form-group label {
    display: block;
    margin-bottom: 7px;
    color: #374151;
    font-size: 13px;
    font-weight: 700;
}

.admin-edit-form-group input,
.admin-edit-form-group textarea,
.admin-edit-form-group select {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    outline: none;
    background: #fff;
    color: #111827;
    font-family: inherit;
    font-size: 14px;
    transition: .2s ease;
}

.admin-edit-form-group input,
.admin-edit-form-group select {
    height: 44px;
    padding: 0 13px;
}

.admin-edit-form-group textarea {
    min-height: 120px;
    padding: 12px 13px;
    resize: vertical;
}

.admin-edit-form-group input:focus,
.admin-edit-form-group textarea:focus,
.admin-edit-form-group select:focus {
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, .08);
}

.admin-edit-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.admin-edit-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 6px;
    padding-top: 18px;
    border-top: 1px solid #e5e7eb;
}

.admin-edit-cancel,
.admin-edit-save {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: .2s ease;
}

.admin-edit-cancel {
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
}

.admin-edit-cancel:hover {
    border-color: #9ca3af;
    background: #f9fafb;
}

.admin-edit-save {
    border: 1px solid #16a34a;
    background: #16a34a;
    color: #fff;
}

.admin-edit-save:hover {
    border-color: #15803d;
    background: #15803d;
}

.admin-edit-save:disabled {
    opacity: .65;
    cursor: not-allowed;
}


/* =========================================================
   MODAL — MOBILE
========================================================= */

@media (max-width: 700px) {

    .admin-edit-modal {
        align-items: flex-end;
        padding: 0;
    }

    .admin-edit-modal-card {
        width: 100%;
        max-height: 94vh;
        padding: 20px;
        border-radius: 18px 18px 0 0;
    }

    .admin-edit-modal-header h2 {
        font-size: 19px;
    }

    .admin-edit-form-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .admin-edit-modal-actions {
        flex-direction: column-reverse;
    }

    .admin-edit-cancel,
    .admin-edit-save {
        width: 100%;
    }
}
