/* Mis Decks — dashboard moderno */
.page-decks.store-marketplace .store-main {
    background: #f7f8fc;
}

.decks-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.25rem 1rem 2.5rem;
}

/* Encabezado de sección */
.decks-section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.decks-section-title-wrap {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    min-width: 0;
}

.decks-section-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.25);
}

.decks-section-title {
    margin: 0;
    font-size: 1.65rem;
    font-weight: 800;
    color: #111827;
    line-height: 1.2;
}

.decks-section-subtitle {
    margin: 0.2rem 0 0;
    font-size: 0.92rem;
    color: #6b7280;
}

.decks-section-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.decks-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 1.1rem;
    border-radius: 12px;
    font-size: 0.88rem;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s, transform 0.15s, box-shadow 0.2s;
    white-space: nowrap;
}

.decks-btn--primary {
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    color: #fff;
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.28);
}

.decks-btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(99, 102, 241, 0.35);
    color: #fff;
}

.decks-btn--secondary {
    background: #fff;
    color: #6366f1;
    border-color: #c7d2fe;
}

.decks-btn--secondary:hover {
    background: #eef2ff;
    color: #4f46e5;
}

/* Tabs por formato */
.decks-fmt-tabs {
    display: flex;
    gap: 0.35rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 0.35rem;
    background: #eef0f6;
    border-radius: 14px;
    margin-bottom: 0.85rem;
    scrollbar-width: thin;
}

.decks-fmt-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #6b7280;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.22s, color 0.22s, box-shadow 0.22s;
    white-space: nowrap;
    position: relative;
}

.decks-fmt-tab i {
    font-size: 0.8rem;
    opacity: 0.85;
}

.decks-fmt-tab .decks-tab-count {
    font-size: 0.78rem;
    opacity: 0.75;
    font-weight: 700;
}

.decks-fmt-tab.active {
    background: #fff;
    color: #6366f1;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
}

.decks-fmt-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 12%;
    right: 12%;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: linear-gradient(90deg, #6366f1, #f97316);
}

.decks-fmt-tab[data-formato="avanzado"].active { color: #6366f1; }
.decks-fmt-tab[data-formato="edison"].active { color: #d97706; }
.decks-fmt-tab[data-formato="goat"].active { color: #16a34a; }
.decks-fmt-tab[data-formato="redu"].active { color: #db2777; }

/* Toolbar */
.decks-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding: 0.65rem 0;
}

.decks-toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.decks-search-wrap {
    position: relative;
    min-width: 200px;
    max-width: 280px;
    flex: 1;
}

.decks-search-wrap i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
}

.decks-search-input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    font-size: 0.88rem;
    color: #111827;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.decks-search-input:focus {
    outline: none;
    border-color: #a5b4fc;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.decks-drag-hint {
    margin: 0;
    font-size: 0.82rem;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.decks-drag-hint.off {
    opacity: 0.55;
}

.decks-click-hint {
    margin: 0;
    font-size: 0.82rem;
    color: #9ca3af;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.decks-order-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: #111827;
    color: #fff;
    padding: 0.55rem 1.1rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
    z-index: 2000;
    pointer-events: none;
}

.decks-order-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Grid de decks */
.decks-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    min-height: 120px;
    align-items: start;
}

.decks-grid.is-loading {
    opacity: 0.55;
    pointer-events: none;
}

/* Grid de decks — scoped para no heredar .deck-card del editor (aspect-ratio YGO) */
.page-decks .decks-grid .deck-card {
    aspect-ratio: unset;
    height: auto;
    max-height: none;
    min-height: 0;
    width: 100%;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.22s, box-shadow 0.22s;
    cursor: pointer;
    align-self: start;
    background: #fff;
}

.page-decks .decks-grid .deck-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
}

.page-decks .decks-grid .deck-card.sortable-ghost {
    opacity: 0.45;
}

.page-decks .decks-grid .deck-card.sortable-chosen {
    box-shadow: 0 16px 40px rgba(99, 102, 241, 0.2);
}

.deck-card-banner {
    position: relative;
    height: 140px;
    flex: 0 0 140px;
    overflow: hidden;
}

.deck-card-banner-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center 22%;
    background-repeat: no-repeat;
    transition: transform 0.35s ease;
}

.deck-card-banner-img {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 22%;
    transition: transform 0.35s ease;
}

.deck-card:hover .deck-card-banner-bg,
.deck-card:hover .deck-card-banner-img {
    transform: scale(1.06);
}

.deck-card-banner-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.82) 0%, rgba(0, 0, 0, 0.15) 55%, rgba(0, 0, 0, 0.05) 100%);
    pointer-events: none;
}

.deck-card-grip {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.45);
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 2;
    cursor: grab;
}

.deck-card:hover .deck-card-grip {
    opacity: 1;
}

.deck-card-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #fff;
    z-index: 2;
    text-transform: uppercase;
}

