/* ============================================
   BADGE GRID + RESPONSIVE POLISH
   ============================================ */

/* --- Badge Grid (Profile) --- */
.badge-grid-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
}

.badge-grid-header h3 {
    margin: 0;
    font-size: var(--text-lg);
}

.badge-grid-count {
    font-size: var(--text-sm);
    color: var(--text-muted);
    padding: 2px 10px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.04);
}

.badge-category {
    margin-bottom: var(--space-4);
}

.badge-category__title {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: var(--space-2);
}

.badge-category__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: var(--space-2);
}

.badge-cell {
    padding: var(--space-3);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    text-align: center;
    transition: transform 0.15s, box-shadow 0.15s;
}

.badge-cell--unlocked {
    background: rgba(201, 168, 76, 0.06);
    border-color: rgba(201, 168, 76, 0.15);
}

.badge-cell--unlocked:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(201, 168, 76, 0.15);
}

.badge-cell--locked {
    opacity: 0.45;
}

.badge-cell__icon {
    font-size: 1.6rem;
    display: block;
    margin-bottom: var(--space-1);
}

.badge-cell__name {
    display: block;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-primary);
}

.badge-cell__desc {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
    line-height: 1.3;
}

/* --- Sidebar Search Button --- */
.sidebar__search-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    font-size: var(--text-sm);
    transition: background 0.15s, border-color 0.15s;
}

.sidebar__search-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(201, 168, 76, 0.2);
}

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

/* ============================================
   RESPONSIVE IMPROVEMENTS
   ============================================ */

/* Mobile-first: ensure touch targets ≥ 44px */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .btn,
    .cins-block,
    .ear-option,
    .goal-option {
        min-height: 44px;
        min-width: 44px;
    }

    /* Stack profile stats */
    .profile-stats {
        grid-template-columns: 1fr 1fr !important;
    }

    /* Badge grid: 2 cols on mobile */
    .badge-category__grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Cesni builder: stack layout */
    .cesni-layout {
        flex-direction: column !important;
    }

    .cesni-palette {
        max-height: 200px;
        overflow-y: auto;
    }

    /* Gecki graph: reduce node size */
    .gecki-graph canvas {
        max-height: 50vh;
    }

    /* Stats dashboard: stack cards */
    .stats-summary {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Vocal trainer gauge */
    .vocal-gauge-container {
        max-width: 260px;
        margin: 0 auto;
    }

    /* Makam compare: stack selectors */
    .compare-selectors {
        flex-direction: column !important;
    }

    /* Theory sections */
    .theory-section {
        padding: var(--space-3) !important;
    }

    /* Search overlay full-width on mobile */
    .search-dialog {
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 0;
        margin-top: 0;
    }

    .search-overlay {
        padding-top: 0 !important;
    }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    .badge-category__grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .stats-summary {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* Desktop large */
@media (min-width: 1200px) {
    .badge-category__grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}