:root {
    --primary-bg: #282726;
    --accent-bg: #323230;
    --card-bg: #3e3e3c;
    --border-color: #4a4a48;
    --text-primary: #f8f8f8;
    --text-secondary: #e0e0e0;
    --text-muted: #a8a8a8;
    --accent-orange: #c96442;
    --accent-orange-hover: #d4734f;
    --accent-orange-light: rgba(201, 100, 66, 0.25);
    --success-color: #5cb85c;
    --warning-color: #f0ad4e;
    --info-color: #5b9bd5;
    --info-light: rgba(91, 155, 213, 0.2);
    --neutral-color: #888;
    --neutral-light: rgba(136, 136, 136, 0.15);
    --shadow-light: rgba(0, 0, 0, 0.2);
    --shadow-medium: rgba(0, 0, 0, 0.4);
    --shadow-heavy: rgba(0, 0, 0, 0.6);
    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 24px;
    --radius-xl: 28px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', sans-serif;
    background: var(--primary-bg);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
}

.container {
    max-width: 900px;
    width: 100%;
    min-height: calc(100vh - 40px);
}

/* ─── Header ─── */
.header {
    text-align: center;
    margin-bottom: 32px;
    padding: 24px 0;
}

.header h1 {
    color: var(--text-primary);
    font-size: clamp(1.6rem, 5vw, 2.2rem);
    margin-bottom: 12px;
    font-weight: 600;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.8s ease forwards;
}

.header p {
    color: var(--text-muted);
    font-size: clamp(0.95rem, 3vw, 1.1rem);
    font-weight: 400;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.8s ease 0.2s forwards;
}

/* ─── Controls ─── */
.controls {
    display: flex;
    flex-direction: column;
    margin-bottom: 32px;
    background: var(--accent-bg);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px var(--shadow-light);
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.8s ease 0.4s forwards;
}

.controls-tabs {
    padding: 16px 20px;
}

.controls-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0;
}

.controls-filters {
    padding: 14px 20px;
    display: flex;
    justify-content: center;
}

/* ─── Filters ─── */
.filters {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-label {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.85rem;
    white-space: nowrap;
}

/* ─── Tabs ─── */
.tabs-wrapper {
    position: relative;
    width: 100%;
}

/* fade edges to hint at scroll */
.tabs-wrapper::before,
.tabs-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 32px;
    pointer-events: none;
    z-index: 1;
}

.tabs-wrapper::before {
    left: 0;
    background: linear-gradient(to right, var(--accent-bg), transparent);
}

.tabs-wrapper::after {
    right: 0;
    background: linear-gradient(to left, var(--accent-bg), transparent);
}

.tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;       /* Firefox */
    padding: 4px 28px;           /* room for fade edges */
    flex-wrap: nowrap;
}

.tabs::-webkit-scrollbar {
    display: none;               /* Chrome/Safari */
}

.tabs.dragging {
    cursor: grabbing;
    user-select: none;
}

.tabs:not(.dragging) {
    cursor: grab;
}

.tab {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    padding: 10px 18px;
    cursor: pointer;
    border-radius: var(--radius-md);
    font-weight: 400;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.95rem;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    min-height: 44px;
    flex-shrink: 0;              /* never squish */
    white-space: nowrap;
}

.tab::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.6s ease;
}

.tab:hover::before { left: 100%; }

.tab:hover {
    background: var(--accent-orange-light);
    border-color: var(--accent-orange);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-light);
}

.tab.active {
    background: var(--accent-orange);
    color: var(--text-primary);
    border-color: var(--accent-orange);
    font-weight: 600;
    box-shadow: 0 4px 14px var(--shadow-medium);
}

