/* Deck View Specific Styles */

/* ========================================
   USER / AUTHOR SECTION
   ======================================== */
.user-link {
    color: #87CEEB;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    transition: color 0.2s ease;
}

.user-link:hover {
    color: #5F9EA0;
    text-decoration: underline;
}

.user-stats {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.user-stat {
    display: flex;
    align-items: center;
    gap: 5px;
}

.user-stat i {
    font-size: 14px;
    opacity: 0.8;
}

.user-actions {
    flex-shrink: 0;
}

.follow-button {
    background: var(--gradient-blue);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.follow-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.follow-button.following {
    background: var(--gradient-green);
}

.follow-button.following:hover {
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

/* ========================================
   ENGAGEMENT STATS
   ======================================== */
.deck-engagement-stats {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.engagement-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.9);
}

.engagement-item i {
    font-size: 16px;
    opacity: 0.8;
}

.engagement-item .fa-eye {
    color: #87CEEB;
}

.engagement-item .fa-heart {
    color: #FFB6C1;
}

.engagement-number {
    font-size: 16px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.engagement-label {
    font-size: 12px;
    opacity: 0.8;
}

.like-button {
    background: var(--gradient-red);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    margin-left: auto;
}

.like-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.like-button.liked {
    background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
}

.like-button.liked .fa-heart {
    animation: heartBeat 0.6s ease-in-out;
}

@keyframes heartBeat {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

.buy-deck-button {
    background: var(--gradient-green);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    margin-left: 10px;
}

.buy-deck-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.buy-deck-button:disabled {
    background: var(--gradient-gray);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.deck-actions {
    display: flex;
    gap: 10px;
    margin-top: 0px;
}

/* ========================================
   DECK STATS
   ======================================== */
.deck-stats {
    display: flex;
    flex-direction: row;
    gap: 24px;
    margin: 15px 0;
    align-items: flex-start;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.stat-number,
.stat-date {
    font-size: 20px;
    font-weight: 700;
    color: #f8fafc;
    line-height: 1.2;
}

.stat-label {
    font-size: 12px;
    font-weight: 500;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

@media (max-width: 768px) {
    .deck-stats {
        flex-direction: row;
        gap: 20px;
        flex-wrap: wrap;
    }
}

/* ========================================
   CARDS SECTION (REDESIGNED)
   ======================================== */
.cards-section {
    /* New Dark Theme */
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 24px;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    margin-top: 20px;
}

.cards-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    flex-shrink: 0;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.cards-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cards-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    color: #f8fafc !important;
    /* Force light text for dark theme */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.grouping-controls {
    display: flex;
    gap: 12px;
    /* Increased gap for better spacing when wrapped */
    align-items: center;
    flex-wrap: wrap;
}

.grouping-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.grouping-controls label {
    font-size: 13px;
    color: #94a3b8;
    font-weight: 500;
}

.grouping-select {
    padding: 6px 12px;
    border: 1px solid #475569;
    background-color: #334155;
    color: #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.grouping-select:hover {
    border-color: #64748b;
    background-color: #475569;
}

.grouping-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.cards-container {
    flex: 1;
    /* Removed dashed border for premium look */
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    /* Subtle dark overlay */
    position: relative;
    width: 100%;
    min-height: 400px;
    /* transition: background-color 0.3s ease; */
}

.cards-container.drag-over {
    border-color: var(--color-green);
    background: rgba(16, 185, 129, 0.1);
    box-shadow: inset 0 0 20px rgba(16, 185, 129, 0.1);
}

/* Empty State */
.empty-deck-message {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}

.empty-deck-message i {
    font-size: 48px;
    margin-bottom: 15px;
    color: #475569;
}

.empty-deck-message h3 {
    font-size: 20px;
    margin-bottom: 10px;
    color: #e2e8f0;
    font-weight: 600;
}

.empty-deck-message p {
    font-size: 14px;
    color: #94a3b8;
}

/* ========================================
   STACKS & GRIDS layout
   ======================================== */
.stacks-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--card-min-width), 1fr));
    gap: max(16px, 2vw);
    /* Slightly increased gap */
    padding: 4px;
    width: 100%;
}

.card-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: var(--card-min-width);
    max-width: var(--card-min-width);
    margin-bottom: 12px;
}

/* Ungrouped view layout fix */
.card-stack.ungrouped {
    max-width: none;
    width: 100%;
    min-width: 100%;
    align-items: stretch;
    grid-column: 1 / -1;
    /* Span all grid columns */
}

/* Stack Headers */
.stack-header {
    background: rgba(255, 255, 255, 0.05);
    color: #e2e8f0;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    backdrop-filter: blur(4px);
}

.stack-header i {
    font-size: 12px;
    opacity: 0.7;
}

.stack-header .total-count {
    font-size: 12px;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    font-weight: 600;
    opacity: 1;
}

/* Special Categories */
.stack-header.special-category {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

/* Ownership Status Colors */
.stack-header.ownership-owned {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
    color: var(--color-green);
}

.stack-header.ownership-partially {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.2);
    color: var(--color-yellow);
}

.stack-header.ownership-not-owned {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--color-red);
}


/* ========================================
   SUBGROUPS
   ======================================== */
.subgroup-section {
    margin-bottom: 24px;
}

.subgroup-section:first-child {
    margin-top: 0;
}

.subgroup-header {
    background: #334155;
    color: #e2e8f0;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid #475569;
    width: 100%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .cards-section {
        padding: 16px;
        border-radius: 0;
        margin-top: 0;
        border: none;
    }

    .cards-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .cards-title-row {
        justify-content: space-between;
    }

    .deck-engagement-stats {
        flex-wrap: wrap;
        justify-content: center;
    }

    .deck-engagement-stats .like-button,
    .deck-engagement-stats .buy-deck-button {
        margin-left: 0 !important;
        flex: 1;
        justify-content: center;
    }
}

/* ========================================
   UTILITIES / OTHER COMPONENTS
   ======================================== */

/* Deck Burger Menu */
.deck-burger-menu {
    padding: 8px 12px;
    border: 1px solid #475569;
    border-radius: 8px;
    background: #334155;
    color: #e2e8f0;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
}

.deck-burger-menu:hover {
    background: #475569;
    border-color: #64748b;
    color: white;
}

/* Deck Context Menu */
.deck-context-menu {
    position: fixed;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    padding: 8px 0;
    z-index: 100000;
    display: none;
    min-width: 200px;
}

.deck-context-menu-item {
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #e2e8f0;
    transition: background-color 0.2s ease;
}

.deck-context-menu-item:hover {
    background-color: #334155;
}

.deck-context-menu-item i {
    width: 16px;
    text-align: center;
    color: #94a3b8;
}

/* Share modal */
.share-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    backdrop-filter: blur(4px);
}

