/* ==========================================
   Purrfect Match - Styles
   A cute, aesthetic cat swiping app
   ========================================== */

/* CSS Variables - Lavender Dream Theme 💜 */
:root {
    --bg-lavender: #F5F0FF;
    --bg-lilac: #EDE4FF;
    --bg-soft-pink: #FFF0F8;
    
    --card-white: #FFFFFF;
    
    --text-dark: #2D2640;
    --text-muted: #7A7089;
    
    --accent-purple: #A78BFA;
    --accent-violet: #8B5CF6;
    --accent-lavender: #C4B5FD;
    --accent-pink: #F0ABFC;
    --accent-grey: #D1D5DB;
    --accent-grey-dark: #9CA3AF;
    
    --shadow-soft: 0 4px 20px rgba(139, 92, 246, 0.08);
    --shadow-card: 0 10px 40px rgba(139, 92, 246, 0.12);
    
    --radius-md: 24px;
    --radius-lg: 32px;
}

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(160deg, var(--bg-lavender) 0%, var(--bg-lilac) 50%, var(--bg-soft-pink) 100%);
    background-attachment: fixed;
    color: var(--text-dark);
    min-height: 100%;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}

/* ==========================================
   ANIMATED BACKGROUND - Full Coverage
   ========================================== */
.animated-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

/* Floating Shapes - Hearts, Cats & Paws */
/* Already visible on screen, gentle floating motion */
.floating-shape {
    position: absolute;
    pointer-events: none;
    opacity: 0.35;
    animation: floatDrift 20s ease-in-out infinite;
}

/* Hearts - Purple color */
.floating-shape.heart {
    font-size: 24px;
    color: var(--accent-purple);
    text-shadow: 0 0 15px rgba(167, 139, 250, 0.4);
}

/* Cats - Subtle */
.floating-shape.cat {
    font-size: 28px;
    opacity: 0.3;
}

/* Paw prints - Small and subtle */
.floating-shape.paw {
    font-size: 18px;
    opacity: 0.28;
}

/* Vary sizes and animation timing for natural look */
.floating-shape:nth-child(1) { font-size: 22px; animation-duration: 18s; animation-delay: 0s; }
.floating-shape:nth-child(2) { font-size: 30px; animation-duration: 22s; animation-delay: -5s; }
.floating-shape:nth-child(3) { font-size: 16px; animation-duration: 20s; animation-delay: -10s; }
.floating-shape:nth-child(4) { font-size: 20px; animation-duration: 19s; animation-delay: -3s; }
.floating-shape:nth-child(5) { font-size: 32px; animation-duration: 24s; animation-delay: -8s; }

.floating-shape:nth-child(6) { font-size: 18px; animation-duration: 21s; animation-delay: -12s; }
.floating-shape:nth-child(7) { font-size: 26px; animation-duration: 17s; animation-delay: -2s; }
.floating-shape:nth-child(8) { font-size: 34px; animation-duration: 23s; animation-delay: -7s; }
.floating-shape:nth-child(9) { font-size: 20px; animation-duration: 19s; animation-delay: -15s; }

.floating-shape:nth-child(10) { font-size: 28px; animation-duration: 25s; animation-delay: -4s; }
.floating-shape:nth-child(11) { font-size: 24px; animation-duration: 18s; animation-delay: -11s; }
.floating-shape:nth-child(12) { font-size: 16px; animation-duration: 20s; animation-delay: -6s; }
.floating-shape:nth-child(13) { font-size: 22px; animation-duration: 22s; animation-delay: -14s; }

.floating-shape:nth-child(14) { font-size: 18px; animation-duration: 19s; animation-delay: -9s; }
.floating-shape:nth-child(15) { font-size: 30px; animation-duration: 21s; animation-delay: -1s; }
.floating-shape:nth-child(16) { font-size: 26px; animation-duration: 23s; animation-delay: -13s; }
.floating-shape:nth-child(17) { font-size: 32px; animation-duration: 17s; animation-delay: -16s; }

.floating-shape:nth-child(18) { font-size: 20px; animation-duration: 24s; animation-delay: -3s; }
.floating-shape:nth-child(19) { font-size: 14px; animation-duration: 20s; animation-delay: -8s; }
.floating-shape:nth-child(20) { font-size: 28px; animation-duration: 18s; animation-delay: -11s; }
.floating-shape:nth-child(21) { font-size: 24px; animation-duration: 22s; animation-delay: -5s; }

