/* ═══════════════════════════════════════════════════════════════
   OpusWebcam V3.0 - Module Binders
   Fichier: binders.css
   Description: Styles pour la bibliotheque de binders virtuels
   Design: Glassmorphism (coherent avec inventory.css et dashboard.css)
   ═══════════════════════════════════════════════════════════════ */

/* ───────────────────────────────────────────────────────────────
   HEADER BINDERS
   ─────────────────────────────────────────────────────────────── */
.binders-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
    padding: var(--space-md) 0;
}

.binders-title h4 {
    color: #fff;
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.binders-title .text-muted {
    color: rgba(255, 255, 255, 0.5) !important;
    font-size: 0.9rem;
}

.binders-controls {
    display: flex;
    gap: var(--space-sm);
}

/* ───────────────────────────────────────────────────────────────
   STATS ROW
   ─────────────────────────────────────────────────────────────── */
.binders-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

@media (max-width: 992px) {
    .binders-stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .binders-stats-row {
        grid-template-columns: 1fr;
    }
}

/* ───────────────────────────────────────────────────────────────
   GRILLE DES BINDERS (Bibliotheque)
   ─────────────────────────────────────────────────────────────── */
.binders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--space-xl);
    padding: var(--space-lg) 0;
}

@media (min-width: 1200px) {
    .binders-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 768px) {
    .binders-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: var(--space-md);
    }
}

/* Carte Binder - Style Classeur Ferme Realiste */
.binder-card {
    display: flex;
    flex-direction: row;
    width: 100%;
    aspect-ratio: 3/4;
    max-width: 220px;
    background: transparent;
    border-radius: 4px;
    overflow: visible;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    transform-style: preserve-3d;
}

.binder-card:hover {
    transform: translateY(-10px) rotateY(-8deg) scale(1.02);
}