.share-modal-content {
    background: #1e293b;
    color: #f8fafc;
    padding: 24px;
    border-radius: 12px;
    width: min(520px, 92vw);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    border: 1px solid #334155;
}

.share-modal-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 16px;
    color: #f8fafc;
}

.share-input-group {
    display: flex;
    gap: 8px;
}

.share-input-group input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #475569;
    background: #0f172a;
    border-radius: 6px;
    font-size: 14px;
    color: #f8fafc;
}

.share-modal-actions {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ========================================
   PORTED STYLES FROM VIEW_DECK_V2.HTML
   ======================================== */

/* Ungrouped grid adjustments for medium screens */
.ungrouped .stack-cards.ungrouped-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

/* Tablet optimizations - ensure proper spacing between card stacks */
@media (max-width: 1024px) and (min-width: 769px) {
    .stacks-container {
        grid-template-columns: repeat(auto-fill, minmax(var(--card-min-width), 1fr));
        gap: max(10px, 2vw);
        /* Increased spacing to prevent overlap */
        padding: 20px;
    }

    .card-stack {
        min-width: var(--card-min-width);
        /* Ensure cards don't get too small */
        max-width: var(--card-min-width);
        margin-bottom: 5px;
    }

    /* Only apply fixed sizing to non-grid layouts */
    .stack-cards:not(.binder-grid):not(.ungrouped-grid) {
        width: var(--card-min-width);
        height: var(--card-min-height);
    }

    /* Binder grid adjustments for tablets */
    .binder .stack-cards.binder-grid {
        grid-template-columns: repeat(1, 1fr);
        gap: 10px;
    }

    /* Ungrouped grid adjustments for tablets */
    .ungrouped .stack-cards.ungrouped-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 14px;
    }
}

