/* Global Visibility & Grid */
.desktop-only-filters, .desktop-only-flex { display: flex !important; align-items: center; gap: 15px; }
.mobile-only-flex { display: none !important; }
.mobile-only-drawer { display: none !important; }

@media (max-width: 1000px) {
    .desktop-only-filters, .desktop-only-flex { display: none !important; }
    .mobile-only-flex { display: flex !important; }
    .mobile-only-drawer { display: flex !important; }
}

/* Stats in Drawer (CoasterDex Informations) */
.stats-badge-drawer {
    display: flex;
    flex-direction: unset;
    justify-content: center;
    gap: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    width: calc(100% - 5.5em);
    margin: 0em 1em;
}

.stats-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.stats-label { color: #888; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1px; }
.stats-value { color: var(--accent-color); font-weight: 900; font-size: 1.3rem; }

/* Global Completion Stats (Ma Collection) */
.completion-grid { 
    display: flex; 
    justify-content: center; 
    gap: 15px; 
    margin: 15px auto; 
    padding: 0 15px; 
    width: 100%;
    max-width: 1200px;
}

.comp-item { 
    background: rgba(255, 255, 255, 0.03); 
    padding: 12px 10px; 
    border-radius: 10px; 
    border: 1px solid rgba(255,255,255,0.06); 
    flex: 1; 
    text-align: center;
    min-width: 0;
}

@media (max-width: 800px) {
    .completion-grid { gap: 6px; padding: 0 8px; margin: 10px auto; }
    .comp-item { padding: 8px 4px; }
    .comp-label { font-size: 0.5rem; margin-bottom: 2px; }
    .comp-value { font-size: 0.85rem; white-space: nowrap; }
    .comp-value small { display: block; margin-left: 0; font-size: 0.6rem; line-height: 1; }
    .comp-item.highlight .comp-value { font-size: 1rem; }
}

/* Filters UI */
.collection-filters-row {
    /* padding: 5px 20px; */
    /* background: rgba(255, 255, 255, 0.03); */
    /* border-radius: 50px; */
    /* border: 1px solid rgba(255, 255, 255, 0.08); */
}

.filter-group, .view-toggle { display: flex; gap: 8px; }
.filter-divider { width: 1px; height: 24px; background: rgba(255, 255, 255, 0.1); margin: 0 5px; }

.filter-btn {
    padding: 7px 15px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 800;
    font-family: 'Orbitron', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.filter-btn:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
.filter-btn.active { background: rgba(255, 132, 0, 0.15); color: var(--accent-color); }

.btn-icon { height: 16px; width: 16px; filter: grayscale(1) brightness(1.5); transition: all 0.25s ease; flex-shrink: 0; }
.filter-btn.active .btn-icon, .filter-toggle-btn .btn-icon { filter: none; }

.series-filters-scroll { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 5px; scrollbar-width: none; }
.series-filters-scroll::-webkit-scrollbar { display: none; }

.filter-toggle-btn {
    display: flex;
    background: var(--accent-color);
    color: #000;
    border: none;
    padding: 10px 20px;
    border-radius: 50px;
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.8rem;
    cursor: pointer;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(255, 132, 0, 0.3);
    transition: all 0.3s ease;
}

/* Common Drawer System */
.collection-filters, .pull-rates-drawer {
    display: flex;
    position: fixed;
    top: -100vh;
    left: 0;
    right: 0;
    flex-direction: column;
    background: #000000d4;
    border-radius: 0 0 25px 25px;
    padding: 20px 20px 30px 20px;
    z-index: 800;
    border-bottom: 3px solid var(--accent-color);
    box-shadow: 0 15px 50px rgba(0,0,0,0.9);
    gap: 20px;
    visibility: hidden;
    height: auto;
    max-height: 85vh;
    overflow-y: auto;
    transition: top 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.4s;
}

.collection-filters.open, .pull-rates-drawer.open {
    top: 55px;
    visibility: visible;
}

.filter-backdrop {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    z-index: 750;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
}

.filter-backdrop.open { opacity: 1; visibility: visible; }

.mobile-handle {
    display: block;
    width: 40px;
    height: 5px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    margin: 10px auto 0 auto;
    order: 10;
}

.panel-header-mobile { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.panel-header-mobile h3 { margin: 0; font-size: 1.1rem; color: var(--accent-color); text-transform: uppercase; letter-spacing: 1px; }
.close-panel-btn { background: rgba(255,255,255,0.05); border: none; color: #fff; width: 32px; height: 32px; border-radius: 50%; font-size: 1.5rem; display: flex; align-items: center; justify-content: center; cursor: pointer; }

/* Series Headers */
.series-header {
    padding: 12px 20px;
    background: linear-gradient(90deg, rgba(255, 132, 0, 0.35) 0%, rgba(20, 20, 20, 0.7) 100%);
    border-left: 4px solid var(--accent-color);
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 4px 12px 12px 4px;
    cursor: pointer;
    user-select: none;
    width: 100%;
    margin: 0 0 10px 0;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.series-header .series-title b { color: var(--accent-color); font-weight: 900; text-transform: uppercase; letter-spacing: 1px; font-size: 1.2rem; }
.series-header .series-title i { color: rgba(255, 255, 255, 0.6); font-style: italic; font-weight: 300; margin-left: 10px; font-size: 0.95rem; }
.series-header .toggle-arrow { transition: transform 0.4s; background: rgba(255, 255, 255, 0.05); width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 50%; flex-shrink: 0; color: #888; }
.series-header .toggle-arrow svg { width: 16px; height: 16px; }
.series-header:hover .toggle-arrow { color: var(--accent-color); }
.series-header.collapsed .toggle-arrow { transform: rotate(-90deg); }
.series-stats { font-size: 0.85rem; color: #888; }

/* Sub Header Layout */
.sub-header {
    background: rgba(25, 25, 25, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 12px 0;
    position: sticky;
    top: 105px;
    z-index: 700;
    min-height: 55px;
    display: flex;
    align-items: center;
}

.sub-header-content {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

#collection-select {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.1) !important;
    padding: 10px 15px;
    border-radius: 50px;
    font-weight: 700;
    border: 1px solid rgba(255,255,255,0.2);
}

/* Grid & List Display */
.edition-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 210px));
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    width: 100%;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease, margin-bottom 0.5s ease;
    max-height: 5000px; /* High enough to contain large editions */
    overflow: hidden;
    opacity: 1;
    padding-top: 0.6em;
}

.edition-cards-list { 
    display: flex; 
    flex-direction: column; 
    gap: 5px; 
    margin-bottom: 30px; 
    width: 100%; 
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease, margin-bottom 0.5s ease;
    max-height: 5000px;
    overflow: hidden;
    opacity: 1;
}

.edition-cards-grid.collapsed, .edition-cards-list.collapsed { 
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
    pointer-events: none;
}

#collection-display {
    display: flex;
    flex-direction: column;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

@media (max-width: 1200px) { .edition-cards-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 190px)); justify-content: center; } }
@media (max-width:  900px) { .edition-cards-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 170px)); justify-content: center; } }
@media (max-width:  600px) { .edition-cards-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 150px)); justify-content: center; } }

