/* ==========================================
   CSS Variables for Easy Theming
   ========================================== */
:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #a855f7;
    --accent-color: #ec4899;
    --background-dark: #0f172a;
    --background-card: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --border-color: #334155;
    --success-color: #10b981;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
    --max-width: 1280px;
}

/* ==========================================
   Base Styles & Reset
   ========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: linear-gradient(135deg, var(--background-dark) 0%, #1a1f3a 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Smooth page load animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

main {
    animation: fadeInUp 0.6s ease-out;
}

/* ==========================================
   Header & Navigation
   ========================================== */
header {
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 2rem;
}

header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.025em;
    transition: transform var(--transition-fast);
}

header h1:hover {
    transform: scale(1.02);
}

nav ul {
    list-style: none;
    display: flex;
    gap: 2rem;
    align-items: center;
}

nav ul li a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all var(--transition-base);
    position: relative;
}

nav ul li a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 80%;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: transform var(--transition-base);
}

nav ul li a:hover {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.1);
}

nav ul li a:hover::after {
    transform: translateX(-50%) scaleX(1);
}

/* ==========================================
   Main Content Area
   ========================================== */
main {
    flex: 1;
    width: 100%;
}

/* Scroll indicator for better UX */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* ==========================================
   App Catalog Section
   ========================================== */
.catalog {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    max-width: var(--max-width);
    margin: 3rem auto;
    padding: 0 2rem;
}

/* Stagger animation for app cards */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.app-card {
    position: relative;
    background: var(--background-card);
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: all var(--transition-base);
    cursor: pointer;
    aspect-ratio: 9/16;
    animation: fadeInScale 0.5s ease-out backwards;
}

/* Stagger delay for each card */
.app-card:nth-child(1) { animation-delay: 0.1s; }
.app-card:nth-child(2) { animation-delay: 0.2s; }
.app-card:nth-child(3) { animation-delay: 0.3s; }
.app-card:nth-child(4) { animation-delay: 0.4s; }
.app-card:nth-child(5) { animation-delay: 0.5s; }
.app-card:nth-child(6) { animation-delay: 0.6s; }

.app-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 1rem;
    padding: 2px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color), var(--accent-color));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.app-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(99, 102, 241, 0.2);
}

.app-card:hover::before {
    opacity: 1;
}

.app-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: all var(--transition-slow);
}

.app-card:hover .app-background {
    filter: blur(4px) brightness(0.6);
    transform: scale(1.05);
}

.app-info {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    gap: 0.75rem;
    opacity: 0;
    transform: translateY(20px);
    transition: all var(--transition-base);
    z-index: 10;
    background: rgba(15, 23, 42, 0.3);
}

.app-card:hover .app-info {
    opacity: 1;
    transform: translateY(0);
}

.app-info h2 {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.app-store-link,
.play-market-link,
.policy {
    display: inline-block;
    width: 100%;
    max-width: 200px;
    text-align: center;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    transition: all var(--transition-base);
    border: none;
}

.app-store-link {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.app-store-link:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.6);
    transform: translateY(-2px);
}

.play-market-link {
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.play-market-link:hover {
    background: linear-gradient(135deg, #059669, var(--success-color));
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.6);
    transform: translateY(-2px);
}

.policy {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
}

.policy:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

/* ==========================================
   About & Contact Sections
   ========================================== */
#about, #contact {
    max-width: var(--max-width);
    margin: 3rem auto;
    padding: 3rem 2rem;
}

#about h2, #contact h2 {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.content-container {
    max-width: 800px;
    margin: 0 auto;
    background: var(--background-card);
    padding: 3rem;
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.6s ease-out 0.2s backwards;
}

.content-container p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

.content-container p:last-child {
    margin-bottom: 0;
}

#contact p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

#contact p:first-of-type {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ==========================================
   Legal Pages (Privacy & Terms)
   ========================================== */
#privacy, #terms {
    max-width: var(--max-width);
    margin: 3rem auto;
    padding: 3rem 2rem;
}

#privacy h2, #terms h2 {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#privacy h3, #terms h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

#privacy ul, #terms ul {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

#privacy li, #terms li {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    line-height: 1.8;
}

#privacy a, #terms a {
    color: var(--primary-light);
    text-decoration: none;
    transition: color var(--transition-fast);
}

#privacy a:hover, #terms a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

.highlight {
    color: var(--primary-light);
    font-weight: 500;
}

/* ==========================================
   Footer
   ========================================== */
footer {
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-top: auto;
}

footer p {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

footer a {
    color: var(--primary-light);
    text-decoration: none;
    transition: color var(--transition-fast);
    font-weight: 500;
}

footer a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* ==========================================
   Responsive Design
   ========================================== */
@media (max-width: 768px) {
    .header-content {
        padding: 0 1rem;
    }
    
    header h1 {
        font-size: 1.25rem;
    }
    
    nav ul {
        gap: 1rem;
    }
    
    nav ul li a {
        padding: 0.4rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .catalog {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 1.5rem;
        padding: 0 1rem;
        margin: 2rem auto;
    }
    
    .app-info h2 {
        font-size: 1.25rem;
    }
    
    .content-container {
        padding: 2rem 1.5rem;
    }
    
    #about h2, #contact h2, #privacy h2, #terms h2 {
        font-size: 2rem;
    }
    
    #about, #contact, #privacy, #terms {
        padding: 2rem 1rem;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.1rem;
    }
    
    nav ul {
        gap: 0.5rem;
    }
    
    nav ul li a {
        padding: 0.3rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .catalog {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    
    .app-info {
        padding: 1.5rem;
    }
    
    .app-info h2 {
        font-size: 1.1rem;
    }
    
    .content-container {
        padding: 1.5rem 1rem;
    }
    
    #about h2, #contact h2, #privacy h2, #terms h2 {
        font-size: 1.75rem;
    }
}

/* ==========================================
   Accessibility & Focus States
   ========================================== */
*:focus-visible {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
    border-radius: 0.25rem;
}

/* ==========================================
   Selection Styling
   ========================================== */
::selection {
    background-color: var(--primary-color);
    color: var(--text-primary);
}

::-moz-selection {
    background-color: var(--primary-color);
    color: var(--text-primary);
}

/* ==========================================
   Scrollbar Styling (Webkit)
   ========================================== */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--background-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 6px;
    border: 2px solid var(--background-dark);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}

/* ==========================================
   Print Styles
   ========================================== */
@media print {
    header, footer {
        display: none;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .app-card {
        page-break-inside: avoid;
    }
}