@media (max-width: 768px) {
    .stacks-container {
        grid-template-columns: repeat(auto-fill, minmax(var(--card-min-width), 1fr));
        gap: max(10px, 2vw);
        /* Increased spacing to prevent overlap */
        padding: 18px;
    }

    .card-stack {
        min-width: var(--card-min-width);
        max-width: var(--card-min-width);
        margin-bottom: 5px;
    }

    /* Only apply fixed sizing to non-grid layouts */
    .stack-cards:not(.binder-grid):not(.ungrouped-grid) {
        width: var(--card-min-width);
        height: var(--card-min-height);
    }

    /* Binder grid adjustments for mobile */
    .binder .stack-cards.binder-grid {
        grid-template-columns: repeat(1, 1fr);
        gap: 10px;
    }

    /* Ungrouped grid adjustments for mobile */
    .ungrouped .stack-cards.ungrouped-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .stacks-container {
        grid-template-columns: repeat(auto-fill, 1fr);
        gap: max(10px, 2vw);
        /* Increased spacing to prevent overlap */
        padding: 8px;
    }

    .card-stack {
        min-width: var(--card-min-width);
        max-width: var(--card-min-width);
        margin-bottom: 5px;
    }

    /* Only apply fixed sizing to non-grid layouts */
    .stack-cards:not(.binder-grid):not(.ungrouped-grid) {
        width: var(--card-min-width);
        height: var(--card-min-height);
    }

    /* Binder grid adjustments for extra small screens */
    .binder .stack-cards.binder-grid {
        grid-template-columns: repeat(1, 1fr);
        gap: 6px;
    }

    /* Ungrouped grid adjustments for extra small screens */
    .ungrouped .stack-cards.ungrouped-grid {
        gap: 8px;
    }
}

/* Tokens Section */
.tokens-section {
    background: #e9ecef;
    border-radius: 12px;
    padding: 15px;
    margin-top: 15px;
    flex-shrink: 0;
}

.tokens-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 10px 0;
    color: #333;
}

.tokens-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--card-min-width), 1fr));
    gap: 10px;
}

.token-item {
    background: white;
    border-radius: 6px;
    padding: 8px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.token-name {
    font-size: 11px;
    font-weight: 600;
    color: #333;
}

/* Drag and Drop Zones */
.drop-zone {
    min-height: 100px;
    transition: all 0.3s ease;
}

.drop-zone.drag-over {
    border-color: #28a745;
    background: rgba(40, 167, 69, 0.05);
}

.drop-zone-text {
    color: rgba(255, 255, 255, 0.8);
    font-style: italic;
    font-size: 14px;
    text-align: center;
    grid-column: 1 / -1;
    padding: 40px 20px;
    border: 2px dashed rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    margin: 10px;
}

/* Loading placeholder */
.loading-placeholder {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.loading-placeholder i {
    font-size: 32px;
    margin-bottom: 15px;
    color: #007bff;
}

/* Context Menu (Legacy/Generic) */
.context-menu {
    position: fixed;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    padding: 5px 0;
    z-index: 10001;
    display: none;
    min-width: 150px;
}

.context-menu-item {
    width: 100%;
    padding: 8px 15px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.context-menu-item:hover {
    background: #f8f9fa;
}

.context-menu-item.positive {
    color: #28a745;
}

.context-menu-item.destructive {
    color: #dc3545;
}

.context-menu-separator {
    height: 1px;
    background: #dee2e6;
    margin: 5px 0;
}

/* Responsive Design / Layout */
@media (max-width: 1200px) {

    /* Allow page scrolling on tablet/mobile */
    body {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .deck-container {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }

    .left-column,
    .right-column {
        width: 100%;
        overflow: visible;
    }

    /* Reorder sections for responsive layout */
    .deck-container {
        display: flex;
        flex-direction: column;
    }

    .left-column {
        order: 1;
    }

    .right-column {
        order: 2;
    }

    /* In public view, ensure right column is centered on mobile */
    .deck-container[data-is-public-view="true"] {
        justify-content: center;
    }

    .deck-container[data-is-public-view="true"] .right-column {
        width: 100%;
        max-width: 1200px;
    }
}

/* Tablet landscape and portrait optimization */
@media (max-width: 1024px) and (min-width: 769px) {
    .search-cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(var(--card-min-width), 1fr));
        gap: 15px;
        padding: 10px 0;
    }

    .search-card-item {
        width: var(--card-min-width);
        height: var(--card-min-height);
    }

    .considering-grid {
        grid-template-columns: repeat(auto-fill, minmax(var(--card-min-width), 1fr));
        gap: 12px;
        padding: 15px;
        justify-content: center;
    }

    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(var(--card-min-width), 1fr));
        gap: 12px;
    }

    .tokens-grid {
        grid-template-columns: repeat(auto-fill, minmax(var(--card-min-width), 1fr));
        gap: 10px;
    }

    /* Improve touch targets on tablets */
    .search-card-item,
    .considering-card-item {
        min-height: 140px;
        touch-action: manipulation;
    }

    /* Ensure considering cards match deck card dimensions on tablets */
    .considering-card-item {
        width: var(--card-min-width);
        height: var(--card-min-height);
    }

    /* Better spacing for card containers */
    .add-cards-section,
    .considering-section,
    .deck-info-section,
    .cards-section {
        padding: 30px;
        margin-bottom: 15px;
    }
}