/* Reliure du classeur (tranche) */
.binder-spine-visual {
    width: 28px;
    min-width: 28px;
    height: 100%;
    background: linear-gradient(90deg,
        var(--binder-color-dark, #4a5568) 0%,
        var(--binder-color, #667eea) 40%,
        var(--binder-color, #667eea) 60%,
        var(--binder-color-dark, #4a5568) 100%);
    border-radius: 4px 0 0 4px;
    position: relative;
    box-shadow: inset -3px 0 6px rgba(0, 0, 0, 0.4),
                -3px 3px 15px rgba(0, 0, 0, 0.3);
}

/* Lignes horizontales sur la tranche */
.binder-spine-visual::before {
    content: '';
    position: absolute;
    top: 10%;
    left: 0;
    right: 0;
    height: 80%;
    background: repeating-linear-gradient(
        180deg,
        transparent 0px,
        transparent 18px,
        rgba(0, 0, 0, 0.15) 18px,
        rgba(0, 0, 0, 0.15) 20px
    );
}

/* Couverture du binder */
.binder-cover {
    flex: 1;
    height: 100%;
    background: linear-gradient(160deg,
        var(--binder-color, #667eea) 0%,
        var(--binder-color-end, #764ba2) 100%);
    border-radius: 0 4px 4px 0;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px 15px;
    box-shadow: 5px 5px 20px rgba(0, 0, 0, 0.35),
                inset 0 1px 0 rgba(255, 255, 255, 0.15),
                inset 0 -1px 0 rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Effet brillant sur la couverture */
.binder-cover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg,
        rgba(255,255,255,0.2) 0%,
        rgba(255,255,255,0.05) 30%,
        transparent 50%,
        rgba(0,0,0,0.1) 100%);
    pointer-events: none;
}

/* Ligne de pliure */
.binder-cover::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 8px;
    background: linear-gradient(90deg,
        rgba(0,0,0,0.25) 0%,
        rgba(0,0,0,0.08) 60%,
        transparent 100%);
}

/* Titre du binder */
.binder-cover-title {
    position: relative;
    z-index: 2;
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    padding-left: 8px;
    line-height: 1.3;
    word-break: break-word;
}

/* Badge type - cache */
.binder-cover-type {
    display: none;
}

/* Preview cartes - cache */
.binder-preview {
    display: none;
}

/* Stats en bas */
.binder-cover-stats {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-left: 8px;
}

.binder-cover-stats .stat-item {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    gap: 6px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.binder-cover-stats .stat-item i {
    font-size: 0.65rem;
    opacity: 0.8;
}

.binder-cover-stats .stat-value {
    font-weight: 700;
    color: #fff;
}

/* Infos du binder (legacy - garde pour compatibilite) */
.binder-info-card {
    display: none;
}

/* Actions du binder (au hover) */
.binder-actions-overlay {
    position: absolute;
    top: 50px;
    right: var(--space-sm);
    display: flex;
    gap: var(--space-xs);
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 10;
}

.binder-card:hover .binder-actions-overlay {
    opacity: 1;
}

.binder-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.binder-action-btn:hover {
    background: rgba(102, 126, 234, 0.9);
    transform: scale(1.1);
}

/* ───────────────────────────────────────────────────────────────
   ETAT VIDE
   ─────────────────────────────────────────────────────────────── */
.binders-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--space-3xl);
    color: rgba(255, 255, 255, 0.6);
}

.binders-empty-state .empty-icon {
    font-size: 4rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.binders-empty-state h5 {
    color: #fff;
    margin-bottom: var(--space-sm);
}

.binders-empty-state p {
    margin-bottom: var(--space-lg);
}

/* ───────────────────────────────────────────────────────────────
   VUE DETAIL BINDER (pages ouvertes)
   ─────────────────────────────────────────────────────────────── */
.binder-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
    padding: var(--space-md);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.binder-info h4 {
    color: #fff;
    margin: 0;
    font-size: 1.25rem;
}

.binder-info .text-muted {
    color: rgba(255, 255, 255, 0.5) !important;
}

.binder-actions {
    display: flex;
    gap: var(--space-sm);
}

/* Navigation pages */
.binder-pages-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.page-nav-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.page-nav-btn:hover:not(:disabled) {
    background: rgba(102, 126, 234, 0.3);
    border-color: #667eea;
    transform: scale(1.1);
}

.page-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.page-indicator {
    font-size: 1.2rem;
    color: #fff;
    font-weight: 600;
    min-width: 100px;
    text-align: center;
}

/* ───────────────────────────────────────────────────────────────
   SPREAD (Double page ouverte)
   ─────────────────────────────────────────────────────────────── */
.binder-spread {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 0;
    perspective: 2000px;
    padding: var(--space-xl) 0;
}

/* Page du binder */
.binder-page {
    background: linear-gradient(135deg,
        rgba(30, 30, 40, 0.95) 0%,
        rgba(40, 40, 55, 0.95) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: var(--space-lg);
    position: relative;
    min-height: 500px;
    width: 380px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.binder-page-left {
    border-radius: 8px 0 0 8px;
    transform-origin: right center;
    background: linear-gradient(90deg,
        rgba(30, 30, 40, 0.98) 0%,
        rgba(35, 35, 48, 0.95) 100%);
}

.binder-page-right {
    border-radius: 0 8px 8px 0;
    transform-origin: left center;
    background: linear-gradient(90deg,
        rgba(35, 35, 48, 0.95) 0%,
        rgba(30, 30, 40, 0.98) 100%);
}

/* Reliure centrale */
.binder-spine {
    width: 20px;
    background: linear-gradient(90deg,
        #1a1a24 0%,
        #252533 25%,
        #1a1a24 50%,
        #252533 75%,
        #1a1a24 100%);
    border-radius: 0;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8);
    position: relative;
}

.binder-spine::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg,
        transparent 0%,
        rgba(255, 255, 255, 0.1) 10%,
        rgba(255, 255, 255, 0.1) 90%,
        transparent 100%);
}

/* Numero de page */
.page-number {
    position: absolute;
    bottom: var(--space-sm);
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.85rem;
}

.binder-page-left .page-number {
    left: var(--space-md);
}

.binder-page-right .page-number {
    right: var(--space-md);
}

/* ───────────────────────────────────────────────────────────────
   GRILLE DES SLOTS (Pochettes 3x3)
   ─────────────────────────────────────────────────────────────── */
.page-slots {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: var(--space-sm);
    height: 100%;
}

/* Slot individuel (pochette) */
.card-slot {
    aspect-ratio: 63/88;
    background: rgba(0, 0, 0, 0.3);
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.2s ease;
    cursor: pointer;
    overflow: hidden;
}

.card-slot:hover {
    border-color: rgba(102, 126, 234, 0.5);
    background: rgba(102, 126, 234, 0.1);
}

.card-slot.drag-over {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.2);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
}

/* Slot vide */
.card-slot.empty::before {
    content: '+';
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.15);
    transition: all 0.2s ease;
}

.card-slot.empty:hover::before {
    color: rgba(102, 126, 234, 0.5);
    transform: scale(1.2);
}

/* Slot avec carte */
.card-slot.filled {
    border: none;
    background: transparent;
}

.card-slot .slot-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s ease;
}

.card-slot.filled:hover .slot-card-image {
    transform: scale(1.05);
}

/* Badge de suppression sur slot */
.slot-remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(220, 53, 69, 0.9);
    color: #fff;
    font-size: 0.75rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-slot.filled:hover .slot-remove-btn {
    opacity: 1;
}

.slot-remove-btn:hover {
    background: #dc3545;
    transform: scale(1.1);
}

/* ───────────────────────────────────────────────────────────────
   MODALS BINDERS
   ─────────────────────────────────────────────────────────────── */
.binder-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1050;
    display: none;
}

.binder-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.binder-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.binder-modal-content {
    position: relative;
    background: rgba(30, 30, 40, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.binder-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.binder-modal-header h4 {
    margin: 0;
    color: #fff;
}

.binder-modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.binder-modal-close:hover {
    background: rgba(220, 53, 69, 0.5);
}

.binder-modal-body {
    padding: var(--space-lg);
}

.binder-modal-footer {
    padding: var(--space-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
}

/* Form dans modal */
.binder-form-group {
    margin-bottom: var(--space-lg);
}

.binder-form-group label {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: var(--space-xs);
    font-weight: 500;
}

.binder-form-group input,
.binder-form-group select,
.binder-form-group textarea {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    color: #fff;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.binder-form-group input:focus,
.binder-form-group select:focus,
.binder-form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.binder-form-group select option {
    background: #1f2937;
    color: #fff;
}

/* Selecteur de couleur */
.color-picker-row {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.color-option {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.selected {
    border-color: #fff;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

/* ───────────────────────────────────────────────────────────────
   MODAL SELECTION CARTES
   ─────────────────────────────────────────────────────────────── */
.card-picker-modal .binder-modal-content {
    max-width: 900px;
}

.card-picker-search {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.card-picker-search input {
    flex: 1;
}

.card-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: var(--space-md);
    max-height: 400px;
    overflow-y: auto;
    padding: var(--space-sm);
}

.card-picker-item {
    aspect-ratio: 63/88;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    position: relative;
}

.card-picker-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-picker-item:hover {
    transform: scale(1.05);
    border-color: rgba(102, 126, 234, 0.5);
}

.card-picker-item.selected {
    border-color: #667eea;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.4);
}

.card-picker-item.selected::after {
    content: '✓';
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: #667eea;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.75rem;
}

/* ───────────────────────────────────────────────────────────────
   RESPONSIVE
   ─────────────────────────────────────────────────────────────── */
@media (max-width: 992px) {
    .binder-spread {
        flex-direction: column;
        align-items: center;
    }

    .binder-page {
        width: 100%;
        max-width: 380px;
    }

    .binder-page-left {
        border-radius: 8px 8px 0 0;
    }

    .binder-page-right {
        border-radius: 0 0 8px 8px;
    }

    .binder-spine {
        width: 100%;
        height: 10px;
    }

    .binder-spine::before {
        width: 100%;
        height: 2px;
        top: 50%;
        left: 0;
        transform: translateY(-50%);
    }

    .binder-detail-header {
        flex-direction: column;
        gap: var(--space-md);
        text-align: center;
    }

    .binder-actions {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 576px) {
    .binders-header {
        flex-direction: column;
        gap: var(--space-md);
        text-align: center;
    }

    .page-slots {
        gap: 4px;
    }

    .binder-page {
        padding: var(--space-sm);
        min-height: 350px;
    }
}

/* ───────────────────────────────────────────────────────────────
   COULEURS PREDEFINIES POUR BINDERS
   ─────────────────────────────────────────────────────────────── */
.binder-color-blue {
    --binder-color: #667eea;
    --binder-color-end: #764ba2;
    --binder-color-dark: #4a5cc8;
    --binder-glow: 102, 126, 234;
}

.binder-color-red {
    --binder-color: #e53e3e;
    --binder-color-end: #c53030;
    --binder-color-dark: #9b2c2c;
    --binder-glow: 229, 62, 62;
}

.binder-color-green {
    --binder-color: #38a169;
    --binder-color-end: #276749;
    --binder-color-dark: #1e5245;
    --binder-glow: 56, 161, 105;
}

.binder-color-yellow {
    --binder-color: #d69e2e;
    --binder-color-end: #b7791f;
    --binder-color-dark: #8b5c14;
    --binder-glow: 214, 158, 46;
}

.binder-color-purple {
    --binder-color: #805ad5;
    --binder-color-end: #553c9a;
    --binder-color-dark: #44337a;
    --binder-glow: 128, 90, 213;
}

.binder-color-pink {
    --binder-color: #ed64a6;
    --binder-color-end: #b83280;
    --binder-color-dark: #97266d;
    --binder-glow: 237, 100, 166;
}

.binder-color-orange {
    --binder-color: #ed8936;
    --binder-color-end: #c05621;
    --binder-color-dark: #9c4221;
    --binder-glow: 237, 137, 54;
}

.binder-color-teal {
    --binder-color: #319795;
    --binder-color-end: #234e52;
    --binder-color-dark: #1d4044;
    --binder-glow: 49, 151, 149;
}

.binder-color-gray {
    --binder-color: #4a5568;
    --binder-color-end: #2d3748;
    --binder-color-dark: #1a202c;
    --binder-glow: 74, 85, 104;
}

.binder-color-black {
    --binder-color: #2d3748;
    --binder-color-end: #1a202c;
    --binder-color-dark: #0d1117;
    --binder-glow: 45, 55, 72;
}

/* ───────────────────────────────────────────────────────────────
   ANIMATIONS
   ─────────────────────────────────────────────────────────────── */
@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.binder-page-left {
    animation: slideInFromLeft 0.4s ease-out;
}

.binder-page-right {
    animation: slideInFromRight 0.4s ease-out;
}

.binder-card {
    animation: fadeInUp 0.3s ease-out;
    animation-fill-mode: both;
}

.binder-card:nth-child(1) { animation-delay: 0.05s; }
.binder-card:nth-child(2) { animation-delay: 0.1s; }
.binder-card:nth-child(3) { animation-delay: 0.15s; }
.binder-card:nth-child(4) { animation-delay: 0.2s; }
.binder-card:nth-child(5) { animation-delay: 0.25s; }
.binder-card:nth-child(6) { animation-delay: 0.3s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
