:root {
    --primary: #6c5ce7;
    --primary-dark: #5a4bd1;
    --primary-light: #ede9fe;
    --primary-subtle: rgba(108, 92, 231, 0.08);
    --accent: #f59e0b;
    --accent-light: #fef3c7;
    --surface: #ffffff;
    --bg: #f4f5fb;
    --text: #0b0e1a;
    --text-secondary: #6b7280;
    --border: #e4e7ef;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.03), 0 1px 1px rgba(0, 0, 0, 0.02);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.04), 0 2px 4px -2px rgba(0, 0, 0, 0.02);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 4px 10px -4px rgba(0, 0, 0, 0.02);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 8px;
    --bg-rgb: 244, 245, 251;
    --surface-rgb: 255, 255, 255;
    --primary-rgb: 108, 92, 231;
}

[data-theme="dark"] {
    --primary: #a78bfa;
    --primary-dark: #8b74e8;
    --primary-light: #2e2448;
    --primary-subtle: rgba(167, 139, 250, 0.10);
    --accent: #fbbf24;
    --accent-light: #452e0a;
    --surface: #141626;
    --bg: #0a0b16;
    --text: #f1f3f7;
    --text-secondary: #9ca3b0;
    --border: #232540;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
    --shadow: 0 4px 8px -1px rgba(0, 0, 0, 0.45), 0 2px 4px -2px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 4px 10px -4px rgba(0, 0, 0, 0.3);
    --bg-rgb: 10, 11, 22;
    --surface-rgb: 20, 22, 38;
    --primary-rgb: 167, 139, 250;
}

/* ===== Base ===== */
body {
    background: var(--bg);
    background-image: 
        linear-gradient(180deg, rgba(var(--primary-rgb), 0.03) 0%, transparent 30%, transparent 70%, rgba(var(--primary-rgb), 0.02) 100%),
        radial-gradient(circle at 20% 30%, rgba(var(--primary-rgb), 0.04) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(var(--primary-rgb), 0.03) 0%, transparent 50%);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    transition: background 0.3s, color 0.3s;
    line-height: 1.6;
}
[data-theme="dark"] body {
    background: var(--bg);
    background-image: 
        linear-gradient(180deg, rgba(var(--primary-rgb), 0.05) 0%, transparent 30%, transparent 70%, rgba(var(--primary-rgb), 0.04) 100%),
        radial-gradient(circle at 20% 30%, rgba(var(--primary-rgb), 0.06) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(var(--primary-rgb), 0.04) 0%, transparent 50%);
}

a { color: var(--primary); }
a:hover { color: var(--primary-dark); }

::selection {
    background: rgba(var(--primary-rgb), 0.2);
    color: var(--text);
}

/* ===== Theme Toggle ===== */
.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s;
    font-size: 1.1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.theme-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
    transform: rotate(15deg);
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.15);
}

/* ===== Navbar ===== */
.navbar-modern {
    background: rgba(var(--surface-rgb), 0.80) !important;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: none;
    padding: 14px 0;
    transition: background 0.3s;
    position: relative;
}
.navbar-modern::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), #a78bfa, var(--primary));
    opacity: 0.6;
}
.navbar-modern .navbar-brand {
    background: linear-gradient(135deg, var(--primary), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    font-size: 1.3rem;
    letter-spacing: -0.03em;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: opacity 0.2s;
}
.navbar-modern .navbar-brand i {
    -webkit-text-fill-color: var(--primary);
    font-size: 1.4rem;
}
.navbar-modern .nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    padding: 8px 16px !important;
    border-radius: 10px;
    transition: all 0.2s;
}
.navbar-modern .nav-link:hover {
    color: var(--primary) !important;
    background: var(--primary-subtle);
}
.navbar-modern .navbar-toggler {
    color: var(--text-secondary);
    border: none;
    padding: 4px;
}
.navbar-modern .navbar-toggler:focus {
    box-shadow: none;
}
.navbar-modern .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%2364748b' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* ===== Search (navbar override) ===== */
.search-wrapper {
    position: relative;
    width: 100%;
    max-width: 420px;
}
.search-wrapper .form-control {
    height: 42px;
    border-radius: 21px;
    border: 1.5px solid var(--border);
    padding-left: 42px;
    padding-right: 40px;
    font-size: 0.88rem;
    background: var(--bg);
    color: var(--text);
    transition: all 0.25s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.search-wrapper .form-control::placeholder {
    color: var(--text-secondary);
    opacity: 0.55;
}
.search-wrapper .form-control:focus {
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}
.search-wrapper .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    z-index: 5;
    pointer-events: none;
    font-size: 0.9rem;
}
.search-wrapper .search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    cursor: pointer;
    z-index: 5;
    border: none;
    background: none;
    padding: 4px;
    display: none;
    font-size: 0.7rem;
    opacity: 0.6;
}
.search-wrapper .search-clear:hover { opacity: 1; }
.search-wrapper .form-control:not(:placeholder-shown) ~ .search-clear {
    display: block;
}

