/* Keepsakes Grid Layout */
.keepsake-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); /* Slightly smaller min size */
    gap: 20px;
    margin-top: 20px;
}

/* Keepsake Card Base Styling */
.keepsake-card {
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transform-origin: center top;
    transition: all 0.3s ease;
}

.keepsake-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
}

.keepsake-card[data-expanded="true"] {
    grid-column: 1 / -1;
    max-width: 100%;
    transition: all 0.3s ease, max-width 0.3s ease, grid-column-start 0s 0.1s, grid-column-end 0s 0.1s;
}

/* Add expand icon */
.keepsake-expand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    color: white;
    width: 24px;
    height: 24px;
    transition: transform 0.3s ease;
}

.keepsake-card[data-expanded="true"] .keepsake-expand-icon i {
    transform: rotate(180deg);
}

/* Type-specific backgrounds */
.keepsake-type-default {
    background: linear-gradient(135deg, #B088F0 0%, #7038F8 50%, #4924A1 100%);
}
.keepsake-type-normal {
    background: linear-gradient(135deg, #A8A878 0%, #A8A878 50%, #6D6D4E 100%);
}
.keepsake-type-fire {
    background: linear-gradient(135deg, #F5AC78 0%, #F08030 50%, #9C531F 100%);
}
.keepsake-type-water {
    background: linear-gradient(135deg, #9DB7F5 0%, #6890F0 50%, #445E9C 100%);
}
.keepsake-type-grass {
    background: linear-gradient(135deg, #A7DB8D 0%, #78C850 50%, #4E8234 100%);
}
.keepsake-type-electric {
    background: linear-gradient(135deg, #FAE078 0%, #F8D030 50%, #A1871F 100%);
}
.keepsake-type-ice {
    background: linear-gradient(135deg, #BCE6E6 0%, #98D8D8 50%, #638D8D 100%);
}
.keepsake-type-fighting {
    background: linear-gradient(135deg, #D67873 0%, #C03028 50%, #7D1F1A 100%);
}
.keepsake-type-poison {
    background: linear-gradient(135deg, #C183C1 0%, #A040A0 50%, #682A68 100%);
}
.keepsake-type-ground {
    background: linear-gradient(135deg, #EBD69D 0%, #E0C068 50%, #927D44 100%);
}
.keepsake-type-flying {
    background: linear-gradient(135deg, #C6B7F5 0%, #A890F0 50%, #6D5E9C 100%);
}
.keepsake-type-psychic {
    background: linear-gradient(135deg, #FA92B2 0%, #F85888 50%, #A13959 100%);
}
.keepsake-type-bug {
    background: linear-gradient(135deg, #C6D16E 0%, #A8B820 50%, #6D7815 100%);
}
.keepsake-type-rock {
    background: linear-gradient(135deg, #D1C17D 0%, #B8A038 50%, #786824 100%);
}
.keepsake-type-ghost {
    background: linear-gradient(135deg, #A292BC 0%, #705898 50%, #493963 100%);
}
.keepsake-type-dragon {
    background: linear-gradient(135deg, #A27DFA 0%, #7038F8 50%, #4924A1 100%);
}
.keepsake-type-dark {
    background: linear-gradient(135deg, #A29288 0%, #705848 50%, #49392F 100%);
}
.keepsake-type-steel {
    background: linear-gradient(135deg, #D1D1E0 0%, #B8B8D0 50%, #787887 100%);
}
.keepsake-type-fairy {
    background: linear-gradient(135deg, #F4BDC9 0%, #EE99AC 50%, #9B6470 100%);
}

/* Hide class for filtering */
.keepsake-card.hide {
    display: none;
}

/* Results count styling */
.experimental-note {
    font-style: italic;
    opacity: 0.8;
    font-size: 0.9em;
    color: #6a1b9a;
    margin-left: 6px;
}

/* Keepsake Card Header */
.keepsake-card-header {
    display: flex;
    justify-content: space-between; /* Keep space-between */
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative; /* Needed for pseudo-element */
    overflow: hidden;   /* Needed for pseudo-element */
}

/* Add pseudo-element for gradient background */
.keepsake-card-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, rgba(0,0,0,0.3) 100%);
    z-index: 1;
}

/* Ensure content is above the gradient */
.keepsake-card-header > * {
    position: relative;
    z-index: 2;
}

.keepsake-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.keepsake-icon-container {
    width: 32px;
    height: 32px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 4px;
    flex-shrink: 0;
}

.keepsake-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.keepsake-title-container {
    display: flex;
    flex-direction: column;
    gap: 0px;
}

.keepsake-name {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.keepsake-type {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    font-style: italic;
    line-height: 1;
}

/* Removed .keepsake-header-right and rarity/origin styles */

/* Intro Text */
.keepsake-intro {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    background-color: rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Add specific background for typeless keepsakes */
.keepsake-type-typeless .keepsake-intro,
.keepsake-type-default .keepsake-intro {
    background-color: rgba(104, 160, 144, 0.2);
}

.keepsake-intro-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 500;
    font-style: italic;
    line-height: 1.4;
    color: #444;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    max-width: 90%;
}

/* Remove unused intro styles */
.keepsake-intro p {
    margin: 0;
}

.keepsake-intro::before {
    display: none;
}

/* Remove type-specific intro backgrounds */
.keepsake-intro.type-normal,
.keepsake-intro.type-fire,
.keepsake-intro.type-water,
.keepsake-intro.type-grass,
.keepsake-intro.type-electric,
.keepsake-intro.type-ice,
.keepsake-intro.type-fighting,
.keepsake-intro.type-poison,
.keepsake-intro.type-ground,
.keepsake-intro.type-flying,
.keepsake-intro.type-psychic,
.keepsake-intro.type-bug,
.keepsake-intro.type-rock,
.keepsake-intro.type-ghost,
.keepsake-intro.type-dragon,
.keepsake-intro.type-dark,
.keepsake-intro.type-steel,
.keepsake-intro.type-fairy,
.keepsake-intro.type-typeless,
.keepsake-intro.type-default {
    background-color: transparent;
}

/* Keepsake Card Body */
.keepsake-card-body {
    background-color: #ffffff;
    padding: 12px;
    flex-grow: 1;
}

.keepsake-card-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.keepsake-basic-info {
    display: block;
    text-align: center;
}

.keepsake-teaser {
    font-size: 0.85rem;
    color: #777;
    font-style: italic;
    margin: 0;
}

.keepsake-summary {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.4;
    margin: 0;
}

/* Expanded content (hidden by default) */
.keepsake-expanded-content {
    display: none;
    flex-direction: column;
    gap: 24px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.keepsake-card[data-expanded="true"] .keepsake-expanded-content {
    display: flex;
}

/* Abilities Section */
.keepsake-abilities {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

@media (min-width: 768px) {
    .keepsake-abilities {
        grid-template-columns: 1fr 1fr;
    }
}

.keepsake-ability {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ability-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #4a4a4a;
    padding-bottom: 6px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
    margin: 0 0 8px 0;
}

.ability-description {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-left: 10px;
    border-left: 3px solid rgba(0, 0, 0, 0.1);
}

.ability-tag {
    display: block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    width: 100%;
    text-align: center;
}

.ability-tag.stable {
    background-color: rgba(40, 167, 69, 0.15);
    color: #28a745;
}

.ability-tag.blessed {
    background-color: rgba(0, 123, 255, 0.15);
    color: #007bff;
}

.ability-tag.unstable {
    background-color: rgba(220, 53, 69, 0.15);
    color: #dc3545;
}

.ability-tag.distorted {
    background-color: rgba(111, 66, 193, 0.15);
    color: #6f42c1;
}

.ability-advanced {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed rgba(0, 0, 0, 0.1);
}

/* Charged Effect */
.keepsake-charged,
.keepsake-item-effect,
.keepsake-bonus-notes {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.keepsake-charged h4,
.keepsake-item-effect h4,
.keepsake-bonus-notes h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #4a4a4a;
    padding-bottom: 6px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
    margin: 0 0 8px 0;
}

.charged-description,
.item-description {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-left: 10px;
    border-left: 3px solid rgba(0, 0, 0, 0.1);
}

.charged-description p {
    margin: 0;
    display: flow-root; /* Ensures proper wrapping around the floated element */
}

.charge-turns {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    background-color: rgba(111, 66, 193, 0.15);
    color: #6f42c1;
    margin-right: 8px;
    margin-bottom: 2px; /* Add a small bottom margin for spacing */
    width: auto;  /* Auto width for inline display */
    min-width: unset;  /* Remove min-width */
    text-align: center;
    float: left;  /* Float left to appear inline with text */
}

/* Bonus Notes */
.keepsake-bonus-notes p {
    padding-left: 10px;
    border-left: 3px solid rgba(0, 0, 0, 0.1);
    margin: 0;
}

/* Credits */
.keepsake-credits {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    text-align: right;
}

.keepsake-credits p {
    font-size: 0.8rem;
    font-style: italic;
    color: #6c757d;
}

/* Type Colors for card headers */
.type-normal { background-color: #A8A878; }
.type-fire { background-color: #F08030; }
.type-water { background-color: #6890F0; }
.type-grass { background-color: #78C850; }
.type-electric { background-color: #F8D030; }
.type-ice { background-color: #98D8D8; }
.type-fighting { background-color: #C03028; }
.type-poison { background-color: #A040A0; }
.type-ground { background-color: #E0C068; }
.type-flying { background-color: #A890F0; }
.type-psychic { background-color: #F85888; }
.type-bug { background-color: #A8B820; }
.type-rock { background-color: #B8A038; }
.type-ghost { background-color: #705898; }
.type-dragon { background-color: #7038F8; }
.type-dark { background-color: #705848; }
.type-steel { background-color: #B8B8D0; }
.type-fairy { background-color: #EE99AC; }
.type-typeless { background-color: #68A090; }
.type-default { background-color: #68A090; } /* Same as typeless */ 