/* css/catalog.css - Styles Catalogue V3.2 - Style pcagrade */

/* ═══════════════════════════════════════════════════════════════
   LAYOUT PRINCIPAL
   ═══════════════════════════════════════════════════════════════ */

.catalog-layout {
    display: flex;
    gap: 0;
    min-height: 600px;
}

/* ═══════════════════════════════════════════════════════════════
   SIDEBAR - STYLE PCAGRADE
   ═══════════════════════════════════════════════════════════════ */

.catalog-sidebar {
    width: 280px;
    flex-shrink: 0;
    background: linear-gradient(180deg, #1a1a24 0%, #12121a 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    overflow-y: auto;
    overflow-x: hidden;
}

.catalog-sidebar-content {
    padding: 0;
}

/* Recherche dans sidebar */
.sidebar-search {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-search .search-input-wrapper {
    position: relative;
}

.sidebar-search .catalog-search-input {
    width: 100%;
    padding: 12px 40px 12px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.sidebar-search .catalog-search-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.1);
    border-color: #667eea;
}

.sidebar-search .catalog-search-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.sidebar-search .search-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.4);
}

/* Titre section */
.sidebar-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
}

.sidebar-section-title i {
    font-size: 1rem;
}

/* Liste des blocs */
.blocs-list {
    padding: 0;
}

/* Bloc item */
.bloc-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.bloc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.15s;
    color: rgba(255, 255, 255, 0.8);
}

.bloc-header:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #fff;
}

.bloc-item.has-selection .bloc-header {
    color: #667eea;
}

.bloc-name {
    font-size: 0.9rem;
    font-weight: 500;
}

.bloc-toggle {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(102, 126, 234, 0.2);
    border-radius: 50%;
    font-size: 1.2rem;
    font-weight: 300;
    color: #667eea;
    transition: all 0.2s;
}

.bloc-item.expanded .bloc-toggle {
    background: #667eea;
    color: #fff;
}

/* Series dans un bloc */
.bloc-series {
    background: rgba(0, 0, 0, 0.2);
    padding: 4px 0;
}

.series-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px 10px 28px;
    cursor: pointer;
    transition: all 0.15s;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    border-left: 3px solid transparent;
}

.series-item:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #fff;
}

.series-item.selected {
    background: rgba(102, 126, 234, 0.2);
    color: #667eea;
    border-left-color: #667eea;
    font-weight: 500;
}

.series-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 8px;
}

.series-count {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
}

.series-item.selected .series-count {
    background: rgba(102, 126, 234, 0.3);
    color: #667eea;
}

/* ═══════════════════════════════════════════════════════════════
   CONTENU PRINCIPAL
   ═══════════════════════════════════════════════════════════════ */

.catalog-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 20px;
    background: #0d0d12;
}

/* ═══════════════════════════════════════════════════════════════
   ECRAN D'ACCUEIL
   ═══════════════════════════════════════════════════════════════ */

.catalog-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 20px;
    flex: 1;
}

.welcome-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.8;
}

.catalog-welcome h2 {
    font-size: 1.8rem;
    color: #fff;
    margin: 0 0 10px;
    font-weight: 600;
}

.welcome-subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.6);
    margin: 0 0 30px;
}

.welcome-subtitle strong {
    color: #667eea;
}

.welcome-hint {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.95rem;
}

.welcome-hint i {
    color: #667eea;
    font-size: 1.2rem;
    animation: bounceLeft 1.5s ease-in-out infinite;
}

@keyframes bounceLeft {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-8px); }
}

.welcome-or {
    margin: 20px 0;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.9rem;
}

.welcome-search-hint {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
}

/* ═══════════════════════════════════════════════════════════════
   HEADER CARTES
   ═══════════════════════════════════════════════════════════════ */

.catalog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-title h3 {
    margin: 0;
    font-size: 1.3rem;
    color: #fff;
    font-weight: 600;
}

