/* 
 * UI Theme based on provided style (Image 2.png)
 * Deep teal/dark green palette with high contrast and serif headings.
 */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400..900;1,400..900&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Color Palette */
    --bg-primary: #001a1a;
    --bg-secondary: #002626;
    --bg-card: rgba(0, 43, 43, 0.4);
    --bg-card-hover: rgba(0, 59, 59, 0.6);
    --accent: #00ffcc; /* Teal */
    --accent-orange: #ff8a00; /* Get Started button color from image */
    --accent-dark: #00ccaa;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.4);
    --border: rgba(255, 255, 255, 0.1);
    --border-hover: rgba(255, 255, 255, 0.2);
    
    /* Rarity Colors */
    --rarity-common: #94a3b8;
    --rarity-rare: #3b82f6;
    --rarity-epic: #a855f7;
    --rarity-legendary: #f59e0b;
    --rarity-mythic: #ef4444;

    /* Fonts */
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Inter', sans-serif;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 50% -20%, rgba(0, 255, 204, 0.05), transparent 70%),
        radial-gradient(circle at 80% 80%, rgba(0, 255, 204, 0.03), transparent 50%);
}

/* Background Wave/Texture Pattern */
.bg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    opacity: 0.15;
    background-image: url("data:image/svg+xml,%3Csvg width='100%25' height='100%25' viewBox='0 0 1000 1000' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0,500 C200,400 300,600 500,500 C700,400 800,600 1000,500 L1000,1000 L0,1000 Z' fill='%2300ffcc' fill-opacity='0.1'/%3E%3C/svg%3E");
    background-size: 200% 100%;
    animation: waveBackground 60s linear infinite;
}

@keyframes waveBackground {
    from { background-position: 0% 0%; }
    to { background-position: -200% 0%; }
}

/* Grid Pattern */
.bg-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    background-image: 
        linear-gradient(rgba(0, 255, 204, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 204, 0.03) 1px, transparent 1px);
    background-size: 80px 80px;
}

/* Navigation */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 1.5rem 4rem;
    background: rgba(0, 26, 26, 0.8);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--border);
}

.nav-content {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 1.5rem;
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: -1px;
    justify-self: start;
}

.logo-icon {
    display: none; /* In the style image, the logo is text-based or minimal */
}

.nav-links {
    display: flex;
    gap: 2.5rem;
    align-items: center;
    justify-self: center;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.3s ease;
    text-transform: capitalize;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text-primary);
}

.nav-links a.active {
    position: relative;
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: var(--accent);
}

.user-stats {
    display: flex;
    align-items: center;
    justify-self: end;
    justify-content: flex-end;
    min-width: 320px;
    gap: 0.75rem;
}

/* Get Started / Primary Action Button */
.btn-get-started {
    background-color: var(--accent-orange);
    color: white;
    padding: 0.6rem 1.4rem;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-get-started:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 138, 0, 0.3);
}

/* Main Container */
main {
    padding-top: 120px;
    padding-bottom: 80px;
}

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

/* Typography Overrides */
h1, h2, h3 {
    font-family: var(--font-heading);
    font-weight: 500;
}

.page-title {
    text-align: center;
    margin-bottom: 5rem;
}

.page-title h1 {
    font-size: 5rem;
    margin-bottom: 1.5rem;
    letter-spacing: -2px;
}

.page-title p {
    color: var(--text-secondary);
    font-size: 1.2rem;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Section Categories (Small All-Caps Label) */
.section-category {
    text-align: center;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 2.5px;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-weight: 700;
}

/* Card Grid Styles */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

/* Generic Card Style based on Image */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2.5rem 1.5rem;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.card:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 0%, rgba(0, 255, 204, 0.1), transparent 70%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.card:hover::before {
    opacity: 1;
}

.card-title {
    font-family: var(--font-body);
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.card-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    min-height: 3rem;
}

.card-badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    padding: 0.3rem 1rem;
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Draw Machine Specifics */
.draw-machine {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
}

.card-stage {
    perspective: 1500px;
    width: 320px;
    height: 450px;
}

.card-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 16px;
    border: 1px solid var(--border);
}

.card-back {
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotateY(0deg);
}

.card-front {
    background: var(--bg-card-hover);
    transform: rotateY(180deg);
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.card-wrapper.flipping {
    transform: rotateY(180deg);
}

/* Probability List */
.probability-section {
    margin-top: 6rem;
}

.rarity-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.rarity-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 1.5rem;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.rarity-name {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
}

.rarity-chance {
    font-size: 1.8rem;
    font-family: var(--font-heading);
    color: var(--accent);
}

/* Buttons */
.btn {
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.btn-primary {
    background-color: var(--accent);
    color: var(--bg-primary);
    padding: 1rem 2.5rem;
    font-size: 1rem;
}

.btn-primary:hover {
    background-color: white;
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 255, 204, 0.3);
}

.btn-secondary {
    background-color: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 1rem 2.5rem;
    font-size: 1rem;
}

.btn-secondary:hover {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.05);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 26, 26, 0.9);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    padding: 4rem;
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    text-align: center;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.4s ease;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Collection Grid */
.collection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
}

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

.animate-fade-in {
    animation: fadeIn 0.8s ease forwards;
}

/* Footer */
footer {
    padding: 80px 0;
    border-top: 1px solid var(--border);
    background: var(--bg-primary);
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
    gap: 4rem;
}

.footer-logo-side {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.footer-logo {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
}

.footer-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: #00ffcc;
    border-radius: 50%;
    box-shadow: 0 0 10px #00ffcc;
}

.footer-column h4 {
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.footer-column ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.footer-column a {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: color 0.3s ease;
}

.footer-column a:hover {
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 1024px) {
    .page-title h1 { font-size: 4rem; }
    .footer-content { grid-template-columns: 1fr 1fr 1fr; }
}

@media (max-width: 768px) {
    nav { padding: 1rem 2rem; }
    .nav-content {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }
    .logo {
        justify-self: center;
        text-align: center;
    }
    .nav-links {
        display: flex;
        width: 100%;
        justify-content: center;
        gap: 0.5rem;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        padding-bottom: 0.25rem;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .nav-links::-webkit-scrollbar {
        display: none;
    }
    .nav-links a {
        flex: 0 0 auto;
        padding: 0.45rem 0.85rem;
        border: 1px solid var(--border);
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.04);
        font-size: 0.85rem;
        text-align: center;
    }
    .nav-links a.active::after {
        display: none;
    }
    .user-stats {
        min-width: auto;
        gap: 0.5rem;
        width: 100%;
        justify-self: stretch;
        justify-content: center;
        flex-wrap: wrap;
    }
    .page-title h1 { font-size: 3rem; }
    .footer-content { grid-template-columns: 1fr 1fr; }
}

/* Avoid nav auth-state flicker while session is restoring */
body.auth-pending .user-stats {
    visibility: hidden;
    pointer-events: none;
}

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