/* Custom styles for MerlinRP */

:root {
    --primary: #a855f7; /* Purple 500 */
    --primary-dark: #9333ea; /* Purple 600 */
    --shop-gold: #f59e0b; /* Amber 500 */
    --bg-dark: #0f172a; /* Slate 900 */
    --bg-card: #1e293b; /* Slate 800 */
}

/* Base Styles */
body {
    background-color: #020617; /* Slate 950 */
    color: #f1f5f9; /* Slate 100 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

::selection {
    background-color: rgba(168, 85, 247, 0.3); /* Purple 500/30 */
    color: #c084fc; /* Purple 400 */
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

#page-wrapper.visible {
    opacity: 1 !important;
}

/* Global Reveal System */
.reveal-item {
    opacity: 0;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, opacity;
}

#page-wrapper.visible .reveal-item {
    opacity: 1;
    transform: translate(0) scale(1);
}

/* Animation Types */
.animate-fade-up { transform: translateY(30px); }
.animate-zoom-in { transform: scale(0.95); }
.animate-fade-in { transform: none; }

/* Staggered Delays */
.delay-100 { transition-delay: 100ms; }
.delay-200 { transition-delay: 200ms; }
.delay-300 { transition-delay: 300ms; }
.delay-400 { transition-delay: 400ms; }
.delay-500 { transition-delay: 500ms; }
.delay-700 { transition-delay: 700ms; }

/* Hero Background Pattern */
.hero-pattern {
    background-image: radial-gradient(circle at 2px 2px, rgba(168, 85, 247, 0.05) 1px, transparent 0);
    background-size: 24px 24px;
}

/* Enhanced Glassmorphism */
.glass {
    background-color: rgba(15, 23, 42, 0.4); /* Slate 900/40 */
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

#scroll-to-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

#scroll-to-top svg {
    filter: drop-shadow(0 0 8px rgba(168, 85, 247, 0.3));
}

/* Animations */
@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slide-down {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(0); }
}

@keyframes neon-purple-flow {
    0%, 100% { 
        border-color: rgba(168, 85, 247, 0.8); /* Purple 500 */
        box-shadow: 0 4px 15px rgba(168, 85, 247, 0.4);
    }
    33% { 
        border-color: rgba(139, 92, 246, 0.9); /* Violet 500 */
        box-shadow: 0 4px 20px rgba(139, 92, 246, 0.5);
    }
    66% { 
        border-color: rgba(192, 132, 252, 0.8); /* Purple 400 */
        box-shadow: 0 4px 15px rgba(192, 132, 252, 0.4);
    }
}

@keyframes border-scan {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(333%); } /* Adjusted for width */
}

@keyframes pulse-rings {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.4); opacity: 0; }
}

.pulse-container {
    position: relative;
    display: inline-flex;
    width: max-content;
}

.pulse-container::before,
.pulse-container::after {
    content: "";
    position: absolute;
    inset: 0;
    border: 2px solid #a855f7;
    border-radius: 0.75rem; /* Matches .btn border-radius */
    animation: pulse-rings 2s cubic-bezier(0.24, 0, 0.38, 1) infinite;
    z-index: 0;
    pointer-events: none;
}

.pulse-container::after {
    animation-delay: 1s;
}

.glass-header, .glass-header.scrolled {
    border-bottom: 2px solid rgba(168, 85, 247, 0.5);
    animation: neon-purple-flow 4s infinite ease-in-out;
    transition: all 0.5s ease-in-out;
}

.glass-header {
    background-color: rgba(2, 6, 23, 0.4); /* Slate 950/40 */
    backdrop-filter: blur(20px);
}

.glass-header.scrolled {
    background-color: rgba(15, 23, 42, 0.8); /* Slate 900/80 */
    backdrop-filter: blur(24px);
    padding-top: 1rem;
    padding-bottom: 1rem;
    animation: slide-down 0.5s ease-out, neon-purple-flow 4s infinite ease-in-out;
}

.glass-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 30%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(168, 85, 247, 0.6), transparent);
    animation: border-scan 3s infinite linear;
    pointer-events: none;
    z-index: 60;
}

/* Unified Button System */
.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    overflow: hidden;
    transition: all 0.3s ease;
    width: max-content;
    white-space: nowrap;
    padding: 0.75rem 2rem;
    border-radius: 0.75rem;
    z-index: 1;
    border: 2px solid transparent;
}

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

