:root {
    --bg-color: #0f172a; /* Tailwind slate-900 */
    --surface-color: #1e293b; /* Tailwind slate-800 */
    --text-primary: #f8fafc; /* Tailwind slate-50 */
    --text-secondary: #94a3b8; /* Tailwind slate-400 */
    --accent-color: #6366f1; /* Tailwind indigo-500 */
    --accent-hover: #4f46e5;
    --danger-color: #ef4444; /* Swipe Left */
    --success-color: #22c55e; /* Swipe Right */
    --border-radius: 16px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none; /* Prevent text selection while swiping */
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navigation */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

nav.hidden {
    display: none;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.nav-spacer {
    width: 80px; /* Balance the back button */
}

h1#nav-title {
    font-size: 1.2rem;
    font-weight: 800;
}

/* App Container */
#app-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.loader {
    text-align: center;
    margin-top: 2rem;
    color: var(--text-secondary);
}

/* Home View */
.home-view h2 {
    margin-bottom: 1.5rem;
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(to right, #a855f7, #6366f1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.gallery-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.gallery-card {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid rgba(255,255,255,0.05);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.gallery-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.gallery-card h3 {
    font-size: 1.2rem;
}

.gallery-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

.btn {
    flex: 1;
    padding: 0.8rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.2s;
}

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

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

.btn-secondary {
    background-color: rgba(255,255,255,0.1);
    color: white;
}

.btn-secondary:hover {
    background-color: rgba(255,255,255,0.2);
}

/* Gallery Grid View */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.image-item {
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    aspect-ratio: 1 / 1;
    background-color: var(--surface-color);
}

.image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.image-item:hover .image-overlay {
    opacity: 1;
}

.stats {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
}

.stats span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.stats .likes i { color: var(--success-color); }
.stats .dislikes i { color: var(--danger-color); }

.download-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    backdrop-filter: blur(5px);
    transition: background 0.2s;
}

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

/* Swipe View (Tinder Style) */
.swipe-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    height: calc(100vh - 150px);
}

.card-deck {
    position: relative;
    width: 100%;
    max-width: 400px;
    height: 60vh;
    max-height: 600px;
}

.swipe-card {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--surface-color);
    border-radius: 20px;
    box-shadow: 0 15px 30px rgba(0,0,0,0.3);
    overflow: hidden;
    transform-origin: 50% 100%;
    will-change: transform;
    display: flex;
    align-items: center;
    justify-content: center;
}

.swipe-card img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Cover is good for cards, but maybe contain to see full AI art? Let's use cover for Tinder style */
}

/* Like/Nope stamps */
.stamp {
    position: absolute;
    top: 40px;
    padding: 0.5rem 1rem;
    border: 4px solid;
    border-radius: 10px;
    font-size: 2rem;
    font-weight: 800;
    text-transform: uppercase;
    opacity: 0;
    z-index: 10;
}

.stamp.like {
    left: 40px;
    color: var(--success-color);
    border-color: var(--success-color);
    transform: rotate(-15deg);
}

.stamp.nope {
    right: 40px;
    color: var(--danger-color);
    border-color: var(--danger-color);
    transform: rotate(15deg);
}

/* Overlay controls on card */
.card-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 20;
}

.card-controls .download-btn {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    background: rgba(0,0,0,0.5);
}

/* Bottom Controls */
.swipe-controls {
    display: flex;
    gap: 2rem;
    margin-top: 2rem;
    z-index: 10;
}

.control-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    transition: transform 0.2s, box-shadow 0.2s;
    background-color: var(--surface-color);
}

.control-btn:active {
    transform: scale(0.9);
}

.btn-nope { color: var(--danger-color); }
.btn-like { color: var(--success-color); }

.end-of-deck {
    text-align: center;
    color: var(--text-secondary);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
}

/* Intro / Landing Page View */
.intro-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2rem;
    padding: 2rem 1rem;
    animation: fadeIn 0.5s ease;
}

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

.hero-image {
    width: 100%;
    max-width: 600px;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.1);
}

.intro-text h2 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(to right, #a855f7, #6366f1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.intro-text p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
    line-height: 1.6;
    margin: 0 auto 2rem auto;
}

.explore-btn {
    font-size: 1.2rem;
    padding: 1rem 2.5rem;
    border-radius: 50px;
    background: linear-gradient(135deg, var(--accent-color), #a855f7);
    color: white;
    border: none;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.explore-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 15px 25px rgba(99, 102, 241, 0.6);
}

.contact-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    width: 100%;
    max-width: 400px;
}

.contact-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    border: 1px solid rgba(255,255,255,0.1);
    transition: background 0.2s;
}

.contact-btn:hover {
    background: rgba(255,255,255,0.1);
}

.secret-counter {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    border: 1px solid var(--accent-color);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-family: monospace;
    font-size: 1.2rem;
    color: var(--accent-color);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.secret-counter.visible {
    opacity: 1;
    transform: translateY(0);
}

