:root {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --background: #0b1120;
    --surface: #1e293b;
    --surface-hover: #334155;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --placeholder: #1e293b;
}

body, html {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.6;
    scroll-behavior: smooth;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .5; }
}

/* Typography */
h1, h2, h3, h4 {
    margin-top: 0;
    font-weight: 700;
    color: var(--text-main);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

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

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

/* Header */
.site-header {
    text-align: center;
    margin-bottom: 5rem;
    animation: fadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.site-header h1 {
    font-size: 3.5rem;
    letter-spacing: -0.03em;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.site-header p {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

/* Grid */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2.5rem;
}

/* Cards */
.widget-card {
    background-color: #121826;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 1rem;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    text-align: left;
    cursor: pointer;
    opacity: 0;
    animation: fadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.widget-card:nth-child(1) { animation-delay: 0.1s; }
.widget-card:nth-child(2) { animation-delay: 0.2s; }
.widget-card:nth-child(3) { animation-delay: 0.3s; }
.widget-card:nth-child(4) { animation-delay: 0.4s; }
.widget-card:nth-child(5) { animation-delay: 0.5s; }
.widget-card:nth-child(6) { animation-delay: 0.6s; }

.widget-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
}

.widget-cover {
    position: relative;
    height: 220px;
    background-color: var(--placeholder);
    overflow: hidden;
}

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

.widget-card:hover .widget-cover img {
    transform: scale(1.05);
}

.widget-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(45, 212, 191, 0.15);
    color: #2dd4bf;
    border: 1px solid rgba(45, 212, 191, 0.3);
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    backdrop-filter: blur(4px);
}

.widget-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.widget-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.widget-title {
    font-size: 1.5rem;
    margin: 0;
    color: #ffffff;
}

.widget-arrow {
    color: #2dd4bf;
    font-size: 1.25rem;
    transition: transform 0.2s ease;
}

.widget-card:hover .widget-arrow {
    transform: translate(2px, -2px);
}

.widget-subtitle {
    color: #2dd4bf;
    font-size: 1rem;
    font-weight: 500;
    margin: 0 0 1rem 0;
}

.widget-description {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.5;
    margin: 0 0 1.5rem 0;
    flex-grow: 1;
}

.widget-tags {
    display: flex;
    gap: 0.5rem;
}

.widget-tag {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.75rem;
    border-radius: 999px;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.39);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.23);
    transform: translateY(-2px);
    color: white;
}

.btn-outline {
    background-color: transparent;
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background-color: rgba(59, 130, 246, 0.05);
}

.mt-auto { margin-top: auto; }
.mb-8 { margin-bottom: 2rem; }

/* Detail Page specific styles */
.app-detail-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 5rem;
    animation: fadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 768px) {
    .app-detail-header {
        flex-direction: row;
        text-align: left;
        align-items: center;
        gap: 3rem;
    }
}

.app-detail-icon {
    width: 160px;
    height: 160px;
    border-radius: 22.5%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    margin-bottom: 2rem;
    background-color: var(--placeholder);
}

@media (min-width: 768px) {
    .app-detail-icon { margin-bottom: 0; }
}

.app-detail-info h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.app-developer {
    color: var(--text-muted);
    font-size: 1.125rem;
    margin-bottom: 1.5rem;
    display: block;
    font-weight: 500;
}

.app-detail-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

@media (min-width: 768px) {
    .app-detail-actions { justify-content: flex-start; }
}

.screenshots-container {
    margin-bottom: 5rem;
    animation: fadeIn 1s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

.screenshots-container h2 {
    margin-bottom: 2rem;
    font-size: 1.75rem;
    color: #fff;
}

.screenshots-scroll {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    padding-bottom: 1.5rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
    scroll-snap-type: x mandatory;
}

.screenshots-scroll::-webkit-scrollbar { height: 8px; }
.screenshots-scroll::-webkit-scrollbar-track { background: transparent; }
.screenshots-scroll::-webkit-scrollbar-thumb {
    background-color: rgba(255,255,255,0.2);
    border-radius: 4px;
}

/* Placeholder loading for screenshots */
.screenshot-wrapper {
    position: relative;
    height: 400px;
    min-width: 225px; /* approximate aspect ratio */
    border-radius: 1rem;
    background-color: var(--placeholder);
    overflow: hidden;
    scroll-snap-align: start;
    flex-shrink: 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.screenshot-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
    animation: pulse 2s infinite ease-in-out;
}

.screenshot-img {
    position: relative;
    z-index: 1;
    height: 100%;
    width: 100%;
    object-fit: contain;
    border-radius: 1rem;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.screenshot-img.loaded {
    opacity: 1;
}

.description-container {
    max-width: 800px;
    animation: fadeIn 1s cubic-bezier(0.16, 1, 0.3, 1) 0.4s both;
}

.description-container h2 {
    margin-bottom: 2rem;
    font-size: 1.75rem;
    color: #fff;
}

.app-description {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text-muted);
}

.app-description br {
    content: "";
    display: block;
    margin-bottom: 1rem;
}

/* Nav */
.site-nav {
    padding: 2rem 0;
    margin-bottom: 3rem;
}
.site-nav a {
    color: var(--text-muted);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: transform 0.2s ease, color 0.2s ease;
}
.site-nav a:hover {
    color: var(--text-main);
    transform: translateX(-4px);
}
