:root {
    --bg-base: #fff0f3;
    --bg-surface: rgba(255, 255, 255, 0.75);
    --bg-surface-hover: rgba(255, 255, 255, 0.9);
    
    --color-primary: #ff758f; /* Sakura/Bubblegum Pink */
    --color-primary-hover: #ff4d6d;
    --color-primary-light: rgba(255, 117, 143, 0.12);
    
    --color-success: #c1f2e1; /* Mint Pastel */
    --color-danger: #ffccd5; /* Soft Red/Pink */
    --color-danger-hover: #ffb3c1;
    
    --color-text-main: #593d4f; /* Berry Brown */
    --color-text-muted: #a37a94; /* Pastel Lilac */
    --color-border: rgba(255, 117, 143, 0.2);
    
    --radius-sm: 14px;
    --radius-md: 24px;
    --radius-lg: 32px;
    
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-base);
    color: var(--color-text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6, .logo-title, .overview-title, .progress-percentage, .count-num {
    font-family: 'Fredoka', sans-serif;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header */
.app-header {
    background: rgba(255, 240, 243, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1rem 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    font-size: 1.75rem;
}

.logo-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    background: linear-gradient(135deg, #ff9eb5 0%, #ff79c6 50%, #bd93f9 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stats-badge {
    background: var(--color-primary-light);
    border: 1px solid rgba(255, 121, 198, 0.3);
    padding: 0.4rem 1rem;
    border-radius: var(--radius-lg);
    display: flex;
    gap: 0.4rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.stats-label {
    color: var(--color-text-muted);
}

.stats-value {
    color: #ff92d0;
}

/* Main Layout */
.main-content {
    padding-top: 2rem;
    padding-bottom: 5rem;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

/* Glass Panel Utility */
.glass-panel {
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px -10px rgba(255, 117, 143, 0.15);
    transition: var(--transition-normal);
}

/* Upload Section */
.upload-section {
    padding: 2.5rem;
    text-align: center;
}

.upload-wrapper {
    max-width: 450px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.upload-icon {
    font-size: 3rem;
    background: linear-gradient(135deg, rgba(255, 121, 198, 0.2) 0%, rgba(255, 121, 198, 0.05) 100%);
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid rgba(255, 121, 198, 0.3);
    margin-bottom: 0.5rem;
    box-shadow: 0 0 20px rgba(255, 121, 198, 0.15);
}

.upload-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.upload-hint {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.upload-form {
    width: 100%;
    margin-top: 0.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition-fast);
    text-decoration: none;
}

.btn-primary {
    background-color: var(--color-primary);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(255, 121, 198, 0.4);
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--color-text-main);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.btn-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background-color: var(--color-danger);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

.btn-icon {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

.btn-icon .icon {
    width: 16px;
    height: 16px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 240, 243, 0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--color-border);
    padding: 2.5rem;
    border-radius: var(--radius-md);
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 121, 198, 0.1);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* HTMX transition indicators */
.htmx-indicator {
    display: none;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    display: flex;
}

/* Collection Grid */
.section-header {
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text-main);
    letter-spacing: -0.01em;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.card-item {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.card-item:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 117, 143, 0.4);
    box-shadow: 0 15px 35px -10px rgba(255, 117, 143, 0.25);
}

.card-artwork-wrapper {
    position: relative;
    width: 100%;
    padding-top: 130%; /* Aspect ratio typical for cards */
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-bottom: 1px solid var(--color-border);
}

.card-artwork-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    z-index: 1;
    opacity: 0;
    animation: cardImageFadeIn 0.3s ease-in-out forwards;
}

@keyframes cardImageFadeIn {
    to {
        opacity: 1;
    }
}

.card-artwork-inner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    text-align: center;
    gap: 0.75rem;
    z-index: 1;
}

.artwork-icon {
    font-size: 3rem;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
    transition: var(--transition-normal);
}

.card-item:hover .artwork-icon {
    transform: scale(1.1) rotate(5deg);
}

.artwork-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.01em;
    max-width: 90%;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

/* Specific gradients depending on printing finish */
.artwork-foil {
    background: linear-gradient(135deg, #e8cbf5 0%, #c4b5fd 100%); /* Cute lilac-purple holo */
}

.artwork-holo {
    background: linear-gradient(135deg, #bbf7d0 0%, #99f6e4 100%); /* Cute mint-teal holo */
}

.artwork-reverse-holo {
    background: linear-gradient(135deg, #fecdd3 0%, #fda4af 100%); /* Cute pink holo */
}

.artwork-non-foil {
    background: linear-gradient(135deg, #f5f3ff 0%, #ddd6fe 100%); /* Soft light lavender/gray */
}

/* Shimmer overlay animation for premium look */
.shimmer-effect {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        105deg,
        rgba(255, 255, 255, 0) 20%,
        rgba(255, 255, 255, 0.08) 40%,
        rgba(255, 255, 255, 0.18) 50%,
        rgba(255, 255, 255, 0.08) 60%,
        rgba(255, 255, 255, 0) 80%
    );
    background-size: 200% 100%;
    animation: shimmer 4s infinite linear;
    z-index: 2;
    pointer-events: none;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-lg);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    backdrop-filter: blur(8px);
    color: #ffffff;
}

.badge-rarity {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.badge-rare {
    background: rgba(255, 121, 198, 0.85);
    border: 1px solid rgba(255, 146, 208, 0.4);
    box-shadow: 0 0 10px rgba(255, 121, 198, 0.4);
}

.card-details {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    gap: 1rem;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--color-text-main);
    line-height: 1.2;
}

.card-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem 0.5rem;
    font-size: 0.8rem;
    border-top: 1px solid var(--color-border);
    padding-top: 0.75rem;
}

.meta-item {
    display: flex;
    flex-direction: column;
}

.meta-label {
    color: var(--color-text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.1rem;
}

.meta-value {
    color: var(--color-text-main);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
    border-top: 1px solid var(--color-border);
    padding-top: 1rem;
}

.card-actions .btn {
    flex: 1;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 5rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.empty-icon {
    font-size: 4rem;
    opacity: 0.35;
}

.empty-state h3 {
    font-weight: 600;
}

.empty-state p {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    max-width: 300px;
}

/* Error Banner */
.error-banner {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #fecaca;
}

/* Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(89, 61, 79, 0.35);
    backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modal-content {
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius-md);
    overflow: hidden;
    animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

body.modal-open {
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.btn-close:hover {
    color: var(--color-text-main);
}

/* Forms */
.edit-card-form {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-group.col {
    flex: 1;
}

label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
}

input[type="text"], select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--color-text-main);
    transition: var(--transition-fast);
    width: 100%;
}

input[type="text"]:focus, select:focus {
    outline: none;
    border-color: var(--color-primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(255, 121, 198, 0.2);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

/* ===== Drop Zone ===== */
.drop-zone {
    position: relative;
    width: 100%;
    border: 2px dashed rgba(255, 121, 198, 0.4);
    border-radius: var(--radius-md);
    padding: 0.5rem;
    transition: var(--transition-fast);
    background: rgba(255, 121, 198, 0.04);
}

.drop-zone.drag-over {
    border-color: var(--color-primary);
    background: rgba(255, 121, 198, 0.15);
    box-shadow: 0 0 0 4px rgba(255, 121, 198, 0.15);
}

.file-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.drop-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem 1rem;
    cursor: pointer;
    pointer-events: none;
}

.drop-icon { font-size: 2.5rem; }

.drop-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text-main);
}

.drop-hint {
    font-size: 0.78rem;
    color: var(--color-text-muted);
}

.preview-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
}

.preview-img {
    max-height: 220px;
    border-radius: var(--radius-sm);
    object-fit: contain;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

/* ===== Upload Button ===== */
.btn-upload {
    width: 100%;
    margin-top: 1rem;
    padding: 0.9rem 1.5rem;
    font-size: 1rem;
}

.btn-upload:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none;
}

/* ===== Small Button ===== */
.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.82rem;
}

/* ===== 1st Edition Badge ===== */
.badge-first-edition {
    position: absolute;
    top: 12px;
    left: 12px;
    background: linear-gradient(135deg, #d97706, #92400e);
    color: #fef3c7;
    border: 1px solid rgba(251, 191, 36, 0.4);
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-lg);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    backdrop-filter: blur(8px);
    box-shadow: 0 0 10px rgba(217, 119, 6, 0.4);
    z-index: 3;
}

/* ===== Collection section ===== */
.collection-section { }

/* Mobile responsive optimization */
@media (max-width: 640px) {
    .container {
        padding: 0 1rem;
    }
    
    .main-content {
        padding-top: 1rem;
        gap: 1.5rem;
    }
    
    .upload-section {
        padding: 1.5rem 1rem;
    }
    
    .card-grid {
        grid-template-columns: 1fr; /* Stack card images on mobile */
    }
    
    .modal-overlay {
        padding: 1rem;
    }
    
    /* Make the camera upload button feel like a float-action button on small screens */
    .btn-upload {
        width: 100%;
        padding: 1rem 1.5rem;
        font-size: 1.05rem;
        border-radius: var(--radius-md);
    }
}

/* ==========================================================
   OVERVIEW PAGE – NEUE STILE
   ========================================================== */

.overview-page body {
    background: var(--bg-base);
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Back-Link */
.back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    transition: var(--transition-fast);
    text-decoration: none;
    flex-shrink: 0;
}

.back-link:hover {
    background: rgba(255,255,255,0.12);
    color: var(--color-text-main);
}

.back-icon {
    width: 18px;
    height: 18px;
}

/* Scan-Kontext Badge im Header */
.scan-context-badge {
    display: block;
    font-size: 0.72rem;
    color: var(--color-text-muted);
    margin-top: 2px;
    letter-spacing: 0.03em;
}

/* Hero */
.overview-hero {
    padding: 2rem 0 0.5rem;
}

.overview-title {
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

.gradient-text {
    background: linear-gradient(135deg, #ff9eb5 0%, #ff79c6 50%, #d6a4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.overview-subtitle {
    font-size: 1rem;
    color: var(--color-text-muted);
    max-width: 480px;
}

/* Game Filter Pills */
.game-filter-section {
    margin-top: 0.5rem;
}

.game-filter {
    display: inline-flex;
    gap: 0.35rem;
    padding: 0.35rem;
    border-radius: var(--radius-lg);
    flex-wrap: wrap;
}

.game-filter-btn {
    padding: 0.5rem 1.1rem;
    border-radius: calc(var(--radius-lg) - 4px);
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.game-filter-btn:hover {
    background: rgba(255,255,255,0.08);
    color: var(--color-text-main);
}

.game-filter-btn.active {
    background: var(--color-primary);
    color: #fff;
    box-shadow: 0 2px 10px rgba(255, 121, 198, 0.4);
}

.game-btn-pokemon.active  { background: linear-gradient(135deg, #ff7597, #ff477e); box-shadow: 0 2px 10px rgba(255, 71, 126, 0.4); }
.game-btn-yugioh.active   { background: linear-gradient(135deg, #bd93f9, #9b66f7); box-shadow: 0 2px 10px rgba(189, 147, 249, 0.4); }
.game-btn-magic.active    { background: linear-gradient(135deg, #8ae9c4, #5be0aa); box-shadow: 0 2px 10px rgba(138, 233, 196, 0.4); }

/* Collections Section */
.collections-section {
    padding-bottom: 4rem;
}

/* Collection Grid */
.collection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

/* Collection Tile */
.collection-tile {
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    text-decoration: none;
    color: var(--color-text-main);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-fast);
    position: relative;
}

.collection-tile:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px -12px rgba(255, 117, 143, 0.25);
}

/* Tile Header */
.tile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--color-border);
}

/* Game Badge */
.game-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-lg);
    letter-spacing: 0.03em;
}

.badge-pokemon  { background: rgba(255, 121, 198, 0.2); color: #ff9eb5; border: 1px solid rgba(255, 121, 198, 0.35); }
.badge-yu_gi_oh { background: rgba(189, 147, 249, 0.2); color: #d6a4fc; border: 1px solid rgba(189, 147, 249, 0.35); }
.badge-magic    { background: rgba(138, 233, 196, 0.2); color: #a8ebd0; border: 1px solid rgba(138, 233, 196, 0.35); }

/* Tile Delete Button */
.tile-delete-btn {
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    flex-shrink: 0;
    line-height: 1;
}

.tile-delete-btn:hover {
    background: rgba(239,68,68,0.15);
    color: #fca5a5;
}

/* Tile Artwork */
.tile-artwork {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 110px;
    font-size: 3.5rem;
    position: relative;
    overflow: hidden;
}

/* Game-specific artwork backgrounds */
.game-pokemon  .tile-artwork { background: linear-gradient(135deg, #ffb3c1 0%, #ff85a1 100%); }
.game-yu_gi_oh .tile-artwork { background: linear-gradient(135deg, #e1b3ff 0%, #c185ff 100%); }
.game-magic    .tile-artwork { background: linear-gradient(135deg, #b3ffd6 0%, #85ffc1 100%); }
.game-pokemon  { border-color: rgba(255, 117, 143, 0.25); }
.game-yu_gi_oh { border-color: rgba(189, 147, 249, 0.25); }
.game-magic    { border-color: rgba(138, 233, 196, 0.25); }
.game-pokemon:hover  { border-color: rgba(255, 117, 143, 0.5); }
.game-yu_gi_oh:hover { border-color: rgba(189, 147, 249, 0.5); }
.game-magic:hover    { border-color: rgba(138, 233, 196, 0.5); }

/* Tile Details */
.tile-details {
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex-grow: 1;
}

.tile-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-text-main);
    line-height: 1.25;
}

.tile-desc {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tile-stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 0.6rem;
    border-top: 1px solid var(--color-border);
}

.tile-card-count {
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
}

.count-num {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--color-primary);
    line-height: 1;
}

.tile-arrow {
    font-size: 1.2rem;
    color: var(--color-text-muted);
    transition: transform var(--transition-fast), color var(--transition-fast);
}

.collection-tile:hover .tile-arrow {
    transform: translateX(4px);
    color: var(--color-text-main);
}

.count-label {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Empty Collections State */
.empty-collections {
    grid-column: 1 / -1;
    text-align: center;
    padding: 5rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

/* Load Sentinel (invisible trigger for infinite scroll) */
.load-sentinel {
    height: 40px;
    grid-column: 1 / -1;
    visibility: hidden;
}

/* Init Loading */
.init-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 4rem 2rem;
    color: var(--color-text-muted);
}

/* Game Radio Group in Modal */
.game-radio-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.game-radio-option {
    flex: 1;
    min-width: 100px;
}

.game-radio-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.game-radio-label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    background: rgba(255,255,255,0.04);
    gap: 0.4rem;
    user-select: none;
    text-align: center;
}

.game-radio-option input[type="radio"]:checked + .game-radio-label.pokemon {
    background: rgba(255, 121, 198, 0.2);
    border-color: rgba(255, 121, 198, 0.5);
    color: #ff9eb5;
}

.game-radio-option input[type="radio"]:checked + .game-radio-label.yugioh {
    background: rgba(189, 147, 249, 0.2);
    border-color: rgba(189, 147, 249, 0.5);
    color: #d6a4fc;
}

.game-radio-option input[type="radio"]:checked + .game-radio-label.magic {
    background: rgba(138, 233, 196, 0.2);
    border-color: rgba(138, 233, 196, 0.5);
    color: #a8ebd0;
}

.game-radio-label:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.15);
}

/* Overview responsive */
@media (max-width: 640px) {
    .overview-title {
        font-size: 1.75rem;
    }

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

    .game-filter {
        width: 100%;
    }

    .game-filter-btn {
        flex: 1;
        text-align: center;
        font-size: 0.82rem;
        padding: 0.45rem 0.5rem;
    }

    .header-actions .btn-secondary {
        display: none;
    }
}

/* ==========================================================
   PROGRESS BAR & PURCHASE PRICE STYLING
   ========================================================== */

.purchase-progress-section {
    padding: 1.5rem;
    margin-bottom: 0.5rem;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.progress-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text-main);
}

.progress-percentage {
    font-size: 1.15rem;
    font-weight: 800;
    color: #ff92d0;
    background: var(--color-primary-light);
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 121, 198, 0.3);
}

.progress-bar-container {
    height: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, #ff79c6 0%, #ff92d0 100%);
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 8px rgba(255, 121, 198, 0.4);
}

.progress-bar-fill.progress-exceeded {
    background: linear-gradient(90deg, #8ae9c4 0%, #a8ebd0 100%);
    box-shadow: 0 0 12px rgba(138, 233, 196, 0.6);
    animation: progress-pulse 2s infinite alternate;
}

.progress-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    margin-top: 0.75rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

.progress-current {
    color: #ff92d0;
    font-weight: 600;
    font-size: 0.85rem;
}

@keyframes progress-pulse {
    0% {
        opacity: 0.9;
        box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
    }
    100% {
        opacity: 1;
        box-shadow: 0 0 16px rgba(16, 185, 129, 0.8);
    }
}

/* Numeric inputs global style override matching text inputs */
input[type="number"] {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--color-text-main);
    transition: var(--transition-fast);
    width: 100%;
}

input[type="number"]:focus {
    outline: none;
    border-color: var(--color-primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(255, 121, 198, 0.2);
}

/* ==========================================================
   SALES SUMMARY STYLING (FOR NO PURCHASE PRICE)
   ========================================================== */

.progress-percentage.sales-badge {
    color: #8ae9c4;
    background: rgba(138, 233, 196, 0.15);
    border-color: rgba(138, 233, 196, 0.3);
}

/* ==========================================================
   ASYNC IMAGE ANALYSIS & STATE STYLING
   ========================================================== */

/* State-Specific Card borders/shadows */
.card-item.status-processing {
    border: 1px dashed rgba(255, 121, 198, 0.4);
    pointer-events: none; /* Disable all clicks/interactions while scanning */
}

.card-item.status-processing .card-actions {
    pointer-events: auto; /* Allow deleting processing/scanning cards */
}

.card-item.status-to-review {
    border: 1px dashed rgba(245, 158, 11, 0.6);
    box-shadow: 0 10px 30px -10px rgba(245, 158, 11, 0.15);
}

.card-item.status-to-review:hover {
    border-color: rgba(245, 158, 11, 1);
    box-shadow: 0 15px 35px -10px rgba(245, 158, 11, 0.3);
}

/* Grayscale/blur effect for the artwork during processing */
.card-item.status-processing .card-artwork-image {
    filter: grayscale(80%) blur(2px);
    opacity: 0.5;
}

/* Status Badges */
.badge-status {
    z-index: 3;
}

.badge-processing {
    background: rgba(245, 158, 11, 0.85); /* Warm amber/yellow */
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #ffffff;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
    animation: badge-pulse 2s infinite ease-in-out;
}

.badge-to-review {
    background: rgba(239, 68, 68, 0.85); /* Bright warning red/dark pink */
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #ffffff;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

@keyframes badge-pulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* Loader in details panel for processing cards */
.processing-details-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem 0;
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

.processing-spinner-small {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255, 121, 198, 0.1);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Success Button Style for confirmation */
.btn-success {
    background-color: #10b981;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.btn-success:hover {
    background-color: #059669;
    transform: translateY(-1px);
}

/* FAILED State card & badge styles */
.card-item.status-failed {
    border: 1px dashed rgba(239, 68, 68, 0.45);
    box-shadow: 0 10px 30px -10px rgba(239, 68, 68, 0.1);
}

.card-item.status-failed:hover {
    border-color: rgba(239, 68, 68, 0.85);
    box-shadow: 0 15px 35px -10px rgba(239, 68, 68, 0.2);
}

.badge-failed {
    background: rgba(220, 38, 38, 0.9); /* Solid warning red */
    border: 1px solid rgba(220, 38, 38, 0.5);
    color: #ffffff;
    box-shadow: 0 0 10px rgba(220, 38, 38, 0.35);
}

/* Collapsible error details for failed analysis */
.failed-status-container {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 1.25rem 0.5rem;
    align-items: center;
    text-align: center;
    border-top: 1px solid var(--color-border);
    margin-top: 0.5rem;
}

.failed-summary-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: #fca5a5;
    font-weight: 700;
    font-size: 0.85rem;
}

.btn-info-toggle {
    background: rgba(255, 117, 143, 0.1);
    border: 1px solid rgba(255, 117, 143, 0.3);
    color: var(--color-text-main);
    border-radius: var(--radius-sm);
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: var(--transition-fast);
}

.btn-info-toggle:hover {
    background: rgba(255, 117, 143, 0.25);
    border-color: var(--color-primary);
    transform: translateY(-0.5px);
}

.failed-error-details {
    display: none;
    background: rgba(239, 68, 68, 0.07);
    border: 1px solid rgba(239, 68, 68, 0.18);
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 0.78rem;
    color: #991b1b; /* Dark red for excellent contrast and readability */
    text-align: left;
    word-break: break-word;
    max-height: 120px;
    overflow-y: auto;
    width: 100%;
    animation: errorDetailsFadeIn 0.2s ease-in-out forwards;
}

.failed-error-details.show {
    display: block;
}

.failed-hint {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    opacity: 0.85;
}

@keyframes errorDetailsFadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Filter & Search Form Styling
   ========================================================================== */

.filter-form-wrapper {
    margin-bottom: 2rem;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: var(--transition-normal);
}

.filter-main-row {
    display: flex;
    gap: 1rem;
    align-items: center;
    width: 100%;
}

.search-input-wrapper {
    position: relative;
    flex-grow: 1;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0 1.25rem;
    transition: var(--transition-fast);
}

.search-input-wrapper:focus-within {
    border-color: var(--color-primary);
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 0 0 4px rgba(255, 117, 143, 0.15);
}

.search-icon {
    font-size: 1.1rem;
    opacity: 0.6;
    pointer-events: none;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.search-input-field {
    background: transparent !important;
    border: none !important;
    padding: 0.85rem 0 !important;
    font-family: inherit;
    font-size: 1rem;
    color: var(--color-text-main);
    width: 100%;
    outline: none !important;
    box-shadow: none !important;
}

.search-input-field:focus {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}

.btn-filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1.5rem;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid var(--color-border);
    color: var(--color-text-main);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    white-space: nowrap;
}

.btn-filter-toggle:hover {
    background: rgba(255, 255, 255, 0.8);
    border-color: var(--color-primary);
}

.filter-toggle-arrow {
    display: inline-block;
    font-size: 0.75rem;
    transition: transform var(--transition-fast);
}

/* Collapsible panel with modern CSS Grid Transition */
.filter-collapse {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows var(--transition-normal), opacity var(--transition-normal);
    opacity: 0;
}

.filter-collapse.show {
    grid-template-rows: 1fr;
    opacity: 1;
}

.filter-collapse-content {
    overflow: hidden;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--color-border);
}

.filter-grid .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.filter-grid label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
}

.filter-grid select {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--color-text-main);
    cursor: pointer;
    transition: var(--transition-fast);
    width: 100%;
}

.filter-grid select:focus {
    outline: none;
    border-color: var(--color-primary);
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 0 0 3px rgba(255, 117, 143, 0.15);
}

/* Responsive adjustment */
@media (max-width: 640px) {
    .filter-main-row {
        flex-direction: column;
        gap: 0.75rem;
    }
    .search-input-wrapper {
        width: 100%;
    }
    .btn-filter-toggle {
        width: 100%;
        justify-content: center;
    }
    .filter-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Bulk Selection Feature ===== */

.card-select-checkbox {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid var(--color-primary);
    background: rgba(255, 240, 243, 0.85);
    cursor: pointer;
    transition: var(--transition-fast);
    display: grid;
    place-content: center;
    appearance: none;
    -webkit-appearance: none;
    box-shadow: 0 2px 8px rgba(255, 117, 143, 0.25);
}

.card-select-checkbox:hover {
    transform: scale(1.1);
    background: #ffffff;
}

.card-select-checkbox:checked {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.card-select-checkbox:checked::before {
    content: "✓";
    color: white;
    font-size: 14px;
    font-weight: 900;
}

/* Shift 1st Edition badge to the right to make room for checkbox */
.badge-first-edition {
    left: 42px !important;
}

/* Highlight card item when checkbox is checked using modern CSS :has() */
.card-item:has(.card-select-checkbox:checked) {
    border-color: var(--color-primary);
    background: rgba(255, 240, 243, 0.45);
    box-shadow: 0 15px 30px -10px rgba(255, 117, 143, 0.3);
}

/* Floating Bulk Action Bar */
.bulk-action-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(120px);
    width: calc(100% - 32px);
    max-width: 600px;
    padding: 1rem 1.5rem;
    background: rgba(255, 240, 243, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-md);
    box-shadow: 0 20px 45px -10px rgba(89, 61, 79, 0.35);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
    opacity: 0;
}

.bulk-action-bar.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.bulk-action-bar .selected-count {
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--color-text-main);
    white-space: nowrap;
}

.bulk-form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-grow: 1;
}

.bulk-form input[type="text"] {
    flex-grow: 1;
    padding: 0.65rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.bulk-form .btn {
    padding: 0.65rem 1.25rem;
    font-size: 0.9rem;
}

/* Bulk actions select all checkbox header panel styling */
.bulk-select-header-panel {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.bulk-select-header-checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
    cursor: pointer;
}

@media (max-width: 640px) {
    .bulk-action-bar {
        flex-direction: column;
        gap: 1rem;
        bottom: 16px;
        padding: 1.25rem 1rem;
    }
    .bulk-form {
        width: 100%;
        flex-direction: column;
        gap: 0.5rem;
    }
    .bulk-form input[type="text"],
    .bulk-form .btn {
        width: 100%;
    }
}

/* Sharing toggle button style */
.tile-share-btn.shared-active {
    background: rgba(193, 242, 225, 0.25);
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.4) !important;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}

.tile-share-btn.shared-active:hover {
    background: rgba(193, 242, 225, 0.4);
    color: #059669;
    border-color: rgba(16, 185, 129, 0.6) !important;
}

.tile-share-btn.shared-inactive {
    background: rgba(255, 255, 255, 0.06);
    color: var(--color-text-muted);
    border-color: var(--color-border) !important;
}

.tile-share-btn.shared-inactive:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--color-text-main);
    border-color: rgba(255, 117, 143, 0.4) !important;
}

/* Quantity Control Styling */
.quantity-inline-control {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.15rem;
    gap: 0.35rem;
    width: fit-content;
}

.quantity-inline-control button {
    background: transparent;
    border: none;
    color: var(--color-text-main);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.quantity-inline-control button:hover:not(:disabled) {
    background: var(--color-primary);
    color: #ffffff;
    box-shadow: 0 0 10px rgba(255, 121, 198, 0.4);
}

.quantity-inline-control button:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

.quantity-display-val {
    font-weight: 700;
    font-size: 0.9rem;
    min-width: 20px;
    text-align: center;
    color: var(--color-text-main);
}

.quantity-meta-item {
    grid-column: span 2;
    display: flex;
    flex-direction: row !important;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.75rem;
    margin-top: 0.25rem;
}

.quantity-meta-item .meta-label {
    margin-bottom: 0;
}