/* ===== Filter Card (page header + category pills merged) ===== */
.filter-card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 24px 24px 20px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}
.filter-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), #a78bfa, transparent 80%);
}
.filter-card .page-header {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.filter-card .page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}
.filter-card .page-header .subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.filter-card .category-pills {
    margin-bottom: 0;
}

/* ===== Category Pills ===== */
.category-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    align-items: center;
}
.category-pill-sort {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 4px 4px 14px;
    margin-left: auto;
    border-left: 1.5px solid var(--border);
}
.category-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.25s;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.category-pill:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-subtle);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.category-pill.active {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
    border-color: var(--primary);
}
.category-pill .count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0 7px;
    line-height: 1;
    background: var(--bg);
    color: var(--text-secondary);
    transition: all 0.2s;
}
.category-pill.active .count {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* ===== Software Cards ===== */
.software-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 16px;
}

@media (max-width: 480px) {
    .software-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

.software-card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 24px 14px 16px;
    text-align: center;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
}
.software-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), #a78bfa);
    opacity: 0.4;
    transition: opacity 0.3s;
}
.software-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 32px -8px rgba(var(--primary-rgb), 0.15);
    border-color: rgba(var(--primary-rgb), 0.2);
}
.software-card:hover::before { opacity: 1; }
.software-card .icon-wrap {
    width: 68px;
    height: 68px;
    margin: 0 auto 12px;
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary-light), var(--bg));
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.08);
}
.software-card:hover .icon-wrap {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.15);
}
.software-card .icon-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.software-card .icon-wrap .placeholder-icon {
    font-size: 1.8rem;
    color: var(--text-secondary);
}
.software-card .sw-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    width: 100%;
}
.software-card .sw-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 6px;
    width: 100%;
}
.software-card .sw-category {
    font-size: 0.7rem;
    color: var(--text-secondary);
}
.software-card .sw-version {
    font-size: 0.65rem;
    color: var(--text-secondary);
    background: var(--bg);
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 500;
}
.software-card .sw-downloads {
    font-size: 0.65rem;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

/* ===== Detail Page ===== */
.detail-header {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 28px;
    padding: 32px;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.2s;
}
.detail-header:hover {
    box-shadow: var(--shadow);
}
.detail-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), #a78bfa, transparent);
}
.detail-icon {
    width: 96px;
    height: 96px;
    border-radius: 22px;
    background: linear-gradient(135deg, var(--primary-light), var(--bg));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.1);
}
.detail-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.detail-icon .placeholder-icon {
    font-size: 2.5rem;
    color: var(--text-secondary);
}
.detail-header-info h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.section-card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}
.section-card:hover {
    box-shadow: var(--shadow);
    border-color: rgba(var(--primary-rgb), 0.1);
}
.section-card .section-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}
.info-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    border: 1px solid transparent;
}
.info-item:hover {
    background: var(--primary-subtle);
    border-color: rgba(var(--primary-rgb), 0.1);
}
.info-item .info-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(var(--primary-rgb), 0.1);
}
.info-item .info-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 2px;
}
.info-item .info-value {
    font-size: 0.88rem;
    font-weight: 600;
    word-break: break-all;
}
.info-item .info-value a {
    color: var(--primary);
    text-decoration: none;
}
.info-item .info-value a:hover {
    text-decoration: underline;
}

.download-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: all 0.25s;
    text-decoration: none;
    letter-spacing: -0.01em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.btn-download-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.3);
    border: none;
}
.btn-download-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(var(--primary-rgb), 0.4);
    color: white;
}
.btn-download-outline {
    background: var(--surface);
    color: var(--text);
    border: 1.5px solid var(--border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.btn-download-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-subtle);
    transform: translateY(-2px);
}

/* ===== Info Sidebar ===== */
.info-sidebar {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}
.info-sidebar:hover {
    box-shadow: var(--shadow);
    border-color: rgba(var(--primary-rgb), 0.1);
}
.info-sidebar .sidebar-header {
    padding: 16px 20px;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}
.info-sidebar .sidebar-body {
    padding: 16px 20px;
}
.sidebar-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    font-size: 0.88rem;
    transition: background 0.15s;
}
.sidebar-row:not(:last-child) {
    border-bottom: 1px solid var(--border);
}
.sidebar-row:hover {
    background: var(--primary-subtle);
    margin: 0 -20px;
    padding: 10px 20px;
}
.sidebar-row .label {
    color: var(--text-secondary);
}
.sidebar-row .value {
    font-weight: 600;
    text-align: right;
}

