/* css/style.css */

/* GENERAL */
body { font-family: 'Segoe UI', sans-serif; background-color: #0f172a; color: white; }

/* UTILS */
.full-height-container { height: calc(100vh - 100px); }
@media (max-width: 768px) { .full-height-container { height: auto; } }

/* SCROLLBAR */
.custom-scrollbar::-webkit-scrollbar { width: 6px; height: 6px; }
.custom-scrollbar::-webkit-scrollbar-track { background: rgba(0,0,0,0.1); }
.custom-scrollbar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 3px; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.4); }

/* UI COMPONENTS */
.card {
    background-color: #1e293b !important; 
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

/* Assurer que les cartes admin ont aussi le bon background */
.card.p-6.rounded-xl {
    background-color: #1e293b !important;
    background: linear-gradient(135deg, #1e293b 0%, #1a2332 100%) !important;
}

/* Amélioration des cartes de livres en mode grid */
.card.rounded-xl {
    background: linear-gradient(135deg, #1e293b 0%, #1a2332 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.card.rounded-xl:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.5), 0 4px 8px rgba(234, 179, 8, 0.2);
    border-color: rgba(234, 179, 8, 0.4);
}

.card.rounded-xl .aspect-\[2\/3\] {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.card.rounded-xl:hover .aspect-\[2\/3\] img {
    transform: scale(1.05);
}

.input-field {
    width: 100%;
    background: linear-gradient(135deg, #0f172a 0%, #0a0f1a 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    color: white;
    outline: none;
    font-size: 0.875rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.input-field:hover {
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.input-field:focus { 
    border-color: #eab308; 
    box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.3), 0 4px 12px rgba(234, 179, 8, 0.15);
    background: linear-gradient(135deg, #0f172a 0%, #0a0f1a 100%);
    transform: translateY(-1px);
}

.label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: 0.25rem;
    font-weight: bold;
}

.btn-action {
    background: linear-gradient(135deg, #eab308 0%, #f59e0b 100%);
    color: #0f172a;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(234, 179, 8, 0.3), 0 2px 4px rgba(0, 0, 0, 0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(234, 179, 8, 0.3);
}

.btn-action:hover { 
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(234, 179, 8, 0.4), 0 4px 8px rgba(0, 0, 0, 0.3);
}

.btn-action:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(234, 179, 8, 0.3);
}

.btn-icon {
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: #cbd5e1; transition: all 0.2s;
}
.btn-icon:hover { color: white; background-color: rgba(255,255,255,0.1); }

.filter-bar {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 41, 59, 0.95) 100%);
    backdrop-filter: blur(8px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 0;
    z-index: 40;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2), 0 1px 4px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.filter-bar:hover {
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25), 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Styles pour les selects dans la filter-bar */
.filter-bar select.input-field,
.filter-bar select.filter-bar-select {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.9) 0%, rgba(26, 35, 50, 0.9) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: white;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 1.75rem;
    height: 1.75rem;
    max-height: 1.75rem;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.4rem center;
    background-size: 0.65rem;
    padding-right: 1.75rem;
    padding-left: 0.5rem;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    font-weight: 400;
    font-size: 0.7rem;
    line-height: 1.25;
}

.filter-bar select.input-field:hover,
.filter-bar select.filter-bar-select:hover {
    border-color: rgba(255, 255, 255, 0.12);
    background: linear-gradient(135deg, rgba(51, 65, 85, 0.95) 0%, rgba(45, 58, 79, 0.95) 100%);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.filter-bar select.input-field:focus,
.filter-bar select.filter-bar-select:focus {
    border-color: #eab308;
    box-shadow: 0 0 0 1px rgba(234, 179, 8, 0.3), 0 1px 4px rgba(234, 179, 8, 0.1);
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(26, 35, 50, 0.95) 100%);
    outline: none;
}

.filter-bar select.input-field.font-bold.text-yellow-500 {
    border-color: rgba(234, 179, 8, 0.4);
    color: #eab308;
    background: linear-gradient(135deg, #2a1f0a 0%, #1e293b 100%);
    box-shadow: 0 2px 8px rgba(234, 179, 8, 0.15);
}

.filter-bar select.input-field.font-bold.text-yellow-500:hover {
    border-color: rgba(234, 179, 8, 0.6);
    background: linear-gradient(135deg, #3d2f0f 0%, #334155 100%);
    box-shadow: 0 4px 12px rgba(234, 179, 8, 0.25);
}

.filter-bar select option {
    background-color: #1e293b;
    color: white;
    padding: 0.5rem;
}

/* Fix pour les selects dans la partie admin (pas dans filter-bar) */
.card select.input-field {
    background-color: #1e293b !important;
    background: linear-gradient(135deg, #1e293b 0%, #1a2332 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: white !important;
}

.card select.input-field option {
    background-color: #1e293b !important;
    color: white !important;
    padding: 0.5rem;
}

.modal-overlay { 
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
}

/* Amélioration du formulaire d'ajout/modification */
.modal-overlay .card {
    background: linear-gradient(135deg, #1e293b 0%, #1a2332 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(234, 179, 8, 0.1);
    animation: modalFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Amélioration de la zone de couverture dans le formulaire */
.modal-overlay .card .aspect-\[2\/3\] {
    border: 2px solid rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

.modal-overlay .card .aspect-\[2\/3\]:hover {
    border-color: rgba(234, 179, 8, 0.4);
    box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.4), 0 0 0 2px rgba(234, 179, 8, 0.1);
}

/* ANIMATIONS */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.animate-fade-in { animation: fadeIn 0.3s ease-out forwards; }
.animate-fade-in-down { animation: fadeIn 0.5s ease-out forwards; }

/* ZOOM COUVERTURE MODE LIGNE */
table tbody td:first-child {
    overflow: visible !important;
}
table tbody td:first-child > div {
    position: relative;
}

/* RESPONSIVE MOBILE / TABLETTE */
@media (max-width: 640px) {
    .filter-bar select,
    .filter-bar .input-field {
        min-height: 44px;
        font-size: 0.875rem;
    }
    .filter-bar {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    .card.rounded-xl table th,
    .card.rounded-xl table td {
        padding: 0.5rem 0.375rem !important;
        font-size: 0.75rem;
    }
    .card.rounded-xl.overflow-x-auto {
        margin-left: -1rem;
        margin-right: -1rem;
        border-radius: 0;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    [x-data] .gap-6 { gap: 1rem; }
}

@media (max-width: 768px) {
    .modal-overlay .card {
        margin: 0.5rem;
        max-height: calc(100vh - 1rem);
    }
    .btn-action, button.bg-yellow-600, button.bg-gray-600 {
        min-height: 44px;
        padding: 0.5rem 1rem;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    table th, table td {
        padding: 0.5rem 0.5rem !important;
    }
}

/* Touch-friendly (mobile / tablette) */
@media (hover: none) and (max-width: 1024px) {
    nav .btn-icon,
    .filter-bar select,
    .filter-bar .input-field,
    .filter-bar button {
        min-height: 44px;
    }
    button.rounded-full.w-12.h-12 {
        min-height: 48px;
        min-width: 48px;
    }
    .card.rounded-xl table button[title] {
        min-height: 36px;
        min-width: 36px;
        padding: 0.25rem 0.5rem;
    }
}

/* Fix pour l'icône de recherche - éviter le ghosting/doublage et assurer un bon alignement */
.fa-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
    pointer-events: none;
    z-index: 10;
    font-size: 0.875rem;
    line-height: 1;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: inline-block;
}

/* Amélioration de la barre de recherche */
input[type="search"].input-field {
    padding-left: 2.5rem !important;
}

/* Ajustement pour les petites barres de recherche */
input[type="search"].input-field.text-xs {
    padding-left: 2rem !important;
}

/* Ajustement spécifique pour l'icône de recherche dans admin */
.card .fa-search-icon {
    left: 0.5rem;
    font-size: 0.75rem;
}

/* Fix pour les icônes dans les formulaires de PDF */
.modal-overlay .card .relative i.fa-solid {
    z-index: 1;
    pointer-events: none;
}

.modal-overlay .card input[type="file"] + i,
.modal-overlay .card input[readonly] + i {
    left: 0.75rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}

/* Fix spécifique pour les icônes dans le formulaire de modification de PDF */
.modal-overlay .card .relative i.fa-cloud,
.modal-overlay .card .relative i.fa-link,
.modal-overlay .card .relative i.fa-file-pdf,
.modal-overlay .card .relative i.fa-server {
    left: 0.75rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 1;
    pointer-events: none;
}

.modal-overlay .card .relative input.pl-8 {
    padding-left: 2rem !important;
}

/* Fix pour les icônes dans le formulaire de profil utilisateur */
.modal-overlay .card .relative.social-input i,
.modal-overlay .card .relative i.fa-user,
.modal-overlay .card .relative i.fa-globe,
.modal-overlay .card .relative i.fa-lock,
.modal-overlay .card .relative i.fa-key,
.modal-overlay .card .relative i.fa-brands {
    left: 0.75rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 10 !important;
    pointer-events: none !important;
}

.modal-overlay .card .relative.social-input input.pl-12,
.modal-overlay .card .relative input.pl-12 {
    padding-left: 3rem !important;
}

/* Amélioration de la table en mode liste */
.card.rounded-xl table {
    border-collapse: separate;
    border-spacing: 0;
}

.card.rounded-xl table thead {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.3) 100%) !important;
    backdrop-filter: blur(8px);
}

.card.rounded-xl table tbody tr {
    transition: all 0.2s ease;
}

.card.rounded-xl table tbody tr:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    transform: scale(1.001);
}

/* Fix pour les éléments de liste admin */
.bg-white\/5.rounded {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

/* Amélioration des boutons de pagination */
.filter-bar button.w-7.h-7 {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.filter-bar button.w-7.h-7:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(234, 179, 8, 0.3);
}

.filter-bar button.w-7.h-7:active:not(:disabled) {
    transform: translateY(0);
}

/* Amélioration du compteur de livres */
.filter-bar span.text-xs.opacity-50 {
    padding: 0.25rem 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.25rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.2s ease;
    font-size: 0.7rem;
    line-height: 1.25;
    white-space: nowrap;
    display: inline-block;
}

.filter-bar:hover span.text-xs.opacity-50 {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}
