/**
 * =====================================================
 * CRUD Index – CakePHP 5.3 / Bootstrap 5.3
 * À inclure dans votre fichier CSS principal
 * ou dans un block CSS via $this->Html->css()
 * =====================================================
 */

/* ── Variables ───────────────────────────────────────── */
:root {
    --bs-font-sans-serif: 'DM Sans', system-ui, sans-serif;

    --crud-accent:        #4361ee;
    --crud-accent-light:  #eef0fd;
    --crud-success:       #2dc08b;
    --crud-warning:       #f59e0b;
    --crud-danger:        #ef4444;
    --crud-info:          #0ea5e9;

    --crud-card-radius:   .875rem;
    --crud-row-hover:     #f8f9ff;
    --crud-border:        #e9ecef;

    --crud-shadow:        0 4px 24px rgba(67, 97, 238, .08);
}

/* ── Page title ──────────────────────────────────────── */
.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.page-title__img {
    width: 2rem;
    height: 2rem;
    opacity: .75;
}

/* ── Cards ───────────────────────────────────────────── */
.card--filter {
    border: 1px solid var(--crud-border);
    border-radius: var(--crud-card-radius);
    box-shadow: none;
}

.card--data {
    border: 1px solid var(--crud-border);
    border-radius: var(--crud-card-radius);
    box-shadow: var(--crud-shadow);
    overflow: hidden;
}

.card--data .card-footer {
    background: #fff;
    border-top: 1px solid var(--crud-border);
}

/* ── Table ───────────────────────────────────────────── */
.table thead tr {
    background: linear-gradient(135deg, #f5f7ff 0%, #eef0fd 100%);
}

.table thead th {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #64748b;
    border-bottom: 2px solid var(--crud-border);
    padding: .85rem 1rem;
    white-space: nowrap;
}

.table thead th a {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: .25rem;
}

.table thead th a:hover { color: var(--crud-accent); }

/* Flèches de tri générées par CakePHP Paginator */
.table thead th a.asc::after  { content: ' ↑'; font-size: .7em; }
.table thead th a.desc::after { content: ' ↓'; font-size: .7em; }

.table tbody td {
    font-size: .875rem;
    padding: .85rem 1rem;
    color: #334155;
    border-bottom: 1px solid var(--crud-border);
    vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: 0; }

.table tbody tr:hover {
    background: var(--crud-row-hover);
    transition: background .15s ease;
}

/* Colonnes spéciales */
.col-check  { width: 2.5rem; }
.col-actions { width: 8rem; }

/* ── Checkboxes ──────────────────────────────────────── */
.form-check-input:checked {
    background-color: var(--crud-accent);
    border-color:     var(--crud-accent);
}

.form-check-input:focus {
    box-shadow: 0 0 0 .2rem rgba(67,97,238,.25);
}

/* ── Boutons d'action ────────────────────────────────── */

/* Bouton Add (header) */
.btn-action--add {
    background-color: var(--crud-success);
    border-color:     var(--crud-success);
    color: #fff;
    font-weight: 600;
    border-radius: .5rem;
    padding: .45rem 1rem;
    box-shadow: 0 2px 8px rgba(45,192,139,.25);
    transition: all .2s ease;
}

.btn-action--add:hover {
    background-color: #24a578;
    border-color:     #24a578;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(45,192,139,.35);
}

/* Groupe de boutons dans le tableau */
.btn-group .btn-action {
    border-radius: .4rem !important;
    margin-left: 2px;
    padding: .3rem .55rem;
    line-height: 1;
    font-size: .8rem;
    transition: all .18s ease;
}

.btn-action--view {
    color: var(--crud-info);
    border-color: var(--crud-info);
}
.btn-action--view:hover {
    background: var(--crud-info);
    color: #fff;
    transform: translateY(-1px);
}

.btn-action--edit {
    color: var(--crud-warning);
    border-color: var(--crud-warning);
}
.btn-action--edit:hover {
    background: var(--crud-warning);
    color: #fff;
    transform: translateY(-1px);
}

.btn-action--delete {
    color: var(--crud-danger);
    border-color: var(--crud-danger);
}
.btn-action--delete:hover {
    background: var(--crud-danger);
    color: #fff;
    transform: translateY(-1px);
}

/* ── Pagination ──────────────────────────────────────── */
.pagination .page-link {
    border-radius: .4rem !important;
    margin: 0 2px;
    color: var(--crud-accent);
    border-color: var(--crud-border);
    font-size: .8rem;
    min-width: 2rem;
    text-align: center;
    transition: all .15s ease;
}

.pagination .page-item.active .page-link {
    background-color: var(--crud-accent);
    border-color:     var(--crud-accent);
}

.pagination .page-link:hover {
    background: var(--crud-accent-light);
    color: var(--crud-accent);
}

/* ── Bulk action bar ─────────────────────────────────── */
.bulk-actions {
    background: #fffbe6;
    border: 1px solid #fde68a;
    border-radius: .5rem;
    padding: .65rem 1rem;
    animation: slideDown .2s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Search bar ──────────────────────────────────────── */
.card--filter .form-control:focus {
    border-color: var(--crud-accent);
    box-shadow: 0 0 0 .2rem rgba(67,97,238,.15);
}

/* ── Responsive tweaks ───────────────────────────────── */
@media (max-width: 575.98px) {
    .page-title          { font-size: 1.2rem; }
    .table thead th      { font-size: .7rem; padding: .6rem .75rem; }
    .table tbody td      { font-size: .8rem;  padding: .6rem .75rem; }
    .btn-action--add     { padding: .4rem .75rem; font-size: .85rem; }
    .col-actions         { width: 7rem; }
}