/* 
    MTG Archives - Premium Liquid Glass Design System
    Vibrant Mesh Gradients, Modern Typography & Pro Animations
*/

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap');

:root {
    --primary: #8a2be2; /* Electric Purple */
    --primary-rgb: 138, 43, 226;
    --primary-glow: rgba(138, 43, 226, 0.5);
    --secondary: #00d4ff; /* Cyan */
    --secondary-rgb: 0, 212, 255;
    --background: #06080c;
    --glass: rgba(255, 255, 255, 0.03);
    --glass-heavy: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-blur: blur(25px);
    --liquid-gradient: linear-gradient(135deg, rgba(138, 43, 226, 0.3), rgba(0, 212, 255, 0.2));
    --text: #ffffff;
    --text-muted: #94a3b8;
    --success: #10b981;
    --danger: #ef4444;
    --transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    --radius: 20px;
}

/* 🖼 Professional Scaling (Fix Giant Cards) */
.thumb-card {
    width: 50px !important;
    height: 70px !important;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: var(--transition);
}

.thumb-card:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 15px rgba(var(--primary-rgb), 0.3);
}

/* Custom Dropdown Overlays (Replacement Tokens) */
.glass-select { position: relative; cursor: pointer; }
.glass-select-overlay {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: 100%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 10px;
    z-index: 100;
    display: none;
    box-shadow: 0 20px 40px rgba(0,0,0,0.6);
}
.glass-select.active .glass-select-overlay { display: block; animation: slideUp 0.3s ease-out; }

.basket-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    margin-bottom: 12px;
    border: 1px solid var(--glass-border);
    transition: var(--transition);
}

.basket-item:hover {
    background: rgba(var(--primary-rgb), 0.1);
    border-color: var(--primary);
}

.basket-item img {
    width: 50px;
    height: 70px;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.4);
}

.basket-item:hover {
    background: rgba(var(--primary-rgb), 0.1);
    border-color: var(--primary);
}

.edition-pick {
    cursor: pointer;
    transition: var(--transition);
    border-radius: 14px;
    padding: 8px;
    text-align: center;
    border: 1px solid transparent;
}

.edition-pick:hover {
    background: rgba(var(--primary-rgb), 0.1);
    border-color: var(--primary);
    transform: scale(1.05);
}

.basket-item-info { flex: 1; }
.remove-btn { 
    font-size: 1.5rem; 
    cursor: pointer; 
    opacity: 0.5; 
    transition: 0.2s; 
}
.remove-btn:hover { opacity: 1; color: var(--danger); }

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--background);
    background-image: 
        radial-gradient(circle at 0% 0%, rgba(138, 43, 226, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(0, 212, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(6, 8, 12, 1) 0%, transparent 100%);
    background-attachment: fixed;
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* 🌊 Liquid Mesh Overlays */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(138, 43, 226, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(0, 212, 255, 0.05) 0%, transparent 40%);
    z-index: -1;
    pointer-events: none;
}

/* 🌀 Global Loading Screen */
.global-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(6, 8, 12, 0.98);
    backdrop-filter: blur(25px);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease-out, visibility 0.6s ease-out;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.global-loader.show {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

.global-loader-logo {
    width: 150px;
    filter: drop-shadow(0 0 25px var(--primary-glow));
    animation: pulseLogo 2s infinite ease-in-out;
}

.global-loader-text {
    margin-top: 25px;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--text);
    text-transform: uppercase;
    animation: flashText 1.5s infinite alternate;
}

@keyframes pulseLogo {
    0% { transform: scale(1) translateY(0); filter: drop-shadow(0 0 15px var(--primary-glow)); }
    50% { transform: scale(1.05) translateY(-10px); filter: drop-shadow(0 0 35px var(--primary-glow)); }
    100% { transform: scale(1) translateY(0); filter: drop-shadow(0 0 15px var(--primary-glow)); }
}

@keyframes flashText {
    from { opacity: 0.5; text-shadow: 0 0 5px rgba(255,255,255,0.2); }
    to { opacity: 1; text-shadow: 0 0 15px rgba(255,255,255,0.8); }
}

/* Glass Panels */
.glass-panel {
    background: var(--glass);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* Navbar (Sticky & Glossy) */
.navbar {
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5%;
    background: rgba(6, 8, 12, 0.7);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 2000;
}

.nav-toggle {
    display: none; /* Hidden on desktop */
}

.nav-links {
    display: flex;
    gap: 30px;
    list-style: none;
    align-items: center;
}

.nav-links a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
    opacity: 0.7;
    padding: 8px 12px;
    border-radius: 10px;
}

.nav-links a:hover, .nav-links a.active {
    opacity: 1;
    color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
}

/* Form Elements & Inputs */
.input-field {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text);
    padding: 12px 18px;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
    backdrop-filter: blur(5px);
}

