:root {
    --primary-color: #4285f4;
    --secondary-color: #34a853;
    --accent-color: #ea4335;
    --yellow-color: #fbbc05;
    --light-bg: #f8f9fa;
    --dark-bg: #202124;
    --dark-text: #202124;
    --light-text: #5f6368;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    --hover-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background-color: var(--light-bg);
    color: var(--dark-text);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

a {
    text-decoration: none;
}

body.dark-mode {
    --light-bg: #121212;
    --dark-text: #f5f5f5;
    --light-text: #b0b0b0;
    background-color: var(--light-bg);
    color: var(--dark-text);
}

/* Header Styles - Compact for mobile */
header {
    background-color: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    z-index: 1000;
    width: 100%;
    transition: background-color 0.3s;
    padding: 8px 0;
}

body.dark-mode header {
    background-color: #1e1e1e;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.logo i {
    margin-right: 6px;
    color: var(--accent-color);
    font-size: 1.1rem;
}

.search-bar {
    display: flex;
    align-items: center;
    background-color: var(--light-bg);
    border-radius: 18px;
    padding: 6px 12px;
    width: 50%;
    transition: background-color 0.3s;
    margin: 0 10px;
}

body.dark-mode .search-bar {
    background-color: #2c2c2c;
}

.search-bar i {
    color: var(--light-text);
    margin-right: 8px;
    font-size: 0.9rem;
}

.search-bar input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 0.85rem;
    color: var(--dark-text);
}

body.dark-mode .search-bar input {
    color: var(--dark-text);
}

.user-actions {
    display: flex;
    align-items: center;
}

.user-actions a, .dark-mode-toggle {
    margin-left: 12px;
    color: var(--dark-text);
    font-size: 1rem;
    cursor: pointer;
    transition: color 0.3s;
}

.user-actions a:hover, .dark-mode-toggle:hover {
    color: var(--primary-color);
}

body.dark-mode .user-actions a, 
body.dark-mode .dark-mode-toggle {
    color: var(--dark-text);
}

/* Container - Adjusted for compact header */
.container {
    max-width: 1400px;
    margin: 60px auto 20px;
    padding: 0 15px;
}

/* Hero Section - More compact */
.hero-section {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 30px 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-section:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none"><path d="M0,0 L100,0 L100,100 Z" fill="rgba(255,255,255,0.1)"/></svg>');
    background-size: 100% 100%;
}

.hero-content h1 {
    font-size: 1.5rem;
    margin-bottom: 12px;
    position: relative;
}

.hero-content p {
    font-size: 0.9rem;
    margin-bottom: 20px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
}

.btn {
    display: inline-block;
    background-color: white;
    color: var(--primary-color);
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 600;
    transition: all 0.3s;
    position: relative;
    font-size: 0.9rem;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0,0,0,0.1);
}

/* Category Filter - More compact */
.category-filter {
    display: flex;
    justify-content: flex-start;
    overflow-x: auto;
    gap: 10px;
    margin-bottom: 25px;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.category-filter::-webkit-scrollbar {
    display: none;
}

.category-btn {
    display: flex;
    align-items: center;
    background-color: white;
    border: 1px solid #e0e0e0;
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
    font-size: 0.85rem;
    white-space: nowrap;
    flex-shrink: 0;
}

body.dark-mode .category-btn {
    background-color: #1e1e1e;
    border-color: #333;
    color: var(--dark-text);
}

.category-btn i {
    margin-right: 6px;
    font-size: 0.9rem;
}

.category-btn:hover, .category-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Section Title */
.section-title {
    text-align: center;
    margin-bottom: 20px;
}

.section-title h2 {
    font-size: 1.4rem;
    color: var(--dark-text);
    position: relative;
    display: inline-block;
}

.section-title h2:after {
    content: '';
    position: absolute;
    width: 50%;
    height: 2px;
    background-color: var(--primary-color);
    bottom: -8px;
    left: 25%;
}

/* Apps Grid - UPDATED FOR 2-COLUMN MOBILE LAYOUT */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.app-card {
    background-color: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: transform 0.3s, box-shadow 0.3s;
}

body.dark-mode .app-card {
    background-color: #1e1e1e;
}

.app-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--hover-shadow);
}

.app-image {
    position: relative;
    height: 140px;
    overflow: hidden;
}

.app-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.app-card:hover .app-image img {
    transform: scale(1.05);
}

.app-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: var(--primary-color);
    color: white;
    padding: 3px 6px;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 600;
}

.app-badge.android {
    background-color: var(--secondary-color);
}

.app-badge.windows {
    background-color: #0078d7;
}

