:root {
    --primary: 220 90% 56%; /* #2563eb */
    --primary-dark: 220 90% 46%; /* #1d4ed8 */
    --secondary: 210 11% 98%; /* #f8fafc */
    --text-primary: 220 9% 46%; /* #64748b */
    --text-secondary: 220 9% 64%; /* #94a3b8 */
    --border-color: 220 13% 91%; /* #e2e8f0 */
    --success: 142 76% 36%; /* #16a34a */
    --warning: 45 93% 47%; /* #eab308 */
    --gradient-start: 220 90% 56%; /* #2563eb */
    --gradient-end: 267 90% 56%; /* #7c3aed */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: hsl(var(--text-primary));
    background-color: hsl(var(--secondary));
}

/* Header Styles */
.navbar {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.search-container {
    max-width: 400px;
    width: 100%;
}

@media (max-width: 768px) {
    .search-container {
        order: 3;
        margin-top: 1rem;
        margin-left: 0 !important;
    }
    
    .navbar-collapse {
        order: 2;
    }
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, hsl(var(--gradient-start)), hsl(var(--gradient-end)));
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" fill="white" opacity="0.1"><polygon points="0,0 1000,100 1000,0"/></svg>') no-repeat center bottom;
    background-size: cover;
}

/* App Cards */
.app-card {
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.app-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.app-icon-placeholder {
    height: 200px;
    background: linear-gradient(135deg, hsl(var(--gradient-start)), hsl(var(--gradient-end)));
    border-radius: 0.375rem 0.375rem 0 0;
}

.platform-badges .badge {
    font-size: 0.7rem;
    margin-left: 0.25rem;
}

.mod-features .badge {
    font-size: 0.75rem;
}

/* Category Filter */
.category-list li {
    margin-bottom: 0.5rem;
}

.category-list a {
    color: hsl(var(--text-primary));
    text-decoration: none;
    padding: 0.5rem;
    border-radius: 0.375rem;
    display: block;
    transition: all 0.3s ease;
}

.category-list a:hover,
.category-list a.active {
    background-color: hsl(var(--primary) / 0.1);
    color: hsl(var(--primary));
}

/* Trust Badges */
.trust-badges .badge {
    font-size: 1rem;
    padding: 0.75rem 1rem;
}

/* Footer */
footer a {
    text-decoration: none;
    transition: color 0.3s ease;
}

footer a:hover {
    color: hsl(var(--primary)) !important;
}

/* Button Styles */
.btn-primary {
    background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--primary-dark)));
    border: none;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* Mobile First - Base Mobile Styles */