.input-field:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 15px rgba(var(--primary-rgb), 0.3);
}

select.input-field {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23ffffff' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
    appearance: none;
    -webkit-appearance: none;
}

select.input-field option {
    background: #06080c;
    color: #fff;
    padding: 10px;
}

/* Badges */
.badge {
    background: var(--primary);
    color: #fff;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: inline-block;
    vertical-align: middle;
}

.badge-qnt {
    background: linear-gradient(135deg, var(--primary), #9333ea);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Buttons (Premium Gradient & Glow) */
.btn {
    padding: 12px 28px;
    border-radius: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: inherit;
    font-size: 0.95rem;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #b026ff);
    color: white;
    box-shadow: 0 10px 25px rgba(138, 43, 226, 0.4);
    border: none;
}

.btn-success {
    background: var(--success);
    color: white;
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.4);
    border: none;
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 35px rgba(138, 43, 226, 0.6);
}

.btn-glass {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    border-color: var(--secondary);
}

#auth-logo {
    width: 140px;
    margin: 0 auto 15px auto;
    display: block;
    filter: drop-shadow(0 0 15px var(--primary-glow));
    transition: var(--transition);
}

#auth-logo:hover {
    transform: scale(1.05);
}

/* Grid & Cards */
.container {
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 20px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    transition: all 0.3s ease;
}

