/* Viewer-specific styles */

/* Layout variants for boxes container */
.boxes-container.layout-2 {
    grid-template-columns: repeat(auto-fill, minmax(600px, 1fr));
}

.boxes-container.layout-3 {
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
}

/* Sprite sizes for different layouts */
.boxes-container.layout-2 .pokemon-sprite {
    width: 56px;
    height: 56px;
}

.boxes-container.layout-3 .pokemon-sprite {
    width: 36px;
    height: 36px;
}

/* Compact layout adjustments */
.boxes-container.layout-3 .pokemon-name {
    font-size: 0.45rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.boxes-container.layout-3 .box {
    padding: 8px;
}

.boxes-container.layout-3 .box-title {
    font-size: 0.85rem;
}

.boxes-container.layout-3 .pokemon-slot {
    overflow: hidden;
}

/* Loading spinner for sprites */
.pokemon-sprite {
    background: linear-gradient(
        90deg,
        transparent 25%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 75%
    );
    background-size: 200% 100%;
    animation: sprite-loading 1.5s infinite;
}

.pokemon-sprite[data-loaded="true"] {
    background: none;
    animation: none;
}

@keyframes sprite-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Shiny sprite glow effect */
.pokemon-sprite.shiny {
    filter: drop-shadow(0 0 4px var(--text-gold));
}

/* Pokemon slot tooltip */
.pokemon-slot {
    position: relative;
}

.pokemon-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: var(--dark-fg-0);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.pokemon-slot:hover .pokemon-tooltip {
    opacity: 1;
}

.pokemon-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
}

/* Keyboard Navigation focus */
.pokemon-slot.focused {
    outline: 3px solid var(--text-gold);
    outline-offset: 2px;
}

/* Mark Mode Indicator */
.mark-mode-active {
    background: rgba(152, 151, 26, 0.2);
    border: 2px solid var(--accent-green);
}

/* Search Highlight */
.pokemon-slot.search-match {
    box-shadow: 0 0 0 3px var(--text-gold);
}

.pokemon-slot.search-hidden {
    opacity: 0.2;
}

/* Filter Hidden - Keep slot space but hide contents */
.pokemon-slot.viewer-filter-hidden {
    visibility: hidden;
    pointer-events: none;
}

/* Help button (fixed position) */
/* Skeuomorphic Floating Buttons */
/* Also used for changelog button on dashboard */
.help-btn,
.scroll-top-btn {
    position: fixed;
    bottom: 2rem;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.4);
    background: linear-gradient(
        180deg,
        var(--floating-bg-start) 0%,
        var(--floating-bg-end) 100%
    );
    color: var(--floating-text);
    font-size: 1.6rem;
    font-family: "Silkscreen";
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;

    /* Gem/Glass Shadow */
    box-shadow:
        0 10px 20px var(--floating-shadow-glow),
        inset 0 2px 0 rgba(255, 255, 255, 0.1),
        inset 0 -4px 8px rgba(0, 0, 0, 0.4);
}

.help-btn {
    right: 2rem;
}

.scroll-top-btn {
    left: 2rem;
    opacity: 0;
    pointer-events: none;
    transform: translateY(30px) scale(0.8);
}

.scroll-top-btn.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

/* Glass Shine */
.help-btn::after,
.scroll-top-btn::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.15),
        transparent
    );
    border-radius: 50% 50% 0 0;
    pointer-events: none;
}

.help-btn:hover,
.scroll-top-btn:hover {
    transform: translateY(-5px) scale(1.1);
    filter: brightness(1.2);
    border-color: var(--text-gold);
}

.scroll-top-btn.visible:hover {
    transform: translateY(-5px) scale(1.1);
}

.help-btn:active,
.scroll-top-btn:active {
    transform: translateY(2px) scale(0.95);
    box-shadow:
        0 4px 8px rgba(0, 0, 0, 0.5),
        inset 0 4px 10px rgba(0, 0, 0, 0.6);
}

/* Mobile specific overrides */
@media (max-width: 900px) {
    .help-btn {
        display: none !important;
    }

    /* Show changelog button on mobile */
    #changelog-btn {
        display: flex !important;
    }
}

/* Shared Tooltip (Fixed position) */
.shared-tooltip {
    position: fixed !important;
    bottom: auto !important;
    transform: translate(-50%, -110%) !important;
    z-index: 10000 !important;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease-out;
}

.shared-tooltip.active {
    opacity: 1;
}

/* Tooltip arrow for shared tooltip */
.shared-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
}