.deck-card-badge--avanzado { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.deck-card-badge--edison { background: linear-gradient(135deg, #f59e0b, #d97706); }
.deck-card-badge--goat { background: linear-gradient(135deg, #22c55e, #16a34a); }
.deck-card-badge--redu { background: linear-gradient(135deg, #ec4899, #db2777); }

.deck-card-name {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 8px;
    margin: 0;
    font-size: 0.82rem;
    font-weight: 800;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    line-height: 1.2;
    z-index: 2;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Barra de acciones (6 columnas) */
.page-decks .decks-grid .deck-card-actions {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    border-top: 1px solid #e5e7eb;
    background: #fff;
    flex: 0 0 62px;
    height: 62px;
    min-height: 62px;
    max-height: 62px;
    box-sizing: border-box;
}

.deck-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    padding: 0.35rem 0.1rem;
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 0.55rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.18s, background 0.18s;
    min-width: 0;
}

.deck-action-btn i {
    font-size: 0.85rem;
}

.deck-action-btn:hover,
.deck-action-btn:focus-visible {
    color: #6366f1;
    background: #f5f3ff;
    outline: none;
}

.deck-action-btn--danger:hover {
    color: #ef4444;
    background: #fef2f2;
}

.deck-action-count {
    font-size: 0.58rem;
    font-weight: 800;
    color: #6366f1;
}

/* Slot nuevo deck */
.page-decks .decks-grid .deck-card-add {
    border: 2px dashed #d1d5db;
    border-radius: 16px;
    background: #fff;
    height: 202px;
    min-height: 202px;
    max-height: 202px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: #9ca3af;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.deck-card-add:hover {
    border-color: #6366f1;
    color: #6366f1;
    background: #fafaff;
}

.deck-card-add i {
    font-size: 2rem;
}

.deck-card-add span {
    font-size: 0.88rem;
    font-weight: 600;
}

.decks-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2.5rem 1rem;
    color: #6b7280;
    font-size: 0.95rem;
}

/* Modales custom (SweetAlert overrides) */
.decks-modal-input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 0.95rem;
    margin-top: 0.5rem;
}

.decks-share-url {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 0.82rem;
    background: #f9fafb;
    margin: 0.75rem 0;
}

/* Responsive */
@media (max-width: 1200px) {
    .decks-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1024px) {
    .decks-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .decks-section-header {
        flex-direction: column;
    }

    .decks-section-actions {
        width: 100%;
    }

    .decks-btn {
        flex: 1;
        justify-content: center;
    }

    .decks-grid {
        grid-template-columns: 1fr;
    }

    .decks-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .decks-search-wrap {
        max-width: none;
    }

    .decks-click-hint {
        justify-content: flex-end;
    }

    .deck-card-actions {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        grid-template-rows: repeat(2, auto);
    }

    .deck-card-banner {
        height: 150px;
    }
}

/* Import YDK modal */
.decks-import-path {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    margin: 0 0 1rem;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    font-size: 0.82rem;
    color: #374151;
    text-align: left;
}

.decks-import-path code {
    display: block;
    margin-top: 0.25rem;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    background: #111827;
    color: #f9fafb;
    font-size: 0.78rem;
    word-break: break-all;
}

.decks-import-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.85rem;
    text-align: left;
}

.decks-import-label {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #6b7280;
}

.decks-import-select {
    width: 100%;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    padding: 0.5rem 0.65rem;
    font-size: 0.9rem;
}

.decks-import-dropzone {
    border: 2px dashed #c7d2fe;
    border-radius: 14px;
    background: #f8faff;
    padding: 1.35rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.decks-import-dropzone:hover,
.decks-import-dropzone.is-dragover {
    border-color: #6366f1;
    background: #eef2ff;
    transform: translateY(-1px);
}

.decks-import-dropzone.has-file {
    border-color: #22c55e;
    background: #f0fdf4;
}

.decks-import-dropzone-icon {
    font-size: 1.75rem;
    color: #6366f1;
    margin-bottom: 0.35rem;
}

.decks-import-dropzone-title {
    margin: 0;
    font-weight: 700;
    color: #111827;
    font-size: 0.95rem;
}

.decks-import-dropzone-hint {
    margin: 0.35rem 0 0;
    font-size: 0.78rem;
    color: #6b7280;
}

.decks-import-file-name {
    margin-top: 0.55rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: #15803d;
}

.decks-import-file-list {
    list-style: none;
    margin: 0.75rem 0 0;
    padding: 0;
    max-height: 140px;
    overflow-y: auto;
    text-align: left;
}

.decks-import-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    margin-bottom: 0.25rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(34, 197, 94, 0.25);
    font-size: 0.8rem;
}

.decks-import-file-item-name {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    color: #15803d;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.decks-import-file-remove {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 6px;
    background: #fee2e2;
    color: #b91c1c;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}

.decks-import-file-remove:hover {
    background: #fecaca;
}

.decks-import-result-list {
    list-style: none;
    margin: 0;
    padding: 0;
    text-align: left;
    max-height: 220px;
    overflow-y: auto;
}

.decks-import-result-list li {
    padding: 0.45rem 0;
    border-bottom: 1px solid #eee;
    font-size: 0.88rem;
}

.decks-import-result-list li:last-child {
    border-bottom: none;
}

.decks-import-result-errors {
    margin: 0.75rem 0 0;
    font-size: 0.78rem;
    color: #b45309;
    text-align: left;
}

.decks-import-error {
    margin-top: 0.65rem;
    font-size: 0.82rem;
    color: #dc2626;
    text-align: left;
}