.btn-primary {
    background-color: var(--shop-gold);
    border-color: var(--shop-gold);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: #d97706; /* Amber 600 */
    border-color: #d97706;
    box-shadow: 0 10px 15px -3px rgba(245, 158, 11, 0.2);
    transform: translateY(-0.125rem);
}

.btn-discord {
    background-color: #a855f7; /* Purple 500 */
    border-color: #a855f7;
    color: #ffffff;
}

.btn-discord:hover {
    background-color: #9333ea; /* Purple 600 */
    border-color: #9333ea;
    box-shadow: 0 10px 15px -3px rgba(168, 85, 247, 0.2);
    transform: translateY(-0.125rem);
}

.btn-secondary {
    background-color: rgba(15, 23, 42, 0.4); /* Slate 900/40 */
    backdrop-filter: blur(12px);
    border-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.btn-secondary:hover, .btn-secondary.active {
    background-color: rgba(30, 41, 59, 0.6); /* Slate 800/60 */
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-0.125rem);
}

.btn-secondary.active {
    background-color: rgba(168, 85, 247, 0.2);
    border-color: rgba(168, 85, 247, 0.4);
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.2), inset 0 0 10px rgba(168, 85, 247, 0.1);
}

/* Mobile Dropdown Spacing */
#mobile-menu .btn-secondary {
    text-align: left;
    padding-left: 1.5rem;
}

#mobile-menu .btn-secondary.active {
    border-left: 4px solid #a855f7;
}

/* Shimmer Overlay */
.btn-shimmer {
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shimmer 4s infinite cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
    pointer-events: none;
}

