/* === CSS Variables === */
:root {
    --bg-main: #f0f2f5;
    --bg-card: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    
    --primary-color: #01875f; /* Play Store Green-ish */
    --primary-hover: #016b4b;
    --accent-color: #2563eb;
    
    --border-color: #e5e7eb;
    --border-radius: 12px;
}

/* === Global Reset === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Roboto', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
}

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

/* === Navbar === */
.navbar {
    background: var(--bg-card);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-color);
}
.brand-icon { font-size: 28px; }
.brand-text { font-size: 1.2rem; font-weight: 700; color: var(--text-primary); }
.brand-text strong { color: var(--primary-color); }

.search-bar {
    flex: 1;
    max-width: 500px;
    position: relative;
}
.search-bar input {
    width: 100%;
    padding: 10px 40px 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-main);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}
.search-bar input:focus { border-color: var(--primary-color); }
.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.nav-links { display: flex; gap: 24px; }
.nav-links a {
    font-weight: 600;
    color: var(--text-secondary);
}
.nav-links a.active, .nav-links a:hover {
    color: var(--primary-color);
}

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

.breadcrumbs {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 20px;
    white-space: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none; /* Hide scrollbar Firefox */
}
.breadcrumbs::-webkit-scrollbar { display: none; /* Hide scrollbar Chrome */ }
.breadcrumbs .material-icons-round { font-size: 16px; }
.breadcrumbs a:hover { color: var(--primary-color); }
.breadcrumbs .current { color: var(--text-primary); font-weight: 500; }

.app-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
}

/* === Left Column === */
.content-left {
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-width: 0; /* Prevents flex children from overflowing */
}

/* Cards Base */
.app-header-card, .info-section, .comments-section, .meta-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
}

/* App Header */
.app-identity {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
}

.app-icon-real {
    width: 140px;
    height: 140px;
    border-radius: 28px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    object-fit: cover;
    background: #000;
    flex-shrink: 0;
}

.app-title-group {
    flex: 1;
    min-width: 0;
}

.app-title-group h1 {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 8px;
    word-wrap: break-word;
}

.developer {
    color: var(--primary-color);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.verified-icon { font-size: 16px; }

.app-stats {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}
.stat-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}
.stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 4px;
}
.star-icon { font-size: 16px; color: #f59e0b; }
.stat-label { font-size: 0.75rem; white-space: nowrap; }
.stat-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
}
.age-rating {
    border: 1px solid var(--text-primary);
    border-radius: 4px;
    padding: 1px 4px;
    font-size: 0.8rem;
}

/* Action Area */
.action-area {
    background: var(--bg-main);
    padding: 20px;
    border-radius: 12px;
    border: 1px dashed var(--border-color);
}

.mod-badge {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fca5a5;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
    text-align: center;
}

.btn-download {
    width: 100%;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: background 0.2s;
}
.btn-download:hover { background: var(--primary-hover); }
.btn-download .material-icons-round { font-size: 32px; flex-shrink: 0; }
.btn-text { display: flex; flex-direction: column; align-items: flex-start; text-align: left; }
.btn-text strong { font-size: 1.1rem; font-weight: 700; }
.btn-text span { font-size: 0.8rem; opacity: 0.9; font-weight: 400;}

.btn-download.success { background: var(--accent-color); }
.btn-download.success:hover { background: #1d4ed8; }

.download-progress { margin-top: 16px; }
.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}
.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--primary-color);
    transition: width 1s linear;
}

.security-badges {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 16px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.s-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.s-badge .material-icons-round { font-size: 16px; color: var(--primary-color); }

.hidden { display: none !important; }

/* Screenshots */
.screenshots-section {
    overflow: hidden;
    padding: 0; /* Remove padding to let scroll go edge to edge */
    background: transparent;
    border: none;
    box-shadow: none;
}
.screenshot-scroll {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 12px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch; /* Smooth scroll on iOS */
}
.screenshot-scroll::-webkit-scrollbar { height: 6px; }
.screenshot-scroll::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.sc-mock {
    flex: 0 0 auto;
    width: 250px;
    height: 140px;
    border-radius: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--text-muted);
}
.sc-mock img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Info Section */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
    overflow-x: auto;
    white-space: nowrap;
}
.tab {
    padding: 12px 24px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
}
.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 0.9rem;
    margin-bottom: 20px;
}
.alert-warning {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
}
.alert .material-icons-round { font-size: 20px; flex-shrink: 0;}

.tab-content h3 { margin-bottom: 16px; font-size: 1.1rem; }
.mod-features-list { list-style: none; }
.mod-features-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 0.95rem;
}
.mod-features-list .check {
    color: var(--primary-color);
    font-size: 20px;
    flex-shrink: 0;
}

/* Comments */
.comments-section h3 { margin-bottom: 20px; }
.comment {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--bg-main);
}
.comment:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}
.c-body { flex: 1; min-width: 0; }
.c-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    flex-wrap: wrap;
    gap: 8px;
}
.c-body p { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 6px; word-wrap: break-word; }
.c-date { font-size: 0.75rem; color: var(--text-muted); }

/* === Right Column === */
.content-right {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.meta-card h3 {
    margin-bottom: 16px;
    font-size: 1.1rem;
}
.meta-table {
    width: 100%;
    border-collapse: collapse;
}
.meta-table td {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}
.meta-table tr:last-child td { border-bottom: none; }
.meta-table td:first-child {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.meta-table td .material-icons-round { font-size: 18px; color: var(--text-muted); }
.meta-table td:last-child {
    text-align: right;
    font-weight: 500;
    color: var(--text-primary);
}

.ad-sidebar {
    background: #e2e8f0;
    height: 300px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 1px;
    border: 1px dashed #cbd5e1;
    width: 100%;
}

/* Footer */
footer {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* =========================================
   RESPONSIVE MEDIA QUERIES (MOBILE FIRST)
========================================= */

/* Tablet and Smaller Desktop */
@media (max-width: 900px) {
    .app-container {
        grid-template-columns: 1fr;
    }
    
    .nav-links {
        display: none; /* Hide nav links on smaller screens */
    }
    
    .search-bar {
        max-width: 300px;
    }
}

/* Mobile Devices */
@media (max-width: 600px) {
    .nav-container {
        padding: 12px 16px;
    }
    
    .search-bar {
        display: none; /* Hide search bar on mobile for cleaner look */
    }
    
    .main-content {
        padding: 16px;
    }
    
    .app-header-card, .info-section, .comments-section, .meta-card {
        padding: 16px;
    }
    
    .app-identity {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 16px;
    }
    
    .app-icon-real {
        width: 100px;
        height: 100px;
        border-radius: 20px;
    }
    
    .app-title-group h1 {
        font-size: 1.5rem;
    }
    
    .developer {
        justify-content: center;
    }
    
    .app-stats {
        justify-content: center;
    }
    
    .stat-divider {
        display: none; /* Hide dividers on mobile to allow wrapping */
    }
    
    .stat-item {
        align-items: center;
        flex: 1 1 30%; /* Take up equal space */
    }
    
    .action-area {
        padding: 16px;
    }
    
    .btn-download {
        padding: 12px;
    }
    
    .btn-text strong {
        font-size: 1rem;
    }
    
    .btn-text span {
        font-size: 0.75rem;
    }
    
    .mod-badge {
        font-size: 0.8rem;
    }
    
    .security-badges {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    
    .sc-mock {
        width: 200px;
        height: 112px;
    }
    
    .tab {
        padding: 12px 16px;
    }
    
    .comment {
        flex-direction: column;
    }
    
    .avatar {
        margin-bottom: 8px;
    }
}
