/* Copyright (c) 2024-2026. Jericho Crosby (Chalwk) */

:root {
    --card-bg: #fefefe;
    --type-psychic: #792f8c;
    --type-darkness: #5a5465;
    --type-electric: #f7d02c;
    --type-dragon: #6f35fc;
    --type-rock: #b6a136;
    --type-colorless: #707067;
    --type-fire: #ff0000;
    --type-metal: #b7b7ce;
    --type-grass: #7ac74c;
    --type-water: #6390f0;
    --type-fighting: #c22e28;
}

.page-title {
    font-size: 2.5rem;
    margin: 2rem 0 1rem;
    color: var(--darker);
    border-left: 6px solid var(--primary);
    padding-left: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-title i {
    color: var(--primary);
    font-size: 2rem;
}

.search-wrapper {
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    background: white;
    border-radius: 60px;
    padding: 0.3rem 0.3rem 0.3rem 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-light);
    max-width: 500px;
}

.search-wrapper i {
    color: var(--gray);
    font-size: 1.2rem;
}

#searchInput {
    flex: 1;
    border: none;
    padding: 0.8rem 0.5rem;
    font-size: 1rem;
    background: transparent;
    outline: none;
}

#clearSearch {
    background: var(--gray-light);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--dark);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    margin-right: 0.3rem;
}

#clearSearch:hover {
    background: var(--gray);
    color: white;
}

.section-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.8rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-light);
    transition: var(--transition);
}

.section-card:hover {
    box-shadow: var(--shadow-lg);
}

.section-heading {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    border-bottom: 2px solid var(--gray-light);
    padding-bottom: 0.6rem;
}

.section-heading i {
    color: var(--primary);
    font-size: 1.6rem;
}

.subsection-title {
    font-size: 1.4rem;
    font-weight: 500;
    margin: 1.8rem 0 1rem;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.subsection-title i {
    color: var(--secondary);
}

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

.item-card,
.pokemon-card {
    position: relative;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 0.8rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--gray-light);
}

.item-card:hover,
.pokemon-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.pokemon-card {
    border-left: 5px solid transparent;
}

.card-thumb {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: contain;
    background: #f5f5f5;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    border: 1px solid #eee;
    transition: opacity 0.1s;
}

.card-thumb:hover {
    opacity: 0.9;
}

.pokemon-name {
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0.2rem 0;
}

.pokemon-name span {
    background: var(--primary);
    color: white;
    border-radius: 30px;
    padding: 0.2rem 0.6rem;
    font-size: 0.65rem;
    font-weight: 500;
}

.pokemon-details {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin: 0.2rem 0;
    color: var(--gray);
    font-size: 0.8rem;
}

.pokemon-details i {
    width: 1rem;
    color: var(--primary);
}

.pokemon-stage {
    background: var(--light);
    padding: 0.2rem 0.6rem;
    border-radius: 30px;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--dark);
    display: inline-block;
    margin-right: 0.5rem;
}

.hp-value {
    font-weight: 600;
    color: var(--accent);
}

.holo-indicator {
    font-weight: 600;
    color: #d4af37;
    text-shadow: 0 0 4px #fbbf24, 0 0 2px #f59e0b;
    margin-left: 4px;
    font-size: 0.9em;
    display: inline-block;
    letter-spacing: 0.5px;
}

.pokemon-name .holo-indicator {
    background: none;
    color: #d4af37;
    border-radius: 0;
    padding: 0;
    font-size: 0.9em;
    font-weight: 600;
    text-shadow: 0 0 4px #fbbf24, 0 0 2px #f59e0b;
    display: inline-block;
    letter-spacing: 0.5px;
    margin-left: 4px;
}

.item-name {
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0.2rem 0;
}

.rarity-badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    font-size: 0.65rem;
    font-weight: 500;
    line-height: 1.3;
    background-color: rgba(0, 0, 0, 0.08);
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    white-space: nowrap;
    border-radius: 3px;
}

.item-rarity {
    margin-top: 0.2rem;
    display: flex;
    justify-content: flex-start;
}

.rarity-common {
    background-color: #6c757d;
}

.rarity-uncommon {
    background-color: #28a745;
}

.rarity-rare {
    background-color: #007bff;
}

.rarity-double-rare {
    background-color: #17a2b8;
}

.rarity-ultra-rare {
    background-color: #6f42c1;
}

.rarity-illustration-rare {
    background-color: #e83e8c;
}

.rarity-special-illustration-rare {
    background-color: #ffc107;
    color: #212529;
}

.rarity-hyper-rare {
    background-color: #fd7e14;
}

.rarity-shiny-rare {
    background-color: #20c997;
}

.rarity-shiny-ultra-rare {
    background-color: #1e7e6c;
}

.rarity-ace-spec-rare {
    background-color: #dc3545;
}

.rarity-promo {
    background-color: #000;
    color: #ffd700;
    font-weight: bold;
    position: relative;
    padding-left: 1.2rem;
}

.rarity-promo::before {
    content: "★";
    position: absolute;
    left: 0.3rem;
    top: 0.15rem;
    font-size: 0.7rem;
    color: #ffd700;
}

.rarity-unknown {
    background-color: #adb5bd;
}

.qty-badge {
    background: var(--primary-dark);
    color: white;
    border-radius: 30px;
    padding: 0.1rem 0.5rem;
    font-size: 0.7rem;
    margin-left: 0.3rem;
    align-self: flex-end;
}