.btn-secondary .btn-shimmer {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

@keyframes shimmer {
    100% { transform: translateX(100%); }
}

/* Icon Button Variant */
.btn-icon {
    padding: 0.75rem;
    border-radius: 0.75rem;
    background-color: rgba(30, 41, 59, 0.4); /* Slate 800/40 */
    color: #94a3b8; /* Slate 400 */
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.btn-icon:hover {
    color: #ffffff;
    background-color: rgba(51, 65, 85, 0.6); /* Slate 700/60 */
    border-color: rgba(255, 255, 255, 0.2);
}

/* Nav Link Hover Effect */
.nav-link {
    position: relative;
    color: #cbd5e1; /* Slate 300 */
    transition: all 0.3s ease;
    font-weight: 600;
    padding: 0.5rem 1rem;
    text-decoration: none;
    border-radius: 0.5rem;
}

.nav-link:hover, .nav-link.active {
    color: #ffffff;
}

.nav-link.active {
    background-color: rgba(168, 85, 247, 0.1);
    box-shadow: inset 0 0 10px rgba(168, 85, 247, 0.2);
    text-shadow: 0 0 8px rgba(168, 85, 247, 0.4);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 0.125rem;
    background-color: var(--primary);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::after, .nav-link.active::after {
    width: 80%;
}

.nav-link.active::after {
    background-color: #a855f7; /* Purple 500 for active */
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.8);
}

/* Scroll Indicator Animation */
@keyframes bounce-slow {
    0%, 100% { transform: translateY(-15%); animation-timing-function: cubic-bezier(0.8,0,1,1); }
    50% { transform: none; animation-timing-function: cubic-bezier(0,0,0.2,1); }
}

/* Global Custom Cursors */
html, body {
    cursor: url('../img/cursors/gta-pointer.svg') 7 2, auto;
}

a, button, [role="button"], .cursor-pointer, input[type="submit"], input[type="button"] {
    cursor: url('../img/cursors/gta-pointer.svg') 7 2, pointer !important;
}

/* 404 Terminal Animations */
.console-typewriter {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    width: 0;
    animation: terminal-typing 1s steps(40, end) forwards;
}

@keyframes terminal-typing {
    from { width: 0 }
    to { width: 100% }
}

.delay-line-1 { animation-delay: 0.5s; }
.delay-line-2 { animation-delay: 1.5s; }
.delay-line-3 { animation-delay: 2.5s; }
.delay-line-4 { animation-delay: 3.5s; }
.delay-line-5 { animation-delay: 4.5s; }
.delay-line-6 { animation-delay: 5.5s; }

.cursor-blink {
    animation: cursor-blink 1s step-end infinite;
}

@keyframes cursor-blink {
    from, to { border-color: transparent }
    50% { border-color: currentColor }
}

.glass-header::after {
    display: none;
}

/* Submenu System */
.submenu-dropdown {
    position: absolute;
    top: [calc(100%-0.5rem)];
    left: 0;
    margin-top: 0.5rem;
    width: 14rem; /* 56 in tailwind */
    border-radius: 0.75rem;
    padding: 0.5rem 0;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    z-index: 70;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Click Ripple Effect */
.click-ripple {
    position: fixed;
    width: 20px;
    height: 20px;
    background: rgba(168, 85, 247, 0.4);
    border: 2px solid rgba(168, 85, 247, 0.8);
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 9999;
    animation: ripple-effect 0.6s ease-out forwards;
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.5);
}

@keyframes ripple-effect {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }
    100% {
        width: 100px;
        height: 100px;
        opacity: 0;
    }
}

.submenu-dropdown::before {
    content: '';
    position: absolute;
    inset: -1.5px;
    background: conic-gradient(
        from 0deg,
        transparent 0%, 
        transparent 50%, 
        rgba(168, 85, 247, 0.8) 100%
    );
    animation: rotate-neon 4s linear infinite;
    z-index: -2;
    border-radius: 0.85rem;
}

.submenu-dropdown::after {
    content: '';
    position: absolute;
    inset: 1px;
    border-radius: 0.75rem;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(24px);
    z-index: -1;
}

/* Card System */
.card {
    position: relative;
    padding: 2rem;
    border-radius: 1rem;
    transition: all 0.5s ease;
    overflow: hidden;
    z-index: 10;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.card:hover {
    border-color: rgba(168, 85, 247, 0.4);
    transform: translateY(-8px);
    box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.5),
                0 0 20px rgba(168, 85, 247, 0.1);
}

.card::before {
    content: '';
    position: absolute;
    inset: -1.5px;
    opacity: 1;
    transition: all 0.5s ease;
    background: conic-gradient(
        from 0deg,
        transparent 0%, 
        transparent 50%, 
        rgba(168, 85, 247, 0.8) 100%
    );
    animation: rotate-neon 4s linear infinite;
    z-index: -2;
    border-radius: 1.15rem;
}

.card:hover::before {
    opacity: 1;
    background: conic-gradient(
        from 0deg,
        transparent 0%, 
        transparent 50%, 
        rgba(168, 85, 247, 0.95) 100%
    );
}

.card::after {
    content: '';
    position: absolute;
    inset: 1px;
    border-radius: 1rem;
    transition: background-color 0.5s ease;
    background: rgba(15, 23, 42, 0.95);
    z-index: -1;
}

@keyframes rotate-neon {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Portal Border Effect (for product cards and banners) */
.portal-border {
    position: relative;
    z-index: 10;
}

.portal-border::before {
    content: '';
    position: absolute;
    inset: -1.5px;
    background: conic-gradient(
        from 0deg,
        transparent 0%, 
        transparent 50%, 
        rgba(168, 85, 247, 0.8) 100%
    );
    animation: rotate-neon 4s linear infinite;
    z-index: -2;
    border-radius: inherit;
    transition: all 0.5s ease;
}

.portal-border::after {
    content: '';
    position: absolute;
    inset: 1px;
    border-radius: calc(inherit - 1px);
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    z-index: -1;
    transition: all 0.5s ease;
}

/* Banner Styles */
.banner-container {
    width: 100%;
    padding: 0 1rem;
    margin-top: 6rem; /* Space for fixed header */
    margin-bottom: -4rem; /* Offset for hero content */
    position: relative;
    z-index: 40;
}

.banner-wrapper {
    max-width: 80rem;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    text-decoration: none;
}

.banner-wrapper:hover {
    transform: translateY(-2px);
}

.banner-content {
    display: flex;
    items-center: center;
    gap: 0.75rem;
    font-weight: 600;
}

.banner-icon {
    font-size: 1.1rem;
}

.banner-text {
    font-size: 0.95rem;
}

.banner-arrow {
    font-size: 0.8rem;
    opacity: 0.5;
    transition: all 0.3s ease;
}

.banner-wrapper:hover .banner-arrow {
    opacity: 1;
    transform: translateX(4px);
}

/* Style Variants */
.banner-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.banner-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.banner-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.banner-critical {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.banner-neon {
    /* Portal border handled by .portal-border */
    color: #c084fc;
}

.portal-border:hover::before {
    background: conic-gradient(
        from 0deg,
        transparent 0%, 
        transparent 50%, 
        rgba(168, 85, 247, 0.95) 100%
    );
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.3);
}

.portal-border:hover::after {
    background: rgba(15, 23, 42, 0.9);
}

/* Stat Cards */
.card-stat {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background-color: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    transition: all 0.3s ease;
}

.card-stat:hover {
    border-color: rgba(168, 85, 247, 0.3);
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-0.25rem);
}

/* Chapter Neon Badges */
.chapter-badge {
    position: relative;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 1rem;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    overflow: hidden;
}

.chapter-badge span {
    font-size: 2.5rem;
    font-weight: 900;
    color: rgba(168, 85, 247, 0.2);
    transition: all 0.5s ease;
}

.chapter-badge::before {
    content: '';
    position: absolute;
    inset: -1.5px;
    background: conic-gradient(
        from 0deg,
        transparent 0%, 
        transparent 50%, 
        rgba(168, 85, 247, 0.8) 100%
    );
    animation: rotate-neon 4s linear infinite;
    z-index: -2;
    border-radius: 1.1rem;
    opacity: 1; /* Always visible */
    transition: all 0.5s ease;
}

.chapter-badge::after {
    content: '';
    position: absolute;
    inset: 1px;
    border-radius: 1rem;
    background: rgba(15, 23, 42, 0.95);
    z-index: -1;
    opacity: 1; /* Always visible */
    transition: opacity 0.5s ease;
}

.chapter-item.active .chapter-badge {
    transform: scale(1.1) rotate(-3deg);
    border-color: transparent;
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.3); /* Purple shadow */
}