.app-badge.linux {
    background-color: var(--yellow-color);
}

.app-badge.wordpress {
    background-color: #0073aa;
}

.app-badge.plugins {
    background-color: #6b5ca5;
}

.app-badge.templates {
    background-color: #f07167;
}

.app-badge.scripts {
    background-color: #00a8e8;
}

.app-info {
    padding: 10px;
}

.app-title {
    font-size: 0.9rem;
    margin-bottom: 4px;
    color: var(--dark-text);
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.app-developer {
    color: var(--light-text);
    font-size: 0.75rem;
    margin-bottom: 6px;
}

.app-description {
    display: none; /* Hidden to save space */
}

.app-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.app-rating {
    display: flex;
    align-items: center;
    color: var(--light-text);
    font-size: 0.75rem;
}

.app-rating i {
    color: var(--yellow-color);
    margin-right: 2px;
    font-size: 0.7rem;
}

.app-price {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 0.8rem;
}

.app-price.free {
    color: var(--secondary-color);
}

.app-actions {
    display: flex;
    justify-content: space-between;
    gap: 6px;
}

/* UPDATED BUTTON SIZES */
.btn-details {
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.7rem;
    text-align: center;
    background-color: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    flex: 0 0 auto;
    width: auto;
}

.btn-details:hover {
    background-color: var(--primary-color);
    color: white;
}

.btn-download {
    padding: 10px 10px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.8rem;
    text-align: center;
    background-color: var(--primary-color);
    border: none;
    color: white;
    flex: 1;
}

.btn-download:hover {
    background-color: var(--secondary-color);
}

/* Ad Container - More compact */
.ad-container {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px 20px;
    border-radius: 12px;
    margin-bottom: 30px;
    text-align: center;
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.2);
    position: relative;
    overflow: hidden;
}

.ad-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none"><path d="M0,0 L100,0 L100,100 Z" fill="rgba(255,255,255,0.1)"/></svg>');
    background-size: 100% 100%;
}

.ad-title {
    font-size: 1.4rem;
    margin-bottom: 12px;
    position: relative;
    font-weight: 700;
}

.ad-container p {
    font-size: 0.9rem;
    margin-bottom: 20px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    line-height: 1.4;
}

.ad-features {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.ad-feature {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 120px;
    transition: transform 0.3s;
}

.ad-feature:hover {
    transform: translateY(-3px);
}

.ad-feature i {
    font-size: 1.8rem;
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.1);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.ad-feature span {
    font-weight: 600;
    font-size: 0.85rem;
}

.btn-primary {
    background-color: white;
    color: #667eea;
    padding: 10px 25px;
    border-radius: 30px;
    font-weight: 600;
    transition: all 0.3s;
    position: relative;
    font-size: 0.9rem;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(0,0,0,0.2);
    background-color: #f8f9fa;
}

/* Footer - More compact */
footer {
    background-color: white;
    color: var(--light-text);
    padding: 30px 0 15px;
    margin-top: 30px;
    transition: background-color 0.3s;
}

body.dark-mode footer {
    background-color: #1e1e1e;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 15px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.footer-section h3 {
    color: var(--dark-text);
    margin-bottom: 12px;
    font-size: 1.1rem;
}

.footer-section p {
    margin-bottom: 12px;
    line-height: 1.5;
    font-size: 0.85rem;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 8px;
}

.footer-links a {
    color: var(--light-text);
    transition: color 0.3s;
    display: flex;
    align-items: center;
    font-size: 0.85rem;
}

.footer-links a i {
    margin-right: 8px;
    font-size: 0.9rem;
}

.footer-links a:hover {
    color: var(--primary-color);
}

.social-links {
    display: flex;
    gap: 10px;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    background-color: var(--light-bg);
    border-radius: 50%;
    color: var(--dark-text);
    transition: all 0.3s;
    font-size: 0.9rem;
}

body.dark-mode .social-links a {
    background-color: #2c2c2c;
}

.social-links a:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.newsletter {
    display: flex;
    margin-top: 10px;
}

.newsletter input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 4px 0 0 4px;
    outline: none;
    font-size: 0.85rem;
}

body.dark-mode .newsletter input {
    background-color: #2c2c2c;
    border-color: #333;
    color: var(--dark-text);
}

.newsletter button {
    border-radius: 0 4px 4px 0;
    padding: 8px 12px;
    font-size: 0.85rem;
}

.copyright {
    text-align: center;
    margin-top: 30px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
    font-size: 0.8rem;
}

body.dark-mode .copyright {
    border-top-color: #333;
}

/* Back to Top Button - Smaller */
.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
    z-index: 999;
    font-size: 0.9rem;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

