/*
 * Stylesheet for the Autorisations Publications Table Plugin
 */

.ap-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    margin: 20px 0;
    color: #2c3338;
}

/* Top Bar Container */
.ap-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
}

/* Search Bar Wrapper */
.ap-search-wrapper {
    position: relative;
    max-width: 400px;
    width: 100%;
}

.ap-last-update {
    font-size: 13px;
    color: #64748b;
}

.ap-search-input {
    width: 100%;
    padding: 12px 20px 12px 40px;
    font-size: 15px;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.ap-search-input:focus {
    outline: none;
    border-color: #35605a; /* Sleek slate/teal border */
    box-shadow: 0 0 0 3px rgba(53, 96, 90, 0.15);
}

.ap-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #8c8f94;
    pointer-events: none;
}

/* Table Wrapper */
.ap-table-responsive {
    width: 100%;
    overflow: hidden;
    overflow-x: auto;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
    border: 1px solid #e2e8f0;
    background-color: #fff;
}

/* Table */
.ap-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
    line-height: 1.5;
}

.ap-table th {
    background-color: #049FE0;
    color: #ffffff;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.05em;
    padding: 14px 18px;
    border-bottom: none;
}

.ap-table td {
    padding: 16px 18px;
    border-bottom: 1px solid #edf2f7;
    vertical-align: middle;
    transition: background-color 0.2s ease;
}

.ap-table tr:last-child td {
    border-bottom: none;
}

.ap-table tr:hover td {
    background-color: #f8fafc;
}

/* Fields Styling */
.ap-demande-no {
    display: inline-block;
    background-color: #98BF10;
    color: #ffffff;
    font-weight: 700;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 9999px;
    text-align: center;
    white-space: nowrap;
}

.ap-objet {
    font-weight: 500;
    color: #1e293b;
    margin-bottom: 4px;
}

.ap-address {
    font-size: 13px;
    color: #64748b;
}

.ap-date {
    white-space: nowrap;
    color: #334155;
}

.ap-date-recours {
    color: #334155;
    display: inline-block;
}

.ap-no-results {
    padding: 30px;
    text-align: center;
    color: #64748b;
    font-size: 15px;
}

/* Loading & Error States */
.ap-error-message {
    padding: 16px;
    background-color: #fef2f2;
    border-left: 4px solid #ef4444;
    color: #991b1b;
    border-radius: 4px;
    margin: 20px 0;
}

/* Mobile Responsive Cards */
@media (max-width: 768px) {
    .ap-table, .ap-table thead, .ap-table tbody, .ap-table th, .ap-table td, .ap-table tr {
        display: block;
    }

    .ap-table thead {
        display: none; /* Hide standard headers */
    }

    .ap-table tr {
        border-bottom: 8px solid #f1f5f9;
        padding: 12px 4px;
    }

    .ap-table tr:last-child {
        border-bottom: none;
    }

    .ap-table td {
        border-bottom: none;
        padding: 8px 16px;
    }

    .ap-table td::before {
        content: attr(data-label);
        display: block;
        font-weight: 600;
        color: #475569;
        text-transform: uppercase;
        font-size: 11px;
        letter-spacing: 0.05em;
        margin-bottom: 4px;
    }
    
    .ap-table td.ap-no-results-td::before {
        display: none;
    }

    .ap-table td.ap-cell-demande {
        display: flex;
        flex-direction: column;
    }

    .ap-table td.ap-cell-demande .ap-demande-no {
        align-self: flex-start;
        margin-top: 4px;
    }

    .ap-top-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}