/* ===== Footer ===== */
.footer-modern {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 36px 0;
    margin-top: auto;
    color: var(--text-secondary);
    font-size: 0.88rem;
    text-align: center;
    position: relative;
}
.footer-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    opacity: 0.4;
}
.footer-modern .footer-brand {
    font-size: 1rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}
.footer-modern .footer-divider {
    width: 40px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), transparent);
    border-radius: 2px;
    margin: 12px auto;
}

/* ===== Badge ===== */
.badge-soft {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    border: 1px solid rgba(var(--primary-rgb), 0.1);
}
.badge-soft-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text-secondary);
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    transition: border-color 0.2s;
}
.badge-soft-outline:hover {
    border-color: var(--primary);
}

/* ===== Breadcrumb ===== */
.breadcrumb-modern {
    background: var(--surface);
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.breadcrumb-modern .breadcrumb-item {
    font-size: 0.85rem;
}
.breadcrumb-modern .breadcrumb-item a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}
.breadcrumb-modern .breadcrumb-item a:hover {
    color: var(--primary);
}
.breadcrumb-modern .breadcrumb-item.active {
    color: var(--text);
    font-weight: 600;
}
.breadcrumb-modern .breadcrumb-item + .breadcrumb-item::before {
    color: var(--border);
    content: "/";
}

/* ===== Admin Tables ===== */
.table-modern {
    border-collapse: separate;
    border-spacing: 0;
}
.table-modern thead th {
    background: var(--bg);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    padding: 14px 16px;
    border-bottom: 2px solid var(--border);
}
.table-modern tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    background: var(--surface);
    transition: all 0.15s;
}
.table-modern tbody tr:hover td {
    background: rgba(var(--primary-rgb), 0.03);
    border-color: rgba(var(--primary-rgb), 0.1);
}

/* ===== Admin Cards ===== */
.admin-card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all 0.2s;
}
.admin-card:hover {
    box-shadow: var(--shadow);
}
.admin-card .admin-card-header {
    padding: 16px 20px;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--primary-subtle), transparent);
}
.admin-card .admin-card-body {
    padding: 20px;
}

.list-group-item {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
    transition: background 0.15s;
}
.list-group-item:hover {
    background: var(--primary-subtle);
}

/* ===== Form ===== */
.form-modern .form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}
.form-modern .form-control,
.form-modern .form-select {
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    padding: 10px 14px;
    font-size: 0.9rem;
    transition: all 0.2s;
    background-color: var(--bg);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.form-modern .form-control:focus,
.form-modern .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
    background-color: var(--surface);
    color: var(--text);
}
.form-modern .form-control::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

/* ===== Section Divider ===== */
.section-divider {
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark), transparent);
    border-radius: 2px;
    margin: 28px 0;
    border: none;
    opacity: 0.5;
}