@media (max-width: 768px) {
    .deck-container {
        padding: 10px;
        gap: 15px;
    }

    .add-cards-section,
    .considering-section,
    .deck-info-section,
    .cards-section {
        padding: 30px;
    }

    /* In public view, ensure proper spacing on mobile */
    .deck-container[data-is-public-view="true"] {
        padding: 10px;
    }

    /* Fix user info layout on mobile - stack elements vertically */
    .deck-user-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .user-details {
        width: 100%;
    }

    .user-actions {
        align-self: flex-end;
    }

    /* Apply the same 3-row layout for mobile */
    .search-and-filters {
        display: grid;
        grid-template-columns: 1fr;
        grid-row-gap: 6px;
        align-items: center;
    }

    .search-input-container {
        grid-column: 1 / -1;
    }

    .search-input-compact {
        font-size: 13px;
        padding: 6px 10px;
        height: 32px;
    }

    .search-button-compact,
    .clear-button-compact {
        width: 32px;
        height: 32px;
    }

    .compact-filters {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        width: 100%;
    }

    .compact-filters .filter-item:nth-child(-n+3) {
        flex: 1 1 calc(33.33% - 6px);
        min-width: 120px;
    }

    .compact-filters .filter-item:nth-child(n+4) {
        flex: 1 1 calc(50% - 6px);
        min-width: 150px;
    }

    .color-circles,
    .cost-circles,
    .level-circles,
    .variation-circles {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 4px;
    }

    .color-circle {
        width: 24px;
        height: 24px;
        font-size: 7px;
    }

    /* ... Mobile Circles ... */
}

/* Hand Tester Styles */
.hand-tester-section {
    margin-top: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.hand-tester-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 15px 0;
    color: white;
}

.hand-tester-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.hand-tester-info {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}

.hand-tester-cards {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-top: 15px;
}

.hand-tester-card {
    position: relative;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: none;
    cursor: pointer;
    transition: all 0.2s ease;
    aspect-ratio: 0.691;
    /* Standard card aspect ratio */
    border: none;
}

.hand-tester-card:hover {
    transform: translateY(-5px);
    box-shadow: none;
}

.hand-tester-card img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.hand-tester-card .card-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
    color: white;
    padding: 8px 6px 4px;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
    max-height: 40%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Card Preview and Modals */
.card-preview {
    position: fixed;
    top: 0;
    left: 0;
    transform: translateY(-50%);
    width: 300px;
    height: 419px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: visible;
    z-index: 100000;
    opacity: 0;
    visibility: visible;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    border: 3px solid #007bff;
    pointer-events: none;
}

