/* Premium "Creative Box" Design System */

:root {
    --bg-color: #000000;
    --card-bg: #1C1C1E;
    --card-hover: #2C2C2E;
    --text-primary: #FFFFFF;
    --text-secondary: #8E8E93;
    --accent-blue: #0A84FF;
    --accent-red: #FF453A;
    --border-color: #38383A;
    --nav-bg: rgba(28, 28, 30, 0.85);
    /* Translucent for nav */
    --blur: 20px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

/* Base Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", sans-serif;
    font-size: 16px;
    line-height: 1.5;
    min-height: 100vh;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation - Floating Pill */
.navbar {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    max-width: 500px;
    height: 60px;
    background: var(--nav-bg);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--border-color);
    border-radius: 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1000;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.nav-brand {
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Main Content Area */
.content-area {
    padding-top: 140px;
    /* Increased to prevent navbar overlay */
    padding-bottom: 60px;
}

/* App Grid - The "Box" System */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

/* The Creative Box (Card) */
.app-card {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 24px;
    position: relative;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 20px;
    /* Clean look - purely flat/elevated */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.app-card:hover {
    background: var(--card-hover);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

/* Card Header: Icon + Text */
.card-header {
    display: flex;
    align-items: flex-start;
    /* Expand down */
    gap: 16px;
}

.app-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: linear-gradient(135deg, #1c1c1e, #2c2c2e);
    /* Placeholder bg */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    /* For images */
}

.app-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.app-details {
    flex: 1;
    min-width: 0;
    /* Text truncation fix */
}

.app-name {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text-primary);
    word-break: break-all;
    /* Prevent long filenames from overflowing */
}

.app-meta {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Card Actions: Footer Row */
.card-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: auto;
    /* Push to bottom */
}

.btn-install {
    flex: 1;
    height: 44px;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 14px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-install:hover {
    background: #0071e3;
    transform: scale(1.02);
}

.btn-delete {
    width: 44px;
    height: 44px;
    background: rgba(255, 69, 58, 0.1);
    color: var(--accent-red);
    border: none;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-delete:hover {
    background: rgba(255, 69, 58, 0.2);
    transform: scale(1.05);
}

/* Loading State */
.loading {
    text-align: center;
    padding: 60px;
    color: var(--text-secondary);
}

/* Index.html List Links (Compatibility) */
.list-card {
    background: var(--card-bg);
    border-radius: 18px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-decoration: none;
    color: var(--text-primary);
    margin-bottom: 16px;
    transition: all 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.list-card:hover {
    background: var(--card-hover);
    transform: translateX(4px);
}

/* Responsive Overrides */
@media (max-width: 600px) {
    .app-grid {
        grid-template-columns: 1fr;
        /* Full width cards */
    }

    .navbar {
        width: calc(100% - 32px);
        top: 16px;
    }

    .content-area {
        padding-left: 16px;
        padding-right: 16px;
    }
}