:root {
    --bg-dark: #0b0b0d;
    --bg-card: #1f1f23;
    --bg-sidebar: rgba(18, 18, 20, 0.9);
    --accent: #00e676; /* PlayStore-like Green */
    --accent-glow: rgba(0, 230, 118, 0.3);
    --text-primary: #f1f3f4;
    --text-secondary: #9aa0a6;
    --border: rgba(255, 255, 255, 0.08);
    --glass-blur: 32px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

/* --- SIDEBAR --- */
.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 240px;
    background: var(--bg-sidebar);
    backdrop-filter: blur(var(--glass-blur));
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 30px 16px;
    z-index: 100;
}

.branding {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 40px;
    cursor: pointer;
    padding: 8px;
    border-radius: 12px;
    transition: background 0.2s;
}

.branding:hover { background: rgba(255,255,255,0.03); }

.brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #00c853, #1a73e8);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-name {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform: translateX(-10px);
}

.branding.active .brand-name {
    opacity: 1;
    transform: translateX(0);
}

.side-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 18px;
    border-radius: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    transition: 0.2s;
    cursor: pointer;
}

.side-item:hover { color: var(--text-primary); background: rgba(255,255,255,0.04); }
.side-item.active { background: rgba(0, 230, 118, 0.1); color: var(--accent); font-weight: 500; }

/* --- CONTENT AREA --- */
.app-container { display: flex; height: 100vh; padding-left: 240px; }

.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 30px 60px;
    scroll-behavior: smooth;
}

header {
    margin-bottom: 30px;
    position: sticky;
    top: 0;
    background: var(--bg-dark);
    padding: 10px 0;
    z-index: 50;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-bar {
    background: #202124;
    border-radius: 8px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 500px;
    height: 48px;
}

.search-bar input {
    background: transparent; border: none; outline: none; color: white; width: 100%; font-size: 0.95rem;
}

/* --- GRID SYSTEM --- */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 32px;
    margin-bottom: 60px;
}

.app-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1);
}

.app-icon-wrapper {
    width: 100px;
    height: 100px;
    background: #ffffff; /* Use white background for icons to look better with favicons */
    border-radius: 24px; /* PlayStore standard rounding */
    margin-bottom: 12px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.app-icon-wrapper img {
    width: 65%; /* Google favicons need some padding */
    height: 65%;
    object-fit: contain;
}


.app-card:hover .app-icon-wrapper {
    box-shadow: 0 12px 24px rgba(0,0,0,0.5), 0 0 20px var(--accent-glow);
    transform: scale(1.05);
}

.app-name {
    font-size: 0.82rem;
    font-weight: 400;
    color: var(--text-primary);
    width: 100%;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 4px;
}

.app-cat {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 1px;
}

.premium-tag {
    position: absolute;
    top: 0; left: 0; right: 0;
    background: var(--accent);
    color: #000;
    font-size: 0.6rem;
    font-weight: 800;
    text-align: center;
    padding: 2px 0;
    transform: translateY(-100%);
    transition: 0.3s;
}

.app-card:hover .premium-tag { transform: translateY(0); }

/* --- MODALS & SECURITY --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.security-card {
    background: #1c1c1e;
    border-radius: 28px;
    padding: 40px;
    width: 380px;
    text-align: center;
}

.loader-overlay {
    position: fixed;
    inset: 0;
    background: #0f0f11;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255,255,255,0.05);
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s infinite cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes scan { 0%, 100% { top: 0; } 50% { top: 100%; } }

/* --- RESPONSIVE --- */
@media (max-width: 1024px) {
    .sidebar { width: 80px; padding: 30px 8px; }
    .side-item span, .brand-name { display: none; }
    .app-container { padding-left: 80px; }
    .content-area { padding: 30px; }
    .search-bar { width: 300px; }
}

@media (max-width: 600px) {
    .apps-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 16px; }
    .app-icon-wrapper { width: 80px; height: 80px; border-radius: 18px; }
}

/* --- BUTTONS --- */
.btn-install {
    background: var(--accent);
    color: #000;
    border: none;
    padding: 12px 24px;
    border-radius: 100px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.btn-install:hover { opacity: 0.9; transform: scale(1.05); }

/* Custom Switch for Settings */
.switch { position: relative; width: 44px; height: 24px; }
.switch input { opacity: 0; }
.slider { position: absolute; inset: 0; background: #333; border-radius: 100px; transition: 0.3s; cursor: pointer; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.3s; }
input:checked + .slider { background: var(--accent); }
input:checked + .slider:before { transform: translateX(20px); }