/* Gentle floating/drifting animation - always visible */
@keyframes floatDrift {
    0%, 100% {
        transform: translateY(0) translateX(0) rotate(0deg);
        opacity: 0.35;
    }
    25% {
        transform: translateY(-15px) translateX(8px) rotate(5deg);
        opacity: 0.4;
    }
    50% {
        transform: translateY(-25px) translateX(-5px) rotate(-3deg);
        opacity: 0.38;
    }
    75% {
        transform: translateY(-10px) translateX(10px) rotate(4deg);
        opacity: 0.4;
    }
}

/* Gradient Blobs - Full coverage, more visible */
.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.4;
    animation: blobMove 30s ease-in-out infinite;
}

.blob-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--accent-purple) 0%, transparent 70%);
    top: -200px;
    right: -150px;
}

.blob-2 {
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, var(--accent-pink) 0%, transparent 70%);
    bottom: -150px;
    left: -150px;
    animation-delay: -10s;
}

.blob-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--accent-violet) 0%, transparent 70%);
    top: 40%;
    right: -100px;
    animation-delay: -20s;
    opacity: 0.35;
}

.blob-4 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, var(--accent-lavender) 0%, transparent 70%);
    top: 20%;
    left: -100px;
    animation-delay: -15s;
    opacity: 0.35;
}

.blob-5 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--accent-purple) 0%, transparent 70%);
    bottom: 30%;
    right: 10%;
    animation-delay: -25s;
    opacity: 0.3;
}

@keyframes blobMove {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(40px, -30px) scale(1.1);
    }
    50% {
        transform: translate(-30px, 40px) scale(0.95);
    }
    75% {
        transform: translate(30px, 20px) scale(1.05);
    }
}

/* ==========================================
   APP CONTAINER
   ========================================== */
.app-container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    max-width: 420px;
    margin: 0 auto;
    padding: 16px 20px;
}

@media (min-width: 600px) {
    .app-container {
        max-width: 480px;
        padding: 24px 32px;
    }
}

@media (min-width: 1024px) {
    .app-container {
        max-width: 520px;
        padding: 32px 40px;
    }
}

/* ==========================================
   HEADER
   ========================================== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    flex-shrink: 0;
}

.logo {
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-violet) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.progress-indicator {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--card-white);
    padding: 10px 20px;
    border-radius: 25px;
    box-shadow: var(--shadow-soft);
}

@media (min-width: 600px) {
    .logo {
        font-size: 1.6rem;
    }
    
    .progress-indicator {
        font-size: 1rem;
        padding: 12px 24px;
    }
}

/* ==========================================
   CARD STACK
   ========================================== */
.card-stack {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    min-height: 450px;
    padding: 12px 0;
}

@media (min-width: 600px) {
    .card-stack {
        min-height: 520px;
        padding: 16px 0;
    }
}

@media (min-width: 1024px) {
    .card-stack {
        min-height: 580px;
        padding: 20px 0;
    }
}

/* ==========================================
   CAT CARD - Instagram-like Aesthetic
   ========================================== */
.cat-card {
    position: absolute;
    width: calc(100% - 40px);
    max-width: 380px;
    background: var(--card-white);
    border-radius: 28px;
    box-shadow: 
        0 4px 20px rgba(139, 92, 246, 0.1),
        0 8px 40px rgba(139, 92, 246, 0.08);
    overflow: hidden;
    cursor: grab;
    touch-action: none;
    transition: transform 0.3s ease, opacity 0.3s ease, box-shadow 0.3s ease;
    padding: 14px;
    display: flex;
    flex-direction: column;
}

.cat-card:active {
    cursor: grabbing;
}

/* Card Stack Depth */
.cat-card:nth-child(1) {
    z-index: 3;
}

.cat-card:nth-child(2) {
    z-index: 2;
    transform: scale(0.96) translateY(16px);
    opacity: 0.6;
}

.cat-card:nth-child(3) {
    z-index: 1;
    transform: scale(0.92) translateY(32px);
    opacity: 0.3;
}

.cat-card:nth-child(n+4) {
    display: none;
}