.chapter-item.active .chapter-badge::before {
    background: conic-gradient(
        from 0deg,
        transparent 0%, 
        transparent 50%, 
        rgba(168, 85, 247, 0.95) 100%
    ); /* Purple gradient */
}

.chapter-item.active .chapter-badge span {
    color: #ffffff;
    text-shadow: 0 0 15px rgba(168, 85, 247, 0.8); /* Purple glow */
    transform: rotate(3deg);
}

.chapter-title {
    transition: all 0.5s ease;
}

.chapter-item.active .chapter-title {
    color: #ffffff;
    transform: translateX(10px);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background-color: #020617;
}

::-webkit-scrollbar-thumb {
    background-color: #1e293b;
    border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: #334155;
}

/* Pulse Animation for Connect Button */
.pulse-brand {
    animation: pulse-brand 2s infinite;
}

@keyframes pulse-brand {
    0% { box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(168, 85, 247, 0); }
    100% { box-shadow: 0 0 0 0 rgba(168, 85, 247, 0); }
}

/* Animated Purple Logo Glow */
.logo-glow {
    transition: all 0.3s ease-in-out;
}

.logo-glow:hover {
    transform: scale(1.2);
    filter: drop-shadow(0 0 15px rgba(168, 85, 247, 0.6)) 
            drop-shadow(0 0 20px rgba(168, 85, 247, 0.4));
}

@keyframes logo-purple-glow {
    0%, 100% {
        filter: drop-shadow(0 0 8px rgba(168, 85, 247, 0.4)) 
                drop-shadow(0 0 12px rgba(168, 85, 247, 0.2));
    }
    50% {
        filter: drop-shadow(0 0 15px rgba(168, 85, 247, 0.7)) 
                drop-shadow(0 0 25px rgba(168, 85, 247, 0.4));
    }
}

.logo-glow {
    animation: logo-purple-glow 3s ease-in-out infinite;
}

/* Footer Neon Border */
.footer-neon {
    position: relative;
    border-top: 2px solid rgba(168, 85, 247, 0.5);
    animation: neon-purple-flow 4s infinite ease-in-out;
    transition: all 0.5s ease-in-out;
    overflow: hidden; /* Fix horizontal scrollbar bug from border-scan animation */
}

.footer-neon::after {
    content: '';
    position: absolute;
    top: -2px; /* Align with top border */
    left: 0;
    width: 30%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(168, 85, 247, 0.6), transparent);
    animation: border-scan 3s infinite linear;
    pointer-events: none;
    z-index: 60;
}