.list-card-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255,255,255,0.05);
    padding: 8px 15px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    transition: background 0.2s ease, filter 0.3s ease;
}
.list-card-item.not-owned { filter: grayscale(0.8) opacity(0.2); }
.list-card-item:hover {
    background: rgba(255,255,255,0.1);
}
/* Increased visual for not-owned cards in list view */
.list-card-item.not-owned {
    filter: grayscale(0.8) opacity(0.2); /* More aggressive grayscale and lower opacity */
}
.list-card-item.not-owned:hover {
    filter: grayscale(0.6) opacity(0.4); /* Slightly less aggressive on hover */
}
span.card-id-display {
    color: var(--accent-color);
    font-size: 0.8em;
    font-style: italic;
}
.list-card-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.list-card-thumb {
    width: 30px;
    height: 42px;
    background-size: cover;
    background-position: center;
    border-radius: 3px;
    background-color: #333;
}
.list-card-details {
    display: flex;
    flex-direction: column;
}
.list-card-name {
    text-align: left;
    font-weight: bold;
    font-size: 1.1rem;
    color: #fff;
}
.list-card-meta {
    text-align: left;
    font-size: 0.8rem;
    color: #888;
}
.list-stock-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 4px 10px;
    border-radius: 25px;
    backdrop-filter: blur(8px);
}
.view-toggle .filter-btn {
    border-radius: 5px;
}
.comp-item.highlight {
    background: linear-gradient(135deg, rgba(255, 132, 0, 0.1) 0%, rgba(255, 132, 0, 0.05) 100%);
    border-color: rgba(255, 132, 0, 0.3);
}
.comp-item.highlight .comp-label { color: var(--accent-color); font-weight: 700; text-transform: uppercase; }
.comp-item.highlight .comp-value { color: #fff; font-size: 1.8rem; }

main#main-container { align-items: stretch !important; padding: 0; }

/* Floating Share Button (FAB) */
.floating-suggest-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 999;
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 50px;
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(255, 60, 0, 0.4);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform: scale(0) translateY(50px);
    opacity: 0;
}

.floating-suggest-btn.visible {
    transform: scale(1) translateY(0);
    opacity: 1;
    animation: fabPulse 2s infinite ease-in-out;
}

.floating-suggest-btn:hover {
    transform: scale(1.1) translateY(-5px) !important;
    background: #ff5500;
    box-shadow: 0 15px 40px rgba(255, 60, 0, 0.6);
}

@keyframes fabPulse {
    0%, 100% { box-shadow: 0 10px 30px rgba(255, 60, 0, 0.4); }
    50% { box-shadow: 0 10px 50px rgba(255, 60, 0, 0.8); }
}

.fab-icon { height: 22px; width: 22px; color: #fff; flex-shrink: 0; }
.fab-text { text-transform: uppercase; letter-spacing: 1px; font-size: 0.85rem; }

@media (max-width: 768px) {
    .floating-suggest-btn {
        bottom: 20px;
        right: 20px;
        padding: 12px 20px;
    }
    .fab-text { display: none; }
    .floating-suggest-btn { width: 55px; height: 55px; justify-content: center; padding: 0; }
}