.header-count {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    margin-left: 12px;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.catalog-sort-select {
    padding: 8px 30px 8px 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%23999' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: calc(100% - 10px) center;
}

.btn-reset-selection {
    width: 36px;
    height: 36px;
    background: rgba(220, 53, 69, 0.15);
    border: 1px solid rgba(220, 53, 69, 0.3);
    border-radius: 6px;
    color: #dc3545;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-reset-selection:hover {
    background: rgba(220, 53, 69, 0.25);
}

/* ═══════════════════════════════════════════════════════════════
   GRILLE DE CARTES
   ═══════════════════════════════════════════════════════════════ */

.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    overflow-y: visible;
    padding-right: 8px;
    align-content: start;
}

/* Carte individuelle */
.catalog-card {
    background: #1a1a24;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.25s ease;
}

.catalog-card:hover {
    transform: translateY(-4px);
    border-color: rgba(102, 126, 234, 0.4);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.card-image {
    aspect-ratio: 63/88; /* Ratio exact des cartes Pokemon */
    background: linear-gradient(135deg, #1a1a24, #0d0d12);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Affiche la carte complete sans couper */
    border-radius: 6px;
    transition: transform 0.3s;
}

.catalog-card:hover .card-image img {
    transform: scale(1.03);
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    gap: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.card-info {
    flex: 1;
    min-width: 0;
}

.card-name {
    display: block;
    font-weight: 600;
    color: #fff;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.card-number {
    display: block;
    font-size: 0.75rem;
    color: #667eea;
    margin-top: 2px;
    font-weight: 500;
}

/* Bouton ajouter */
.btn-add-card {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #28a745, #20c997);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s;
}

.btn-add-card:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
}

/* ═══════════════════════════════════════════════════════════════
   PAGINATION
   ═══════════════════════════════════════════════════════════════ */

.catalog-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 20px 0 10px;
    margin-top: auto;
}

.pagination-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) {
    background: #667eea;
    border-color: #667eea;
    color: #fff;
}

.pagination-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pagination-info {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    min-width: 100px;
    text-align: center;
}

/* ═══════════════════════════════════════════════════════════════
   ETATS LOADING ET EMPTY
   ═══════════════════════════════════════════════════════════════ */

.catalog-loading-state,
.catalog-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    flex: 1;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(102, 126, 234, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.catalog-empty i {
    color: rgba(255, 255, 255, 0.2);
    margin-bottom: 16px;
}

/* ═══════════════════════════════════════════════════════════════
   MODAL DETAILS
   ═══════════════════════════════════════════════════════════════ */

.card-details-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s, visibility 0.25s;
}

.card-details-modal.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.9);
}

.modal-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateY(20px);
    z-index: 10002;
    background: linear-gradient(135deg, #1e1e28, #14141c);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 650px;
    width: 95%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
    transition: transform 0.25s;
}

.card-details-modal.show .modal-content {
    transform: translate(-50%, -50%);
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    z-index: 1;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.modal-body {
    display: flex;
    gap: 24px;
    padding: 24px;
    overflow-y: auto;
    max-height: calc(90vh - 48px);
}

.card-details-image {
    flex-shrink: 0;
    width: 220px;
}

.card-details-image img {
    width: 100%;
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.card-details-info {
    flex: 1;
}

.card-details-info h2 {
    margin: 0 0 4px;
    font-size: 1.4rem;
    color: #fff;
}

.card-name-en {
    margin: 0 0 16px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
}

.details-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

.detail-label {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
}

.detail-value {
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
}

.btn-add-inventory {
    width: 100%;
    padding: 14px 20px;
    font-size: 1rem;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 992px) {
    .catalog-layout {
        flex-direction: column;
        max-height: none;
    }

    .catalog-sidebar {
        width: 100%;
        max-height: 250px;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .catalog-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

@media (max-width: 768px) {
    .modal-body {
        flex-direction: column;
        align-items: center;
    }

    .card-details-image {
        width: 180px;
    }

    .catalog-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .catalog-main {
        padding: 12px;
    }

    .catalog-grid {
        gap: 10px;
    }

    .card-footer {
        padding: 10px;
    }

    .card-name {
        font-size: 0.8rem;
    }
}