/* Tablet */
@media (min-width: 600px) {
    .cat-card {
        width: calc(100% - 60px);
        max-width: 420px;
        padding: 16px;
        border-radius: 32px;
    }
    
    .cat-card:nth-child(2) {
        transform: scale(0.96) translateY(20px);
    }
    
    .cat-card:nth-child(3) {
        transform: scale(0.92) translateY(40px);
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .cat-card {
        max-width: 450px;
        padding: 18px;
    }
}

/* Image Frame - Square with rounded corners */
.cat-card .image-frame {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 20px;
    overflow: hidden;
    background: linear-gradient(135deg, #fafafa 0%, #f0f0f0 100%);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.04);
}

.cat-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    display: block;
}

/* Card Info - Below the image */
.card-info {
    padding: 16px 8px 8px;
    text-align: center;
}

.card-info h3 {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 6px;
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-violet) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.3px;
}

.card-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    line-height: 1.4;
}

@media (min-width: 600px) {
    .cat-card .image-frame {
        border-radius: 24px;
    }
    
    .card-info {
        padding: 18px 10px 10px;
    }
    
    .card-info h3 {
        font-size: 1.5rem;
        margin-bottom: 8px;
    }
    
    .card-info p {
        font-size: 0.9rem;
    }
}

/* Card Swipe Indicators - HIDDEN (only use center indicator) */
.card-indicator {
    display: none;
}

/* Hover effect for desktop */
@media (hover: hover) {
    .cat-card:nth-child(1):hover {
        box-shadow: 
            0 8px 30px rgba(139, 92, 246, 0.15),
            0 16px 60px rgba(139, 92, 246, 0.1);
    }
}

/* Swipe Out Animations */
.cat-card.swipe-out-right {
    transform: translateX(150%) rotate(30deg) !important;
    opacity: 0 !important;
    transition: transform 0.4s ease, opacity 0.3s ease !important;
}

.cat-card.swipe-out-left {
    transform: translateX(-150%) rotate(-30deg) !important;
    opacity: 0 !important;
    transition: transform 0.4s ease, opacity 0.3s ease !important;
}

/* Undo Animation - Card slides back in */
.cat-card.undo-enter {
    animation: undoSlideIn 0.3s ease-out;
}

@keyframes undoSlideIn {
    0% {
        transform: translateY(-50px) scale(0.9);
        opacity: 0;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* ==========================================
   ACTION BUTTONS
   ========================================== */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 32px;
    padding: 20px 0 24px;
    flex-shrink: 0;
}

.action-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    background: var(--card-white);
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.action-btn:hover {
    transform: scale(1.1);
}

.action-btn:active {
    transform: scale(0.95);
}

/* Undo button - smaller, on the left */
.undo-btn {
    width: 52px;
    height: 52px;
    font-size: 1.3rem;
    opacity: 0.5;
    transition: opacity 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.undo-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none !important;
}

.undo-btn:not(:disabled):hover {
    opacity: 1;
    background: #f0f0ff;
    box-shadow: 0 4px 16px rgba(167, 139, 250, 0.2);
}

.dislike-btn:hover {
    background: #f5f5f5;
}

.like-btn:hover {
    background: #f8f5ff;
    box-shadow: 0 6px 24px rgba(167, 139, 250, 0.35);
}

@media (min-width: 600px) {
    .action-buttons {
        gap: 40px;
        padding: 24px 0 32px;
    }
    
    .action-btn {
        width: 72px;
        height: 72px;
        font-size: 1.8rem;
    }
}

/* ==========================================
   SWIPE INDICATOR (Center Screen - Only One!)
   ========================================== */
.swipe-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    opacity: 0;
    pointer-events: none;
    z-index: 100;
    transition: opacity 0.2s ease;
}

.swipe-indicator.show-like {
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-violet));
    box-shadow: 0 8px 32px rgba(167, 139, 250, 0.5);
    opacity: 1;
    animation: pulseIn 0.3s ease;
}

.swipe-indicator.show-dislike {
    background: linear-gradient(135deg, var(--accent-grey), var(--accent-grey-dark));
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    opacity: 1;
    animation: pulseIn 0.3s ease;
}