.item-card > .qty-badge,
.pokemon-card > .qty-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    pointer-events: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    margin: 0;
}

.card-link-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 3;
    background: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    text-decoration: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    transition: 0.2s;
    font-size: 14px;
}

.card-link-icon:hover {
    background: var(--primary);
    color: white;
}

.type-psychic {
    border-left-color: var(--type-psychic);
}

.type-darkness {
    border-left-color: var(--type-darkness);
}

.type-electric {
    border-left-color: var(--type-electric);
}

.type-dragon {
    border-left-color: var(--type-dragon);
}

.type-rock {
    border-left-color: var(--type-rock);
}

.type-colorless {
    border-left-color: var(--type-colorless);
}

.type-fire {
    border-left-color: var(--type-fire);
}

.type-metal {
    border-left-color: var(--type-metal);
}

.type-grass {
    border-left-color: var(--type-grass);
}

.type-water {
    border-left-color: var(--type-water);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    align-items: center;
    justify-content: center;
}

.modal-content {
    max-width: 90%;
    max-height: 90%;
    background: white;
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.modal-content img {
    width: auto;
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    display: block;
    border-radius: 8px;
}

.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    z-index: 10;
    user-select: none;
}

.modal-nav:hover {
    background: rgba(0, 0, 0, 0.85);
    transform: translateY(-50%) scale(1.05);
}

.modal-nav.left {
    left: -60px;
}

.modal-nav.right {
    right: -60px;
}

@media (max-width: 768px) {
    .modal-nav.left {
        left: -20px;
        width: 36px;
        height: 36px;
        font-size: 24px;
    }

    .modal-nav.right {
        right: -20px;
        width: 36px;
        height: 36px;
        font-size: 24px;
    }
}

.modal-caption {
    margin-top: 12px;
    font-size: 1rem;
    font-weight: 500;
    color: #333;
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
    padding: 6px 14px;
    border-radius: 40px;
    max-width: 90%;
}

.close-modal {
    position: absolute;
    top: -12px;
    right: -12px;
    background: white;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    cursor: pointer;
    border: 1px solid #ccc;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    font-weight: bold;
    z-index: 20;
}

.close-modal:hover {
    background: #f0f0f0;
}

.no-results-message {
    text-align: center;
    padding: 3rem;
    color: var(--gray);
    font-size: 1.2rem;
    display: none;
}

.no-results-message i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--gray-light);
}

.pokemon-extra {
    margin-top: 0.5rem;
    border-top: 1px solid var(--gray-light);
    padding-top: 0.5rem;
    font-size: 0.7rem;
}

.attacks-list {
    margin-bottom: 0.5rem;
}

.attack {
    margin-bottom: 0.5rem;
    border-bottom: 1px dotted #eee;
    padding-bottom: 0.3rem;
}

.attack:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.attack-header {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.attack-name {
    font-size: 0.75rem;
}

.attack-damage {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.7rem;
    background: #f0f0f0;
    padding: 0 0.2rem;
    border-radius: 3px;
}

.attack-cost {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
    margin: 0.2rem 0;
}

.attack-cost .stat-label {
    font-weight: 600;
    color: var(--dark);
    margin-right: 0.2rem;
}

.attack-cost-icon {
    font-size: 0.65rem;
    color: var(--gray);
    padding: 0 0.2rem;
}

.attack-effect {
    font-size: 0.65rem;
    font-style: italic;
    color: #555;
    margin-top: 0.2rem;
}

.pokemon-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.3rem;
    font-size: 0.65rem;
}

.weakness, .resistance, .retreat {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}

.stat-label {
    font-weight: 600;
    color: var(--dark);
}

.type-badge {
    background: #e9ecef;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.6rem;
    text-transform: capitalize;
}

.retreat i {
    margin-right: 0.1rem;
    font-size: 0.7rem;
    color: var(--gray);
}

@media (max-width: 640px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem;
    }

    .item-card, .pokemon-card {
        padding: 0.5rem;
    }

    .card-thumb {
        aspect-ratio: 4 / 5;
    }

    .rarity-badge {
        padding: 0.1rem 0.35rem;
        font-size: 0.6rem;
        white-space: normal;
        word-break: keep-all;
    }

    .rarity-promo {
        padding-left: 1rem;
    }

    .rarity-promo::before {
        left: 0.2rem;
        top: 0.1rem;
        font-size: 0.65rem;
    }

    .pokemon-extra {
        font-size: 0.65rem;
    }

    .attack-name {
        font-size: 0.7rem;
    }

    .attack-damage {
        font-size: 0.65rem;
    }

    .attack-effect {
        font-size: 0.6rem;
    }

    .pokemon-stats {
        font-size: 0.6rem;
    }
}

@media (max-width: 400px) {
    .pokemon-name, .item-name {
        font-size: 0.85rem;
        flex-wrap: wrap;
        gap: 0.3rem;
    }

    .pokemon-details {
        font-size: 0.7rem;
    }

    .rarity-badge {
        font-size: 0.55rem;
        padding: 0.05rem 0.3rem;
    }
}

@media (min-width: 1024px) {
    .card-grid {
        grid-template-columns: repeat(5, minmax(160px, 1fr));
    }

    .card-thumb {
        aspect-ratio: 4 / 5;
    }
}