/* Dynamic Layout Grids */
.card-grid.grid-large {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}
.card-grid.grid-medium {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}
.card-grid.grid-small {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

/* Resize internals for smaller grids */
.grid-small .card-info h3 { font-size: 0.9rem; }
.grid-small .card-info p { font-size: 0.7rem; }
.grid-medium .card-info h3 { font-size: 1rem; }

/* List View */
.card-grid.grid-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.card-grid.grid-list .card {
    flex-direction: row;
    align-items: center;
    padding: 10px 20px;
    gap: 20px;
}
.card-grid.grid-list .card img {
    width: 60px;
    height: 85px;
    margin-bottom: 0;
    margin-right: 20px;
}
.card-grid.grid-list .card-info {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
}
.card-grid.grid-list .price-tag, .card-grid.grid-list .qty-badge {
    position: static;
    transform: none;
    background: transparent;
    border: none;
    box-shadow: none;
}
.card-grid.grid-list .price-tag {
    font-size: 1.1rem;
    font-weight: 700;
}

/* Filter Chips (Phase 8) */
.filter-chip {
    padding: 8px 12px;
    font-size: 0.8rem;
    font-weight: 700;
    opacity: 0.5;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.filter-chip:hover { opacity: 0.8; }
.filter-chip.active {
    opacity: 1;
    transform: scale(1.1);
    box-shadow: 0 0 10px var(--primary-glow);
    border-color: var(--primary);
}
.filter-chip[data-color="W"].active { border-color: #f8f6d8; box-shadow: 0 0 10px #f8f6d8; color: #fff;}
.filter-chip[data-color="U"].active { border-color: #c1d8e9; box-shadow: 0 0 10px #c1d8e9; color: #c1d8e9;}
.filter-chip[data-color="B"].active { border-color: #bab1ab; box-shadow: 0 0 10px #bab1ab; color: #bab1ab;}
.filter-chip[data-color="R"].active { border-color: #e49977; box-shadow: 0 0 10px #e49977; color: #e49977;}
.filter-chip[data-color="G"].active { border-color: #a3c095; box-shadow: 0 0 10px #a3c095; color: #a3c095;}
.filter-chip[data-color="C"] { width: auto; border-radius: 8px; }

/* Layout Controls */
.layout-btn.active {
    border-color: var(--secondary);
    background: rgba(var(--secondary-rgb), 0.2);
    transform: translateY(-2px);
}

.card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    padding: 20px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-10px);
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--primary);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.card img {
    width: 100%;
    border-radius: 20px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}

/* Header & Hero */
.hero-logo-container {
    padding: 80px 20px;
    text-align: center;
    position: relative;
}

.hero-logo {
    width: 450px;
    filter: drop-shadow(0 0 30px var(--primary-glow));
    animation: floating 6s ease-in-out infinite;
    margin-bottom: 30px;
}

@keyframes floating {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

/* Authentication Layout */
.auth-container {
    max-width: 450px;
    margin: 80px auto;
    padding: 40px;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(6, 8, 12, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: none;
    align-items: flex-start; /* Better for scrolling */
    justify-content: center;
    z-index: 5000 !important; /* SUPREME PRIORITY */
    overflow-y: auto; /* ENABLES SCROLLING */
    padding: 80px 0;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: #0f172a;
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    padding: 40px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.8);
    max-width: 90%;
}

/* Inputs */
.input-field {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 15px 22px;
    border-radius: 16px;
    color: white;
    font-family: inherit;
    transition: var(--transition);
}

.input-field:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.07);
    box-shadow: 0 0 20px var(--primary-glow);
}

/* Stats Cards */
.stat-card {
    background: var(--liquid-gradient);
    padding: 25px;
    border-radius: 20px;
    text-align: center;
    border: 1px solid var(--glass-border);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .container { margin: 100px auto 20px !important; }
    .card-grid { grid-template-columns: 1fr; }
    .hero-logo { width: 180px; }
    h1 { font-size: 2rem !important; }

    /* New Off-Canvas Mobile Nav */
    .navbar { 
        padding: 15px; 
        flex-direction: column; 
        align-items: flex-start; 
        position: fixed;
        top: 0;
        width: 100%;
        height: auto;
        z-index: 2000;
        backdrop-filter: blur(25px);
        background: rgba(6, 8, 12, 0.95);
        border-bottom: 1px solid var(--glass-border);
    }
    
    .nav-toggle {
        display: flex;
        flex-direction: column;
        gap: 6px;
        background: none;
        border: none;
        cursor: pointer;
        z-index: 2100;
    }
    
    .nav-toggle span {
        width: 30px;
        height: 3px;
        background: white;
        border-radius: 2px;
        transition: var(--transition);
    }
    
    .nav-toggle.active span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
    .nav-toggle.active span:nth-child(2) { opacity: 0; }
    .nav-toggle.active span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

    .nav-links { 
        display: none;
        flex-direction: column;
        width: 100%;
        margin-top: 20px;
        gap: 15px;
    }

    .nav-links.active {
        display: flex;
        animation: slideDown 0.3s ease-out;
    }

    .nav-brand {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100% !important;
    }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Animations */
.animate-fade {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.animate-fade.active {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* 💬 Modern Chat System Styles (Truly Floating) */
#chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 500px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    display: none; /* HIDDEN BY DEFAULT */
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.7);
    z-index: 3000;
    overflow: hidden;
    transition: var(--transition);
}

#chat-window.active {
    display: flex !important; /* SHOW ONLY WHEN ACTIVE */
    animation: slideUp 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

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

#chat-toggle {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #b026ff);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 10px 30px var(--primary-glow);
    z-index: 3001;
    transition: var(--transition);
}

#chat-toggle:hover {
    transform: scale(1.1) rotate(5deg);
}

.chat-header {
    background: linear-gradient(to right, var(--primary), #b026ff);
    padding: 18px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

#chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-input-area {
    padding: 20px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    gap: 10px;
    background: rgba(255,255,255,0.02);
}
/* 🟢 MTG Mana Dots (Premium Vivid) */
.mana-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    flex-shrink: 0;
    user-select: none;
}

.m-w { background: #f8f6d8; color: #444; box-shadow: 0 0 10px rgba(248, 246, 216, 0.4); } /* White */
.m-u { background: #0e68ab; box-shadow: 0 0 10px rgba(14, 104, 171, 0.4); } /* Blue */
.m-b { background: #150b00; box-shadow: 0 0 10px rgba(21, 11, 0, 0.6); }  /* Black */
.m-r { background: #d3202a; box-shadow: 0 0 10px rgba(211, 32, 42, 0.4); }  /* Red */
.m-g { background: #00733e; box-shadow: 0 0 10px rgba(0, 115, 62, 0.4); }  /* Green */
.m-c { background: #90adbb; box-shadow: 0 0 10px rgba(144, 173, 187, 0.4); } /* Colorless */

/* 🖼️ Premium Card Preview Modal */
.preview-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(15px);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    padding: 20px;
    cursor: pointer;
    animation: fadeIn 0.3s ease-out;
}

.preview-modal.active {
    display: flex;
}

.preview-content {
    max-width: 90%;
    max-height: 90vh;
    border-radius: 20px;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.9);
    transition: var(--transition);
    border: 1px solid rgba(255,255,255,0.1);
}

.preview-modal.active .preview-content {
    animation: zoomIn 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

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

/* 🔄 Flip System Styles */
.preview-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    cursor: default;
}

.btn-flip {
    background: linear-gradient(135deg, var(--primary), #b026ff);
    color: white;
    padding: 12px 30px;
    border-radius: 50px;
    font-weight: 700;
    box-shadow: 0 10px 25px var(--primary-glow);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.85rem;
}

.btn-flip:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 15px 35px var(--primary-glow);
}

.card-face-indicator {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    padding: 6px 12px;
    font-size: 0.7rem;
    font-weight: 800;
    color: white;
    z-index: 10;
    pointer-events: none;
    text-transform: uppercase;
    letter-spacing: 1px;
}