/* ─── Filters ─── */
.filters {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.filter-label {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.9rem;
    white-space: nowrap;
    min-width: 80px;
}

.filter-row .filter-toggle {
    flex: 1;
}

.filter-toggle {
    display: flex;
    background: var(--card-bg);
    border-radius: 9999px;
    border: 2px solid var(--border-color);
    box-shadow: inset 0 2px 8px var(--shadow-light);
    align-items: stretch;
    gap: 4px;
    padding: 4px;
}

.filter-option {
    flex: 1;
    padding: 8px 20px;
    cursor: pointer;
    border-radius: 9999px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 400;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
    border: 1px solid transparent;
    white-space: nowrap;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filter-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.6s ease;
}

.filter-option:hover::before { left: 100%; }

.filter-option:hover {
    color: var(--text-primary);
    border-color: var(--accent-orange);
}

.filter-option.active {
    background: var(--accent-orange);
    color: var(--text-primary);
    font-weight: 600;
    box-shadow: 0 4px 12px var(--shadow-light);
    border-color: var(--accent-orange);
}

/* ─── Cards wrapper ─── */
.cards-wrapper {
    position: relative;
    min-height: 400px;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    max-width: 100%;
    align-content: start;
    min-height: 400px;
}

.cards-grid.single-card {
    grid-template-columns: minmax(280px, 400px);
    justify-content: center;
}

/* ─── Card ─── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    cursor: pointer;
    transition: all 0.4s ease;
    opacity: 0;
    transform: translateY(30px);
    animation: cardFadeIn 0.6s ease forwards;
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    transition: left 0.8s ease;
}

.card:hover::before { left: 100%; }

.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.2s; }
.card:nth-child(3) { animation-delay: 0.3s; }
.card:nth-child(4) { animation-delay: 0.4s; }
.card:nth-child(5) { animation-delay: 0.5s; }
.card:nth-child(6) { animation-delay: 0.6s; }

.card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 32px var(--shadow-medium);
    border-color: var(--accent-orange);
}

.card:active {
    transform: translateY(-4px) scale(0.98);
    transition: all 0.1s ease;
}

.card-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.card:hover .card-title {
    color: var(--accent-orange);
}

.card-section {
    display: inline-block;
    background: var(--accent-orange-light);
    color: var(--accent-orange);
    padding: 5px 14px;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    transition: all 0.3s ease;
}

.card:hover .card-section {
    background: var(--accent-orange);
    color: var(--text-primary);
    transform: scale(1.05);
}

/* ─── Card badges ─── */
.card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid transparent;
}

.badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.badge--green {
    background: rgba(92, 184, 92, 0.12);
    color: var(--success-color);
    border-color: rgba(92, 184, 92, 0.25);
}

.badge--green .badge-dot {
    background: var(--success-color);
    animation: pulse-green 2s infinite;
}

.badge--yellow {
    background: rgba(240, 173, 78, 0.12);
    color: var(--warning-color);
    border-color: rgba(240, 173, 78, 0.25);
}

.badge--yellow .badge-dot {
    background: var(--warning-color);
    animation: pulse-yellow 2s infinite;
}

.badge--blue {
    background: var(--info-light);
    color: var(--info-color);
    border-color: rgba(91, 155, 213, 0.3);
}

.badge--blue .badge-dot {
    background: var(--info-color);
    animation: pulse-blue 2s infinite;
}

.badge--gray {
    background: rgba(201, 100, 66, 0.12);
    color: var(--accent-orange);
    border-color: rgba(201, 100, 66, 0.25);
}

.badge--gray .badge-dot {
    background: var(--accent-orange);
    animation: pulse-orange 2s infinite;
}

/* ─── Modal ─── */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    backdrop-filter: blur(8px);
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
    animation: modalFadeIn 0.4s ease forwards;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    padding: 32px;
    max-width: 500px;
    width: 90%;
    border: 1px solid var(--border-color);
    position: relative;
    box-shadow: 0 20px 60px var(--shadow-heavy);
    transform: scale(0.8) translateY(50px);
    opacity: 0;
    animation: modalContentIn 0.5s ease 0.1s forwards;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--text-primary);
    background: var(--accent-bg);
    transform: rotate(90deg);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
    padding-right: 40px;
}

.modal-description {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 28px;
    font-size: 1.05rem;
    font-weight: 400;
}