/* ===== Platform Badges ===== */
.platform-badge {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 5px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    vertical-align: middle;
    transition: transform 0.2s;
}
.platform-badge:hover {
    transform: scale(1.05);
}
.platform-badge.windows { background: #e8f4fd; color: #0284c7; }
.platform-badge.macos,
.platform-badge.mac { background: #f3e8ff; color: #7c3aed; }
.platform-badge.linux { background: #fef3c7; color: #d97706; }
.platform-badge.android { background: #dcfce7; color: #16a34a; }
.platform-badge.ios { background: #f1f5f9; color: #475569; }
[data-theme="dark"] .platform-badge.windows { background: #0c4a6e; color: #7dd3fc; }
[data-theme="dark"] .platform-badge.macos,
[data-theme="dark"] .platform-badge.mac { background: #4c1d95; color: #c4b5fd; }
[data-theme="dark"] .platform-badge.linux { background: #78350f; color: #fcd34d; }
[data-theme="dark"] .platform-badge.android { background: #14532d; color: #86efac; }
[data-theme="dark"] .platform-badge.ios { background: #334155; color: #cbd5e1; }

/* ===== Search Highlight ===== */
mark {
    background: rgba(251, 191, 36, 0.3);
    color: inherit;
    padding: 0 3px;
    border-radius: 4px;
    font-weight: 600;
}
[data-theme="dark"] mark {
    background: rgba(251, 191, 36, 0.25);
}

/* ===== Toast ===== */
.toast-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 22px;
    border-radius: 14px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    opacity: 0;
    transform: translateY(-16px) scale(0.96);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    max-width: 420px;
    backdrop-filter: blur(8px);
}
.toast-notification.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.toast-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.toast-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.toast-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.toast-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
[data-theme="dark"] .toast-success { background: #052e16; color: #86efac; border-color: #166534; }
[data-theme="dark"] .toast-danger { background: #450a0a; color: #fca5a5; border-color: #991b1b; }
[data-theme="dark"] .toast-info { background: #172554; color: #93c5fd; border-color: #1e3a5f; }
[data-theme="dark"] .toast-warning { background: #451a03; color: #fcd34d; border-color: #78350f; }

/* ===== Modal ===== */
.modal-modern .modal-content {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}
.modal-modern .modal-header {
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
}
.modal-modern .modal-footer {
    border-top: 1px solid var(--border);
    padding: 12px 24px;
}

/* ===== Pagination ===== */
.page-link {
    border: 1.5px solid var(--border) !important;
    background: var(--surface) !important;
    color: var(--text) !important;
    border-radius: 10px !important;
    margin: 0 3px;
    padding: 8px 14px;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.page-link:hover {
    border-color: var(--primary) !important;
    color: var(--primary) !important;
    background: var(--primary-subtle) !important;
}
.page-item.active .page-link {
    border-color: var(--primary) !important;
    background: var(--primary) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
    border-color: var(--primary) !important;
}

/* ===== Animations ===== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-in {
    animation: fadeInUp 0.4s ease-out both;
}
.animate-in:nth-child(1) { animation-delay: 0.02s; }
.animate-in:nth-child(2) { animation-delay: 0.04s; }
.animate-in:nth-child(3) { animation-delay: 0.06s; }
.animate-in:nth-child(4) { animation-delay: 0.08s; }
.animate-in:nth-child(5) { animation-delay: 0.1s; }
.animate-in:nth-child(6) { animation-delay: 0.12s; }
.animate-in:nth-child(7) { animation-delay: 0.14s; }
.animate-in:nth-child(8) { animation-delay: 0.16s; }
.animate-in:nth-child(9) { animation-delay: 0.18s; }
.animate-in:nth-child(10) { animation-delay: 0.2s; }
.animate-in:nth-child(11) { animation-delay: 0.22s; }
.animate-in:nth-child(12) { animation-delay: 0.24s; }
.animate-in:nth-child(13) { animation-delay: 0.26s; }
.animate-in:nth-child(14) { animation-delay: 0.28s; }
.animate-in:nth-child(15) { animation-delay: 0.3s; }
.animate-in:nth-child(16) { animation-delay: 0.32s; }
.animate-in:nth-child(17) { animation-delay: 0.34s; }
.animate-in:nth-child(18) { animation-delay: 0.36s; }

/* ===== Login ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}
[data-theme="dark"] .login-page {
    background: linear-gradient(135deg, #1a1040 0%, #2d1b4e 50%, #1a1040 100%);
}
.login-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.login-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.login-card .login-logo {
    text-align: center;
    margin-bottom: 32px;
}
.login-card .login-logo .logo-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.6rem;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.25);
    border: 2px solid rgba(255, 255, 255, 0.1);
}
.login-card .login-logo h4 {
    font-weight: 700;
    font-size: 1.2rem;
}
.login-card .login-logo p {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--surface);
    border-radius: var(--radius);
    border: 2px dashed var(--border);
    transition: border-color 0.2s;
}
.empty-state:hover {
    border-color: rgba(var(--primary-rgb), 0.3);
}
.empty-state .empty-icon {
    font-size: 3rem;
    color: var(--border);
    margin-bottom: 16px;
}
.empty-state h5 {
    font-weight: 600;
    margin-bottom: 6px;
}
.empty-state p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ===== Transition overlay ===== */
.theme-transitioning,
.theme-transitioning * {
    transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease !important;
}

/* ===== Btn primary override ===== */
.btn-primary {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    border-radius: 10px !important;
    font-weight: 600 !important;
    padding: 10px 20px !important;
    transition: all 0.2s !important;
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.2);
}
.btn-primary:hover {
    background: var(--primary-dark) !important;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3) !important;
    transform: translateY(-1px);
}

/* ===== Back to top ===== */
#backToTop {
    border-radius: 14px !important;
    box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.3) !important;
    transition: all 0.25s !important;
    backdrop-filter: blur(8px);
}
#backToTop:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 24px rgba(var(--primary-rgb), 0.4) !important;
}

/* ===== Sort buttons ===== */
.sort-btn {
    padding: 6px 14px;
    font-size: 0.8rem;
    border-radius: 8px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.sort-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-subtle);
}
.sort-btn.active {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.2);
}

/* ===== Flash message fallback ===== */
.alert-modern {
    border-radius: 12px;
    border: none;
    padding: 14px 20px;
    font-weight: 500;
    font-size: 0.9rem;
}