/* Performance Optimizations for Large Lists */
.list-view-container {
    content-visibility: auto;
    contain-intrinsic-size: 1000px; /* Placeholder height */
}

.pokemon-slot {
    contain: layout style;
}

/* Enhanced Tooltip Styles */
.pokemon-tooltip.enhanced {
    min-width: 150px;
    padding: 10px;
    background: rgba(15, 15, 15, 0.95);
    border: 1px solid var(--border-card);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    line-height: 1.2;
}

.tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 4px;
}

.tooltip-header strong {
    color: var(--text-gold);
    font-size: 0.9rem;
}

.tooltip-id {
    font-size: 0.7rem;
    opacity: 0.6;
}

.tooltip-types {
    display: flex;
    gap: 4px;
}

.type-badge {
    font-size: 0.65rem;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 3px;
    color: white;
    font-weight: bold;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.3);
}

.tooltip-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    font-size: 0.65rem;
}

.tooltip-stats .stat {
    display: flex;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 5px;
    border-radius: 3px;
}

.tooltip-stats .stat span {
    opacity: 0.7;
}

.tooltip-footer {
    font-size: 0.6rem;
    opacity: 0.5;
    text-align: center;
    margin-top: 4px;
}

/* Type Colors are now dynamically injected via JS based on data/types.json */

/* Continuous list view should always use layout-2 size (56px sprites) */
.list-view-container .pokemon-sprite {
    width: 56px !important;
    height: 56px !important;
}

.list-view-container .pokemon-name {
    font-size: 0.65rem !important;
    max-width: none !important;
    white-space: normal !important;
    overflow: visible !important;
}

.list-view-container .pokemon-slot {
    padding: 4px !important;
    aspect-ratio: 1 !important;
}

/* Restore hidden names on mobile for list view if that's desired,
   but usually we want to keep mobile rules.
   The !important above might override mobile display: none if not careful. */
@media (max-width: 600px) {
    .list-view-container .pokemon-name {
        display: none !important;
    }
}

/* ============================================
   Save Info Bar (Viewer)
   Moved from cards.css for better organization
   ============================================ */
.save-info {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 12px;
    padding: 10px 18px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    /* Physical Panel Base */
    box-shadow:
        var(--shadow-raised),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -2px 4px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.save-info::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 30%;
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.03),
        transparent
    );
    pointer-events: none;
}

.save-info-identity {
    display: flex;
    align-items: center;
    gap: 20px;
}

.save-info-text {
    display: flex;
    flex-direction: column;
}

.save-info-title {
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: "Silkscreen";
    text-transform: uppercase;
    text-shadow: 1px 1px 0 var(--text-secondary);
}

.save-info-trainer {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-family: "DotGothic16";
}

.save-info-status-actions {
    display: flex;
    align-items: center;
    gap: 24px;
    flex: 1;
    justify-content: flex-end;
}

.save-info-lcds {
    display: flex;
    align-items: center;
    gap: 14px;
}

.save-info-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stats {
    background: var(--dark-fg-5);
    color: var(--dark-bg-2);
    font-family: "Silkscreen";
    font-size: 0.85rem;
    padding: 5px 15px;
    line-height: 1.5;
    border-radius: 6px;
    border: 1px solid var(--dark-bg-5);
    box-shadow:
        inset 0 2px 5px rgba(0, 0, 0, 0.4),
        0 1px 0 rgba(255, 255, 255, 0.2);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
    letter-spacing: 1px;
}

/* Light Mode Override: Dark Glowing LCD */
html.light-theme .stats {
    background: var(--dark-bg-0);
    color: var(--dark-fg-2);
    border-color: var(--dark-bg-2);
    box-shadow:
        inset 0 2px 5px rgba(0, 0, 0, 0.8),
        0 1px 0 rgba(255, 255, 255, 0.05);
    text-shadow: 0 0 5px rgba(235, 219, 178, 0.3);
}

/* Gameboy Dot-Matrix Grid Overlay */
.stats::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(rgba(0, 0, 0, 0.3) 1px, transparent 0);
    background-size: 3px 3px;
    pointer-events: none;
    z-index: 2;
    opacity: 0.4;
}

/* LCD Glass Reflection */
.stats::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.05) 0%,
        transparent 50%
    );
    pointer-events: none;
    z-index: 3;
}

/* Completed Save Styling for Viewer Header */
.save-info.completed {
    border-color: #ffd700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3), inset 0 0 10px rgba(255, 215, 0, 0.1);
}
html.light-theme .save-info.completed {
    border-color: #d4af37;
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.4), inset 0 0 8px rgba(212, 175, 55, 0.15);
}