.modal-button {
    background: var(--accent-orange);
    color: var(--text-primary);
    border: none;
    padding: 18px 28px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    transition: all 0.3s ease;
    width: 100%;
    position: relative;
    overflow: hidden;
    min-height: 56px;
}

.modal-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.6s ease;
}

.modal-button:hover::before {
    width: 300px;
    height: 300px;
}

.modal-button:hover {
    background: var(--accent-orange-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--shadow-medium);
}

.modal-button:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px var(--shadow-light);
}

/* ─── Empty state ─── */
.empty-state {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-muted);
    animation: fadeInUp 0.8s ease forwards;
}

.empty-state-icon {
    font-size: 3.5rem;
    margin-bottom: 20px;
    opacity: 0.5;
    animation: float 3s ease-in-out infinite;
}

.empty-state h3 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.empty-state p {
    font-size: 1rem;
    font-weight: 400;
}

/* ─── Animations ─── */
@keyframes fadeInUp {
    to { opacity: 1; transform: translateY(0); }
}

@keyframes cardFadeIn {
    to { opacity: 1; transform: translateY(0); }
}

@keyframes modalFadeIn {
    to { opacity: 1; }
}

@keyframes modalContentIn {
    to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes pulse-green {
    0% { box-shadow: 0 0 0 0 rgba(92, 184, 92, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(92, 184, 92, 0); }
    100% { box-shadow: 0 0 0 0 rgba(92, 184, 92, 0); }
}

@keyframes pulse-yellow {
    0% { box-shadow: 0 0 0 0 rgba(240, 173, 78, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(240, 173, 78, 0); }
    100% { box-shadow: 0 0 0 0 rgba(240, 173, 78, 0); }
}

@keyframes pulse-blue {
    0% { box-shadow: 0 0 0 0 rgba(91, 155, 213, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(91, 155, 213, 0); }
    100% { box-shadow: 0 0 0 0 rgba(91, 155, 213, 0); }
}

@keyframes pulse-orange {
    0% { box-shadow: 0 0 0 0 rgba(201, 100, 66, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(201, 100, 66, 0); }
    100% { box-shadow: 0 0 0 0 rgba(201, 100, 66, 0); }
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    .header {
        margin-bottom: 20px;
        padding: 16px 0;
    }

    .controls {
        margin-bottom: 20px;
    }

    .controls-tabs {
        padding: 12px 16px;
    }

    .controls-filters {
        padding: 12px 16px;
        gap: 12px;
    }

    .tabs {
        padding: 4px 20px;
        gap: 6px;
    }

    .tab {
        padding: 9px 14px;
        font-size: 0.85rem;
        min-height: 40px;
    }

    .filters {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        width: 100%;
    }

    .filter-row {
        width: 100%;
    }

    .filter-label {
        min-width: 72px;
    }

    .filter-toggle {
        flex: 1;
        border-radius: var(--radius-sm);
    }

    .filter-option {
        flex: 1;
        min-height: 40px;
        font-size: 0.8rem;
        border-radius: var(--radius-sm);
    }

    .cards-grid {
        grid-template-columns: 1fr;
        gap: 14px;
        min-height: 300px;
    }

    .cards-grid.single-card {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 18px;
        border-radius: var(--radius-lg);
    }

    .card-title {
        font-size: 1.1rem;
    }

    .modal-content {
        padding: 24px 20px;
        margin: 16px;
        border-radius: var(--radius-lg);
        width: calc(100% - 32px);
        max-width: 100%;
    }

    .modal-title {
        font-size: 1.3rem;
        padding-right: 36px;
    }

    .modal-button {
        padding: 16px 24px;
        font-size: 1rem;
        min-height: 52px;
    }

    .empty-state h3 {
        font-size: 1.2rem;
    }

    .empty-state p {
        font-size: 0.95rem;
        padding: 0 20px;
    }
}

@media (max-width: 400px) {
    .tab {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .filter-option {
        font-size: 0.75rem;
        padding: 8px 8px;
    }
}