@keyframes pulseIn {
    0% { transform: translate(-50%, -50%) scale(0.5); }
    60% { transform: translate(-50%, -50%) scale(1.1); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

/* ==========================================
   LOADING SCREEN
   ========================================== */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(160deg, var(--bg-lavender) 0%, var(--bg-lilac) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    z-index: 1000;
    transition: opacity 0.4s ease;
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(167, 139, 250, 0.25);
    border-top-color: var(--accent-purple);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-screen p {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* ==========================================
   SUMMARY SCREEN
   ========================================== */
.summary-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(160deg, var(--bg-lavender) 0%, var(--bg-lilac) 50%, var(--bg-soft-pink) 100%);
    z-index: 500;
    overflow-y: auto;
    transition: opacity 0.4s ease;
}

.summary-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.summary-content {
    max-width: 420px;
    margin: 0 auto;
    padding: 40px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

@media (min-width: 600px) {
    .summary-content {
        max-width: 500px;
        padding: 48px 32px;
    }
}

.summary-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 32px;
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-violet) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
}

.summary-stats {
    margin-bottom: 32px;
}

.stat-circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: var(--card-white);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.stat-number {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-violet));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.stat-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ==========================================
   LIKED GALLERY
   ========================================== */
.liked-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    width: 100%;
    margin-bottom: 32px;
}

@media (min-width: 600px) {
    .liked-gallery {
        gap: 16px;
    }
}

.liked-gallery-item {
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    animation: fadeInUp 0.4s ease forwards;
    opacity: 0;
    position: relative;
}

.liked-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.liked-cat-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 6px;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 100%);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
}

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

/* Stagger animation */
.liked-gallery-item:nth-child(1) { animation-delay: 0.1s; }
.liked-gallery-item:nth-child(2) { animation-delay: 0.15s; }
.liked-gallery-item:nth-child(3) { animation-delay: 0.2s; }
.liked-gallery-item:nth-child(4) { animation-delay: 0.25s; }
.liked-gallery-item:nth-child(5) { animation-delay: 0.3s; }
.liked-gallery-item:nth-child(6) { animation-delay: 0.35s; }
.liked-gallery-item:nth-child(7) { animation-delay: 0.4s; }
.liked-gallery-item:nth-child(8) { animation-delay: 0.45s; }
.liked-gallery-item:nth-child(9) { animation-delay: 0.5s; }
.liked-gallery-item:nth-child(10) { animation-delay: 0.55s; }
.liked-gallery-item:nth-child(11) { animation-delay: 0.6s; }
.liked-gallery-item:nth-child(12) { animation-delay: 0.65s; }

.no-likes-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 1rem;
}

.no-likes-message span {
    font-size: 3.5rem;
    display: block;
    margin-bottom: 16px;
}

/* ==========================================
   RESTART BUTTON
   ========================================== */
.restart-btn {
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-violet) 100%);
    color: white;
    border: none;
    padding: 16px 48px;
    border-radius: 50px;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 28px rgba(139, 92, 246, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.restart-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 36px rgba(139, 92, 246, 0.5);
}

.restart-btn:active {
    transform: translateY(0);
}

/* ==========================================
   SMALL SCREEN HEIGHT
   ========================================== */
@media (max-height: 750px) {
    .header {
        padding-bottom: 12px;
    }
    
    .card-stack {
        min-height: 340px;
        padding: 8px 0;
    }
    
    .cat-card {
        max-width: 320px;
        padding: 12px;
        border-radius: 24px;
    }
    
    .cat-card .image-frame {
        border-radius: 18px;
    }
    
    .card-info {
        padding: 14px 8px 8px;
    }
    
    .card-info h3 {
        font-size: 1.25rem;
    }
    
    .card-info p {
        font-size: 0.82rem;
    }
    
    .action-buttons {
        padding: 12px 0 16px;
        gap: 28px;
    }
    
    .action-btn {
        width: 58px;
        height: 58px;
        font-size: 1.5rem;
    }
}

/* Very small height */
@media (max-height: 650px) {
    .card-stack {
        min-height: 280px;
    }
    
    .cat-card {
        max-width: 280px;
        padding: 10px;
    }
    
    .card-info {
        padding: 12px 6px 6px;
    }
    
    .card-info h3 {
        font-size: 1.15rem;
        margin-bottom: 4px;
    }
    
    .card-info p {
        font-size: 0.78rem;
    }
    
    .action-buttons {
        padding: 10px 0 12px;
        gap: 24px;
    }
    
    .action-btn {
        width: 52px;
        height: 52px;
        font-size: 1.3rem;
    }
}

/* ==========================================
   UTILITY
   ========================================== */
.hidden {
    display: none !important;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .floating-heart,
    .blob {
        animation: none;
    }
    
    * {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
