/**
 * GroupFilter - Shared styles for character group filter component
 * 
 * Displays groups as inline checkboxes (always visible, no dropdown).
 * Used by Memory, Gems, Whack, and Memory Care games.
 * Import this CSS in game HTML files that use GroupFilter.
 */

/* Container - vertical list of checkboxes */
.group-filter {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Individual filter item (checkbox row) */
.gf-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.gf-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Checked state - highlight the row */
.gf-item:has(input:checked) {
    background: rgba(83, 82, 237, 0.15);
    border-color: rgba(83, 82, 237, 0.4);
}

.gf-item input[type="checkbox"] {
    display: none;
}

/* Checkbox visual */
.gf-check {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: transparent;
    transition: all 0.15s;
    flex-shrink: 0;
}

.gf-item input:checked + .gf-check {
    background: #5352ed;
    border-color: #5352ed;
    color: white;
}

/* Group color dot */
.gf-color {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Group name */
.gf-name {
    flex: 1;
    color: #fff;
    font-weight: 500;
    font-size: 1rem;
}

/* Member count */
.gf-count {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
}

/* All Characters item - slightly different styling */
.gf-all-chars {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.gf-all-chars .gf-name {
    font-weight: 600;
}

/* ============================================
   MEMORY CARE THEME (Light Mode)
   For games using dementia-safe design
   ============================================ */

.memory-care-theme .gf-item,
.recognize-game .gf-item,
.relationships-game .gf-item,
.same-different-game .gf-item {
    background: #fafbfc;
    border-color: #e0e0e0;
    color: #1a1a1a;
}

.memory-care-theme .gf-item:hover,
.recognize-game .gf-item:hover,
.relationships-game .gf-item:hover,
.same-different-game .gf-item:hover {
    background: #f0f1f2;
    border-color: #c0c0c0;
}

.memory-care-theme .gf-item:has(input:checked),
.recognize-game .gf-item:has(input:checked),
.relationships-game .gf-item:has(input:checked),
.same-different-game .gf-item:has(input:checked) {
    background: #e8f0fa;
    border-color: #4a77b3;
}

.memory-care-theme .gf-check,
.recognize-game .gf-check,
.relationships-game .gf-check,
.same-different-game .gf-check {
    border-color: #c0c0c0;
}

.memory-care-theme .gf-item input:checked + .gf-check,
.recognize-game .gf-item input:checked + .gf-check,
.relationships-game .gf-item input:checked + .gf-check,
.same-different-game .gf-item input:checked + .gf-check {
    background: #4a77b3;
    border-color: #4a77b3;
}

.memory-care-theme .gf-name,
.recognize-game .gf-name,
.relationships-game .gf-name,
.same-different-game .gf-name {
    color: #1a1a1a;
}

.memory-care-theme .gf-count,
.recognize-game .gf-count,
.relationships-game .gf-count,
.same-different-game .gf-count {
    color: #6a6a6a;
}

.memory-care-theme .gf-all-chars,
.recognize-game .gf-all-chars,
.relationships-game .gf-all-chars,
.same-different-game .gf-all-chars {
    background: #fafbfc;
}

/* ============================================
   GAME-SPECIFIC THEME OVERRIDES
   Each game can override accent colors
   ============================================ */

/* Memory Game (pink accent) */
.memory-game .gf-item:has(input:checked) {
    background: rgba(255, 107, 157, 0.15);
    border-color: rgba(255, 107, 157, 0.4);
}

.memory-game .gf-item input:checked + .gf-check {
    background: #ff6b9d;
    border-color: #ff6b9d;
}

/* Whack Game (orange accent) */
.whack-game .gf-item:has(input:checked) {
    background: rgba(255, 127, 80, 0.15);
    border-color: rgba(255, 127, 80, 0.4);
}

.whack-game .gf-item input:checked + .gf-check {
    background: #ff7f50;
    border-color: #ff7f50;
}

/* Gems Game (cyan accent) */
.gems-game .gf-item:has(input:checked) {
    background: rgba(0, 212, 255, 0.15);
    border-color: rgba(0, 212, 255, 0.4);
}

.gems-game .gf-item input:checked + .gf-check {
    background: #00d4ff;
    border-color: #00d4ff;
    color: #000;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 480px) {
    .gf-item {
        padding: 0.65rem 0.9rem;
        gap: 0.5rem;
    }
    
    .gf-check {
        width: 22px;
        height: 22px;
    }
    
    .gf-name {
        font-size: 0.95rem;
    }
    
    .gf-count {
        font-size: 0.85rem;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    .gf-item {
        padding: 0.5rem 0.8rem;
    }
    
    .gf-check {
        width: 20px;
        height: 20px;
    }
}

/* ============================================
   FALLBACK FOR OLDER BROWSERS
   :has() not supported in Firefox < 121
   ============================================ */

@supports not selector(:has(*)) {
    .gf-item.selected {
        background: rgba(83, 82, 237, 0.15);
        border-color: rgba(83, 82, 237, 0.4);
    }
}
