/* ==========================================================================
   CSS Stylesheet - CS Visualizers Dashboard (Light Theme)
   ========================================================================== */

:root {
    /* Color Palette */
    --bg-page: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-hover: #ffffff;
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    
    --text-heading: #0f172a;
    --text-body: #334155;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    --primary: #2563eb;
    --primary-light: #eff6ff;
    --primary-hover: #1d4ed8;
    
    /* Category Colors */
    --cat-automata-bg: #eef2ff;
    --cat-automata-text: #4338ca;
    --cat-automata-border: #c7d2fe;
    
    --cat-search-bg: #ecfdf5;
    --cat-search-text: #047857;
    --cat-search-border: #a7f3d0;
    
    --cat-puzzles-bg: #fffbeb;
    --cat-puzzles-text: #b45309;
    --cat-puzzles-border: #fde68a;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 12px 24px -4px rgba(15, 23, 42, 0.08), 0 4px 8px -2px rgba(15, 23, 42, 0.04);
    
    /* Radii */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    /* Transitions */
    --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-body);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Container */
.container {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ==========================================================================
   Header & Hero Section
   ========================================================================== */
.site-header {
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    color: white;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.brand-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-heading);
    letter-spacing: -0.02em;
}

/* Hero */
.hero-section {
    padding: 36px 0 28px 0;
    text-align: center;
}

.hero-title {
    font-size: 2.15rem;
    font-weight: 800;
    color: var(--text-heading);
    letter-spacing: -0.03em;
    margin-bottom: 0;
}

.hero-title span {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ==========================================================================
   Controls Bar (Search & Category Filter)
   ========================================================================== */
.controls-wrapper {
    margin-bottom: 36px;
}

.search-box-container {
    max-width: 600px;
    margin: 0 auto 20px auto;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    pointer-events: none;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    height: 48px;
    padding: 0 46px 0 46px;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text-heading);
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    outline: none;
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15), var(--shadow-sm);
}

.search-input::placeholder {
    color: var(--text-light);
}

.search-shortcut {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-page);
    border: 1px solid var(--border-color);
    padding: 2px 7px;
    border-radius: var(--radius-sm);
    pointer-events: none;
    font-weight: 500;
}

.clear-search-btn {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
}

.clear-search-btn:hover {
    color: var(--text-heading);
    background-color: var(--bg-page);
}

/* Category Filter Pills */
.filter-pills {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.pill-btn {
    appearance: none;
    border: 1px solid var(--border-color);
    background-color: var(--bg-surface);
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-sm);
}

.pill-btn:hover {
    color: var(--text-heading);
    border-color: var(--border-hover);
    background-color: #f1f5f9;
}

.pill-btn.active {
    background-color: var(--text-heading);
    color: #ffffff;
    border-color: var(--text-heading);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2);
}

/* ==========================================================================
   Section & Card Grid
   ========================================================================== */
.section-block {
    margin-bottom: 48px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.section-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-heading);
    letter-spacing: -0.02em;
}

.section-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: var(--radius-full);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

/* Card */
.app-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 22px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.app-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-lg);
}

.card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.card-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.card-external-link {
    color: var(--text-light);
    transition: var(--transition);
    padding: 4px;
    border-radius: var(--radius-sm);
}

.app-card:hover .card-external-link {
    color: var(--primary);
    transform: translate(2px, -2px);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-heading);
    letter-spacing: -0.01em;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title a {
    color: inherit;
}

.card-title a::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
}

.card-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.55;
    margin-bottom: 18px;
    flex-grow: 1;
}

.card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 14px;
    border-top: 1px solid #f1f5f9;
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    font-size: 0.725rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    background-color: #f1f5f9;
    color: var(--text-muted);
}

.card-action-text {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    opacity: 0.85;
    transition: var(--transition);
}

.app-card:hover .card-action-text {
    opacity: 1;
    transform: translateX(3px);
}

/* Category styling accents */
.cat-automata .card-icon-wrap {
    background-color: var(--cat-automata-bg);
    color: var(--cat-automata-text);
}
.cat-automata .section-icon {
    background-color: var(--cat-automata-bg);
    color: var(--cat-automata-text);
}
.cat-automata .section-badge {
    background-color: var(--cat-automata-bg);
    color: var(--cat-automata-text);
    border: 1px solid var(--cat-automata-border);
}

.cat-search .card-icon-wrap {
    background-color: var(--cat-search-bg);
    color: var(--cat-search-text);
}
.cat-search .section-icon {
    background-color: var(--cat-search-bg);
    color: var(--cat-search-text);
}
.cat-search .section-badge {
    background-color: var(--cat-search-bg);
    color: var(--cat-search-text);
    border: 1px solid var(--cat-search-border);
}

.cat-puzzles .card-icon-wrap {
    background-color: var(--cat-puzzles-bg);
    color: var(--cat-puzzles-text);
}
.cat-puzzles .section-icon {
    background-color: var(--cat-puzzles-bg);
    color: var(--cat-puzzles-text);
}
.cat-puzzles .section-badge {
    background-color: var(--cat-puzzles-bg);
    color: var(--cat-puzzles-text);
    border: 1px solid var(--cat-puzzles-border);
}

/* ==========================================================================
   Empty State
   ========================================================================== */
.empty-state {
    text-align: center;
    padding: 64px 20px;
    background-color: var(--bg-surface);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-lg);
    display: none;
    margin: 20px 0 40px 0;
}

.empty-icon {
    color: var(--text-light);
    margin-bottom: 16px;
}

.empty-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: 8px;
}

.empty-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    max-width: 440px;
    margin: 0 auto 20px auto;
}

.empty-reset-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: var(--primary-light);
    color: var(--primary);
    border: 1px solid rgba(37, 99, 235, 0.2);
    padding: 8px 18px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.empty-reset-btn:hover {
    background-color: var(--primary);
    color: #ffffff;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
    margin-top: auto;
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    padding: 24px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.footer-links {
    display: flex;
    gap: 16px;
}

.footer-links a:hover {
    color: var(--text-heading);
}

/* Responsive */
@media (max-width: 768px) {
    .hero-title {
        font-size: 1.75rem;
    }
    
    .card-grid {
        grid-template-columns: 1fr;
    }
    
    .header-meta {
        display: none;
    }
    
    .status-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}
