/* ===== CARDS VIEW ===== */
.view-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    justify-content: flex-end;
}

.view-toggle button {
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.view-toggle button.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.view-toggle button:hover:not(.active) {
    background: var(--bg-hover);
}

.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

.shortcut-card {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.shortcut-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--success));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.shortcut-card:hover::before {
    opacity: 1;
}

.shortcut-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: var(--accent);
}

.shortcut-card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.25rem;
    padding-right: 40px;
    /* Prevent overlap with favorite button */
    position: relative;
    z-index: 2;
}

.shortcut-card__meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.shortcut-card__favorite {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    background: var(--bg-hover);
    border: none;
    cursor: pointer;
    font-size: 1.35rem;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shortcut-card__favorite.active {
    color: var(--warning);
    background: rgba(255, 193, 7, 0.1);
}

.shortcut-card__favorite:hover {
    transform: scale(1.15);
    background: var(--accent);
    color: white;
}

.shortcut-card__shortcut {
    margin: 1.25rem 0;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(99, 102, 241, 0.04) 100%);
    border-radius: 8px;
    border: 1px solid rgba(99, 102, 241, 0.1);
}

.shortcut-card__action {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Media Container */
.shortcut-media-container {
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 1rem;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
}

.shortcut-media-container svg {
    max-height: 100%;
    max-width: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* ===== RESPONSIVE: TABLET (768px - 1024px) ===== */
@media (max-width: 1024px) {
    .container {
        padding: 1rem;
    }

    .app-header {
        padding: 1.25rem 1rem;
    }

    .filter-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .cards-container {
        grid-template-columns: repeat(2, 1fr);
    }

    table {
        font-size: 0.9rem;
    }

    th,
    td {
        padding: 0.75rem 0.5rem;
    }
}

/* ===== RESPONSIVE: MOBILE (< 768px) ===== */
@media (max-width: 768px) {

    /* Header */
    .app-header {
        padding: 1rem;
    }

    .header-content {
        flex-direction: column;
        gap: 0.75rem;
    }

    .app-header h1 {
        font-size: 1.5rem;
    }

    .app-header p {
        font-size: 0.9rem;
    }

    .theme-toggle {
        position: absolute;
        top: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
        padding: 0.5rem;
    }

    /* Container */
    .container {
        padding: 0.75rem;
    }

    /* Filters */
    .search-box {
        margin-bottom: 0.75rem;
    }

    .search-box input {
        font-size: 0.95rem;
        padding: 0.75rem 2.5rem;
    }

    .filter-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .filter-row select,
    .filter-row .favorites-toggle,
    .filter-row .btn-reset {
        width: 100%;
        min-height: 44px;
        /* Touch-friendly */
    }

    .btn-reset {
        margin-top: 0.5rem;
    }

    /* Cards view is default on mobile */
    .cards-container {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .shortcut-card {
        padding: 1rem;
    }

    /* Table: horizontal scroll */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 0.85rem;
        min-width: 600px;
        /* Force horizontal scroll */
    }

    th,
    td {
        padding: 0.5rem 0.4rem;
        white-space: nowrap;
    }

    /* Larger touch targets */
    .star-btn {
        min-width: 44px;
        min-height: 44px;
        padding: 0.75rem;
    }

    /* Result count */
    #resultCount {
        font-size: 0.85rem;
    }

    /* Footer */
    footer {
        padding: 1rem;
        font-size: 0.85rem;
    }

    /* View toggle */
    .view-toggle {
        justify-content: center;
        margin-bottom: 0.75rem;
    }

    .view-toggle button {
        flex: 1;
        max-width: 150px;
        min-height: 44px;
    }

    /* Kbd smaller on mobile */
    kbd.key {
        font-size: 0.75rem;
        padding: 0.15rem 0.4rem;
    }
}

/* ===== RESPONSIVE: SMALL MOBILE (< 480px) ===== */
@media (max-width: 480px) {
    .app-header h1 {
        font-size: 1.25rem;
    }

    .app-header p {
        font-size: 0.85rem;
    }

    .shortcut-card__action {
        font-size: 1rem;
    }

    .shortcut-card__notes {
        font-size: 0.85rem;
    }

    /* Tags in card view */
    .shortcut-card .tags-container {
        margin-top: 1rem;
        padding-top: 0.5rem;
        border-top: 1px solid var(--border-color);
    }

    .category-badge,
    .difficulty-badge {
        font-size: 0.7rem;
        padding: 0.15rem 0.4rem;
    }

    kbd.key {
        font-size: 0.7rem;
        padding: 0.1rem 0.3rem;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    body {
        background: white;
        color: black;
    }

    .app-header,
    .filters,
    .view-toggle,
    .star-btn,
    .theme-toggle {
        display: none;
    }

    table {
        border: 1px solid #000;
    }

    th,
    td {
        border: 1px solid #333;
    }
}