@media (max-width: 575.98px) {
    /* Typography Adjustments */
    .hero-section .display-4 {
        font-size: 1.75rem;
        line-height: 1.2;
    }
    
    .hero-section .lead {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
    }
    
    .hero-section {
        padding: 2rem 0;
    }
    
    /* Trust Badges Mobile Layout */
    .trust-badges {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }
    
    .trust-badges .badge {
        margin-bottom: 0.5rem;
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
    }
    
    /* App Cards Mobile Optimization */
    .app-icon-placeholder {
        height: 120px;
    }
    
    .app-card {
        margin-bottom: 1rem;
    }
    
    .card-title {
        font-size: 1.1rem;
    }
    
    .card-text {
        font-size: 0.85rem;
    }
    
    /* Navigation Mobile Improvements */
    .navbar-brand span {
        font-size: 1.1rem;
    }
    
    .search-container {
        margin-top: 0.75rem;
        width: 100%;
    }
    
    .search-container .input-group {
        width: 100%;
    }
    
    .search-container .form-control {
        font-size: 0.9rem;
    }
    
    /* Sidebar Mobile */
    .category-list a {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    /* Buttons Mobile */
    .btn {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
    
    .btn-lg {
        font-size: 1rem;
        padding: 0.75rem 1.25rem;
    }
    
    /* Grid Spacing */
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    /* Modal Features Mobile */
    .mod-features .badge {
        font-size: 0.7rem;
        margin-bottom: 0.25rem;
    }
    
    /* Platform Badges */
    .platform-badges .badge {
        font-size: 0.65rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Tablet Portrait */
@media (min-width: 576px) and (max-width: 767.98px) {
    .hero-section .display-4 {
        font-size: 2.25rem;
    }
    
    .app-icon-placeholder {
        height: 160px;
    }
    
    .trust-badges {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Small Desktop */
@media (min-width: 768px) and (max-width: 991.98px) {
    .search-container {
        max-width: 350px;
    }
    
    .hero-section .display-4 {
        font-size: 2.5rem;
    }
}

/* Loading Animation */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Search Highlight */
.search-highlight {
    background-color: hsl(45 93% 85%);
    padding: 0.1rem 0.2rem;
    border-radius: 0.2rem;
}

/* Smooth Animations */
.app-item {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.app-item.hiding {
    opacity: 0;
    transform: scale(0.95);
}

/* Touch Optimization */
.app-card, .category-filter, .btn {
    touch-action: manipulation;
}

/* Mobile Touch Targets */
@media (max-width: 575.98px) {
    .btn, .category-filter, .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .navbar-toggler {
        padding: 0.5rem;
        border: none;
    }
    
    .form-control {
        min-height: 44px;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: hsl(var(--secondary));
}

::-webkit-scrollbar-thumb {
    background: hsl(var(--text-secondary));
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--text-primary));
}

/* Mobile Scrollbar */
@media (max-width: 575.98px) {
    ::-webkit-scrollbar {
        width: 4px;
    }
}

/* Focus States */
.form-control:focus {
    border-color: hsl(var(--primary));
    box-shadow: 0 0 0 0.2rem hsl(var(--primary) / 0.25);
}

/* Grid Layout Optimization */
.row.g-4 {
    margin-bottom: 2rem;
}

/* Mobile App Detail Pages */
@media (max-width: 575.98px) {
    /* App Header Mobile */
    .app-icon-large {
        width: 80px;
        height: 80px;
        margin-bottom: 1rem;
    }
    
    /* Screenshots Mobile */
    .screenshot-placeholder {
        height: 200px;
    }
    
    .swiper-button-next,
    .swiper-button-prev {
        display: none;
    }
    
    /* Download Section Mobile */
    .sticky-top {
        position: relative !important;
        top: auto !important;
    }
    
    /* Platform Selection Mobile */
    .platform-selection .btn-group {
        flex-direction: column;
    }
    
    .platform-selection .btn {
        border-radius: 0.375rem !important;
        margin-bottom: 0.5rem;
    }
    
    /* Trust Badges Small Mobile */
    .trust-badges-small .flex-fill {
        margin-bottom: 0.75rem;
    }
    
    /* Contact Form Mobile */
    .contact-hero {
        padding: 1.5rem 0;
    }
    
    .contact-hero .display-5 {
        font-size: 1.5rem;
    }
    
    /* Categories Mobile */
    .category-card {
        margin-bottom: 1rem;
    }
    
    .category-icon {
        margin-bottom: 1rem;
    }
    
    /* iOS/Android Hero Mobile */
    .ios-hero, .android-hero {
        padding: 1.5rem 0;
    }
    
    .ios-hero .display-5,
    .android-hero .display-5 {
        font-size: 1.5rem;
    }
    
    .ios-badges, .android-badges {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    /* Filter Sidebar Mobile */
    .col-lg-3 {
        order: 2;
    }
    
    .col-lg-9 {
        order: 1;
    }
    
    /* Stats Mobile */
    .hero-stats {
        flex-direction: column;
        gap: 1rem;
    }
    
    .stat-item {
        margin-bottom: 0.5rem;
    }
    
    /* Social Links Mobile */
    .social-links a {
        margin-right: 1rem !important;
        margin-bottom: 0.5rem;
        display: inline-block;
    }
}

/* Improved Mobile Navigation */
@media (max-width: 575.98px) {
    .navbar-collapse {
        background: rgba(37, 99, 235, 0.95);
        margin-top: 0.5rem;
        border-radius: 0.5rem;
        padding: 1rem;
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        border-radius: 0.375rem;
        margin-bottom: 0.25rem;
    }
    
    .navbar-nav .nav-link.active {
        background: rgba(255, 255, 255, 0.2);
    }
}

/* Mobile Form Improvements */
@media (max-width: 575.98px) {
    .form-control, .form-select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.75rem;
    }
    
    .input-group .form-control {
        border-radius: 0.375rem 0 0 0.375rem;
    }
    
    .input-group .btn {
        border-radius: 0 0.375rem 0.375rem 0;
        padding: 0.75rem 1rem;
    }
    
    /* Modal-like contact form on mobile */
    .card {
        border-radius: 1rem;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    }
}

/* Print Styles */
@media print {
    .navbar,
    .hero-section,
    footer {
        display: none;
    }
    
    .app-card {
        box-shadow: none;
        border: 1px solid hsl(var(--border-color));
    }
}