.card-preview.show {
    opacity: 1;
    visibility: visible;
}

.card-preview-image {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    font-weight: 500;
    position: relative;
}

.card-preview-quantity {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #28a745;
    color: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
    border: 3px solid white;
}

.card-detail-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    width: 100%;
    backdrop-filter: blur(5px);
}

.card-detail-modal-content {
    background-color: white;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 12px;
    width: 95%;
    max-width: 900px;
    min-height: 600px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.card-detail-modal-header {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
}

.card-detail-modal-close,
.card-detail-modal-back {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-detail-modal-body {
    display: flex;
    min-height: 520px;
    overflow: visible;
}

.card-detail-modal-image-container {
    flex: 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 400px;
}

.card-detail-modal-info {
    flex: 1;
    padding: 35px;
    overflow: visible;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
}

.card-detail-modal-title {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin: 0 0 10px 0;
    line-height: 1.2;
}

.card-detail-modal-subtitle {
    font-size: 16px;
    color: #666;
    margin-bottom: 15px;
}

.card-detail-modal-types {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.card-detail-modal-type-badge {
    background: #007bff;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.card-detail-modal-details {
    display: grid;
    gap: 15px;
}

.card-detail-modal-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid #e9ecef;
}

.card-detail-modal-detail-row:last-child {
    border-bottom: none;
}

.card-detail-modal-detail-label {
    font-weight: 600;
    color: #666;
    font-size: 14px;
}

.card-detail-modal-detail-value {
    font-weight: 500;
    color: #333;
    font-size: 14px;
    text-align: right;
}

.card-detail-modal-text {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    white-space: pre-wrap;
}

.card-detail-modal-flavor-text {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 15px;
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.6;
    color: #856404;
    font-style: italic;
    white-space: pre-wrap;
}

@media (max-width: 768px) {
    .card-detail-modal-content {
        width: 95%;
    }

    .card-detail-modal-body {
        flex-direction: column;
        overflow: visible;
    }

    .card-detail-modal-image-container {
        min-height: 300px;
        flex-shrink: 0;
    }

    .card-detail-modal-info {
        padding: 25px;
        overflow: visible;
        display: flex;
        flex-direction: column;
        min-height: 0;
        flex: 1;
    }
}

/* Mobile Filter Toggle */
.mobile-filter-toggle {
    display: none;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 10px;
}

.mobile-filter-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.mobile-filter-toggle i:first-child {
    margin-right: 8px;
    color: rgba(255, 255, 255, 0.8);
}

.mobile-filter-toggle span {
    flex: 1;
    text-align: left;
    margin-left: 8px;
}

.mobile-filter-toggle #filter-chevron {
    transition: transform 0.2s ease;
    color: rgba(255, 255, 255, 0.8);
}

.mobile-filter-toggle.expanded #filter-chevron {
    transform: rotate(180deg);
}

/* Hide filters by default on mobile */
@media (max-width: 768px) {
    .compact-filters {
        display: none;
    }

    .compact-filters.mobile-visible {
        display: flex;
    }

    .mobile-filter-toggle {
        display: flex;
    }
}

/* CRITICAL: Override any global styles that might interfere with burger menu positioning */
@media (max-width: 768px) {

    /* Force the entire cards section structure */
    .cards-section {
        position: relative !important;
    }

    /* Override any potential global button styles */
    .cards-section button.deck-burger-menu {
        position: static !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        transform: none !important;
        margin: 0 !important;
        float: none !important;
        clear: none !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* Force the button to be inline with the title */
    .cards-section .cards-header {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
        align-items: center !important;
        gap: 10px !important;
    }

    /* Ensure the title and button are on the same line */
    .cards-section .cards-title,
    .cards-section .deck-actions {
        display: inline-block !important;
        vertical-align: middle !important;
        line-height: 1.2 !important;
    }

    /* Override any potential absolute/fixed positioning */
    .cards-section .deck-actions,
    .cards-section .deck-actions *,
    .cards-section .deck-actions .deck-burger-menu {
        position: static !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        transform: none !important;
        margin: 0 !important;
        float: none !important;
        clear: none !important;
    }
}