@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');
@import url('https://fonts.googleapis.com/icon?family=Material+Icons+Round');

:root {
    --bg: #0b0f19;
    --bg2: #111827;
    --bg3: #1a2236;
    --accent: #10b981;
    --accent2: #34d399;
    --accent-glow: rgba(16, 185, 129, 0.25);
    --text: #f1f5f9;
    --text2: #94a3b8;
    --text3: #64748b;
    --border: rgba(16, 185, 129, 0.15);
    --radius: 14px;
    --cat-dev: #6366f1;
    --cat-devops: #8b5cf6;
    --cat-db: #f59e0b;
    --cat-web: #06b6d4;
    --cat-editor: #ec4899;
    --cat-sys: #64748b;
    --cat-net: #3b82f6;
    --cat-sec: #ef4444;
    --cat-media: #f97316;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding-bottom: 120px;
}

.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(11, 15, 25, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent), #06b6d4);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
}

.logo-text {
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.5px;
}

.logo-text span {
    color: var(--accent2);
}

.selected-counter {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--border);
    border-radius: 24px;
    font-size: 13px;
    color: var(--text2);
}

.selected-counter .count {
    font-weight: 700;
    color: var(--accent2);
    font-size: 16px;
}

.hero {
    text-align: center;
    padding: 50px 24px 10px;
    position: relative;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 250px;
    background: radial-gradient(ellipse, var(--accent-glow), transparent 70%);
    pointer-events: none;
}

.hero h1 {
    font-size: 38px;
    font-weight: 800;
    letter-spacing: -1.5px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--text), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 15px;
    color: var(--text2);
    max-width: 520px;
    margin: 0 auto;
    line-height: 1.6;
}

/* New Controls Container Styles */
.controls-container {
    max-width: 800px;
    margin: 30px auto 20px;
    padding: 0 24px;
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: center;
}

.os-select-large {
    padding: 14px 20px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    outline: none;
    cursor: pointer;
    min-width: 200px;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2394a3b8%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 10px;
    transition: border-color 0.3s;
}

.os-select-large:focus {
    border-color: var(--accent);
}

.search-bar {
    flex: 1;
    max-width: 400px;
    position: relative;
    margin: 0;
    /* Reset previous margin */
}

.search-bar input {
    width: 100%;
    padding: 14px 20px 14px 48px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.search-bar input:focus {
    border-color: var(--accent);
}

.search-bar .material-icons-round {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text3);
    font-size: 20px;
}

.filters {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px 24px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 7px 16px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: transparent;
    color: var(--text2);
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-btn:hover {
    border-color: var(--accent);
    color: var(--accent2);
}

.filter-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.apps-grid {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.app-card {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 140px;
    opacity: 0;
    animation: fadeIn 0.4s ease forwards;
}

.app-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.app-card.selected {
    border-color: var(--accent);
    background: rgba(16, 185, 129, 0.08);
}

.app-card.selected::after {
    content: '✓';
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: white;
}

.app-icon {
    font-size: 32px;
    margin-bottom: 10px;
}

.app-name {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-desc {
    font-size: 11px;
    color: var(--text3);
    line-height: 1.4;
    flex-grow: 1;
}

.app-cat {
    display: inline-block;
    margin-top: 12px;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    align-self: flex-start;
}

.cat-Development {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
}

.cat-DevOps {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
}

.cat-Database {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

.cat-Web\ Server {
    background: rgba(6, 182, 212, 0.15);
    color: #22d3ee;
}

.cat-Editor {
    background: rgba(236, 72, 153, 0.15);
    color: #f472b6;
}

.cat-System {
    background: rgba(100, 116, 139, 0.15);
    color: #94a3b8;
}

.cat-Network {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.cat-Security {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.cat-Multimedia {
    background: rgba(249, 115, 22, 0.15);
    color: #fb923c;
}

.cat-Browser {
    background: rgba(6, 182, 212, 0.15);
    color: #22d3ee;
}

.cat-Communication {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.cat-Gaming {
    background: rgba(236, 72, 153, 0.15);
    color: #f472b6;
}

.cat-Design {
    background: rgba(244, 63, 94, 0.15);
    color: #fb7185;
}

.cat-Crypto {
    background: rgba(234, 179, 8, 0.15);
    color: #facc15;
}

/* Bottom bar */
.bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(11, 15, 25, 0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    padding: 16px 24px;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 200;
}

.bottom-bar.visible {
    transform: translateY(0);
}

.bottom-bar-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.bottom-info .count-badge {
    background: var(--accent);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 14px;
}

.bottom-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.generate-btn {
    padding: 12px 28px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), #06b6d4);
    color: white;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-glow);
}

.clear-btn {
    padding: 10px 16px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-btn:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Script Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 500;
    padding: 24px;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-width: 800px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.script-output {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--accent2);
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 400px;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s;
}

.btn-copy {
    background: linear-gradient(135deg, var(--accent), #06b6d4);
    color: white;
}

.btn-download {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.empty {
    grid-column: 1/-1;
    text-align: center;
    padding: 60px 20px;
}

.empty .material-icons-round {
    font-size: 64px;
    color: var(--text3);
    opacity: 0.3;
    margin-bottom: 12px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width:768px) {
    .controls-container {
        flex-direction: column;
    }

    .os-select-large {
        width: 100%;
    }

    .search-bar {
        width: 100%;
        max-width: 100%;
    }

    .apps-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    .bottom-bar-inner {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width:480px) {
    .apps-grid {
        grid-template-columns: 1fr 1fr;
    }

    .bottom-bar {
        padding: 12px;
    }
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text3);
    border-radius: 3px;
}