/* Responsive Design - UPDATED FOR 2-COLUMN MOBILE LAYOUT */
@media (max-width: 1024px) {
    .header-content {
        flex-wrap: wrap;
    }
    
    .search-bar {
        order: 3;
        width: 100%;
        margin-top: 10px;
        margin-left: 0;
        margin-right: 0;
    }
    
    .apps-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .header-content {
        padding: 0 10px;
    }
    
    nav {
        display: none;
    }
    
    .hero-content h1 {
        font-size: 1.3rem;
    }
    
    .hero-content p {
        font-size: 0.85rem;
    }
    
    .category-filter {
        gap: 8px;
    }
    
    .category-btn {
        padding: 5px 12px;
        font-size: 0.8rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
    }
    
    .ad-container {
        padding: 20px 15px;
    }
    
    .ad-title {
        font-size: 1.2rem;
    }
    
    .ad-features {
        gap: 15px;
    }
    
    /* MOBILE GRID LAYOUT - 2 columns */
    .apps-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .app-card {
        border-radius: 8px;
    }
    
    .app-image {
        height: 120px;
    }
    
    .app-info {
        padding: 8px;
    }
    
    .app-title {
        font-size: 0.85rem;
    }
    
    .app-developer {
        font-size: 0.7rem;
    }
    
    .app-meta {
        margin-bottom: 6px;
    }
    
    .app-rating {
        font-size: 0.7rem;
    }
    
    .app-rating i {
        font-size: 0.65rem;
    }
    
    .app-price {
        font-size: 0.75rem;
    }
    
    .app-actions {
        gap: 5px;
    }
    
    /* UPDATED BUTTON SIZES FOR MOBILE */
    .btn-details {
        padding: 3px 6px;
        font-size: 0.65rem;
    }
    
    .btn-download {
        padding: 5px 8px;
        font-size: 0.75rem;
    }
    
    .app-badge {
        top: 6px;
        right: 6px;
        font-size: 0.6rem;
        padding: 2px 5px;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.1rem;
    }
    
    .hero-section {
        padding: 20px 15px;
        margin-bottom: 20px;
    }
    
    .hero-content h1 {
        font-size: 1.2rem;
    }
    
    .ad-container {
        padding: 15px 12px;
    }
    
    .ad-title {
        font-size: 1.1rem;
    }
    
    .ad-container p {
        font-size: 0.8rem;
    }
    
    .ad-features {
        flex-direction: column;
        gap: 15px;
    }
    
    .ad-feature i {
        font-size: 1.5rem;
        width: 45px;
        height: 45px;
    }
    
    /* Even more compact for very small screens */
    .apps-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .app-image {
        height: 100px;
    }
    
    .app-title {
        font-size: 0.8rem;
    }
    
    .app-developer {
        font-size: 0.65rem;
    }
    
    .app-meta {
        margin-bottom: 5px;
    }
    
    .app-rating {
        font-size: 0.65rem;
    }
    
    .app-price {
        font-size: 0.7rem;
    }
    
    /* SMALLEST BUTTON SIZES FOR MOBILE */
    .btn-details {
        padding: 2px 5px;
        font-size: 0.6rem;
    }
    
    .btn-download {
        padding: 4px 6px;
        font-size: 0.7rem;
    }
}

/* Alert styles */
.alert {
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 0.85rem;
}

.alert-error {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

body.dark-mode .alert-error {
    background-color: rgba(198, 40, 40, 0.2);
    border-color: rgba(239, 154, 154, 0.3);
}

.no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 30px;
    color: var(--light-text);
    font-size: 1rem;
}

/* Payment specific styles */
.payment-status {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
    font-size: 0.85rem;
}

.payment-status.pending {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.payment-status.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.payment-status.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.retry-counter {
    font-size: 0.8em;
    margin-top: 8px;
    font-weight: 500;
}

/* Payment status styles */
.retry-counter {
    background: #0c5460;
    color: white;
    padding: 4px 8px;
    border-radius: 15px;
    display: inline-block;
    margin: 8px 0;
    font-weight: bold;
    font-size: 0.75rem;
}

.status-pending {
    background: #d1ecf1;
    color: #0c5460;
    padding: 12px;
    border-radius: 4px;
    margin: 12px 0;
}

.status-success {
    background: #d4edda;
    color: #155724;
    padding: 12px;
    border-radius: 4px;
    margin: 12px 0;
}

.status-error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 4px;
    margin: 12px 0;
}

/* Form error styles */
.error {
    color: #dc3545;
    font-size: 12px;
    margin-top: 4px;
}

.input-error {
    border-color: #dc3545 !important;
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}