/* ============================================================================
   Monkey Network - Modern Enhanced CSS
   Free Discord Bot Hosting Landing Page
   ============================================================================ */

/* CSS Variables for Dynamic Theme Control */
:root {
    --discord-blurple: #5865F2;
    --discord-dark: #23272A;
    --discord-darker: #2C2F33;
    --discord-darkest: #1e2124;
    --discord-green: #57F287;
    --discord-red: #ED4245;
    --discord-yellow: #FEE75C;

    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.6s ease;

    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.25);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.35);
    --shadow-glow: 0 0 20px rgba(88, 101, 242, 0.4);
}

/* ============================================================================
   Modern Scrollbar with Gradient
   ============================================================================ */
::-webkit-scrollbar {
    width: 14px;
}

::-webkit-scrollbar-track {
    background: var(--discord-darkest);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--discord-blurple) 0%, #4752C4 100%);
    border-radius: 10px;
    border: 2px solid var(--discord-darkest);
    transition: var(--transition-normal);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #6B76FF 0%, var(--discord-blurple) 100%);
    box-shadow: var(--shadow-glow);
}

/* ============================================================================
   Base Styles & Smooth Animations
   ============================================================================ */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px; /* Account for sticky nav */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* ============================================================================
   Enhanced Focus States for Accessibility
   ============================================================================ */
*:focus-visible {
    outline: 3px solid var(--discord-blurple);
    outline-offset: 3px;
    border-radius: 4px;
}

a:focus-visible,
button:focus-visible {
    outline-offset: 4px;
}

/* ============================================================================
   Screen Reader Only Content
   ============================================================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.sr-only:focus,
.sr-only:active {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* ============================================================================
   Smooth Transitions for All Interactive Elements
   ============================================================================ */
a, button, input, textarea, select, details summary {
    transition: all var(--transition-normal);
}

/* ============================================================================
   Enhanced Link Styles with Underline Animation
   ============================================================================ */
a:not(.no-underline-animation) {
    position: relative;
    text-decoration: none;
}

a:not(.no-underline-animation)::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--discord-blurple), #7289DA);
    transition: width var(--transition-normal);
}

a:not(.no-underline-animation):hover::after,
a:not(.no-underline-animation):focus::after {
    width: 100%;
}

/* ============================================================================
   Modern Card Hover Effects with 3D Transform
   ============================================================================ */
.card-hover {
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    will-change: transform;
}

.card-hover:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
}

/* ============================================================================
   Gradient Text Effect
   ============================================================================ */
.gradient-text {
    background: linear-gradient(135deg, var(--discord-blurple) 0%, #7289DA 50%, #00D4FF 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% 200%;
    animation: gradient-shift 5s ease infinite;
}

@keyframes gradient-shift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

/* ============================================================================
   Fade In Animations for Content
   ============================================================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.fade-in {
    animation: fadeIn var(--transition-slow) ease-out forwards;
}

.fade-in-up {
    animation: fadeInUp var(--transition-slow) ease-out forwards;
}

/* Staggered animations for list items */
.stagger-animation > * {
    animation: fadeInUp 0.6s ease-out forwards;
    opacity: 0;
}

.stagger-animation > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-animation > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-animation > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-animation > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-animation > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-animation > *:nth-child(6) { animation-delay: 0.6s; }

/* ============================================================================
   Pulse Animation for CTAs
   ============================================================================ */
@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(88, 101, 242, 0.5);
    }
    50% {
        box-shadow: 0 0 40px rgba(88, 101, 242, 0.8), 0 0 60px rgba(88, 101, 242, 0.4);
    }
}

.animate-pulse-glow {
    animation: pulse-glow 2s ease-in-out infinite;
}

/* ============================================================================
   Loading Spinner
   ============================================================================ */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* ============================================================================
   Skeleton Loading
   ============================================================================ */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--discord-darker) 25%,
        #36393f 50%,
        var(--discord-darker) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ============================================================================
   Enhanced Details/Summary (FAQ Accordions)
   ============================================================================ */
details {
    transition: var(--transition-normal);
}

details summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 2rem;
}

details summary::-webkit-details-marker {
    display: none;
}

details summary::after {
    content: '▼';
    font-size: 0.8em;
    color: var(--discord-blurple);
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%) rotate(0deg);
    transition: transform var(--transition-normal);
}

details[open] summary::after {
    transform: translateY(-50%) rotate(180deg);
}

details summary:hover {
    color: var(--discord-blurple);
    background: rgba(88, 101, 242, 0.05);
    border-radius: 8px;
}

details[open] {
    background: rgba(88, 101, 242, 0.02);
    border-radius: 8px;
}

/* ============================================================================
   Mobile Menu Animations
   ============================================================================ */
#mobile-menu {
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease-in-out;
    overflow: hidden;
}

#mobile-menu.hidden {
    max-height: 0 !important;
    opacity: 0;
}

#mobile-menu:not(.hidden) {
    max-height: 600px;
    opacity: 1;
}

/* ============================================================================
   Floating Particles Background Effect (Optional)
   ============================================================================ */
.particles-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.particles-bg::before,
.particles-bg::after {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.15;
    animation: float 20s ease-in-out infinite;
}

.particles-bg::before {
    background: radial-gradient(circle, var(--discord-blurple) 0%, transparent 70%);
    top: -200px;
    left: -200px;
}

.particles-bg::after {
    background: radial-gradient(circle, #7289DA 0%, transparent 70%);
    bottom: -200px;
    right: -200px;
    animation-delay: -10s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(30px, -30px) scale(1.1);
    }
    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
}

/* ============================================================================
   Code Blocks with Copy Button
   ============================================================================ */
pre {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
}

pre code {
    display: block;
    overflow-x: auto;
    padding: 1.5rem;
    background: var(--discord-darkest);
    border-radius: 8px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    line-height: 1.5;
}

/* Copy button (added via JS) */
.code-copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

pre:hover .code-copy-btn {
    opacity: 1;
}

/* ============================================================================
   Image Lazy Loading Effects
   ============================================================================ */
img {
    max-width: 100%;
    height: auto;
}

img[loading="lazy"] {
    opacity: 0;
    transition: opacity var(--transition-normal);
}

img.loaded,
img[loading="lazy"].loaded {
    opacity: 1;
}

/* ============================================================================
   Selection Color
   ============================================================================ */
::selection {
    background-color: var(--discord-blurple);
    color: white;
    text-shadow: none;
}

::-moz-selection {
    background-color: var(--discord-blurple);
    color: white;
}

/* ============================================================================
   Badges & Tags
   ============================================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.875rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    transition: var(--transition-fast);
}

.badge:hover {
    transform: scale(1.05);
}

.badge-success {
    background: rgba(87, 242, 135, 0.15);
    color: var(--discord-green);
    border: 1px solid var(--discord-green);
}

.badge-warning {
    background: rgba(254, 231, 92, 0.15);
    color: var(--discord-yellow);
    border: 1px solid var(--discord-yellow);
}

.badge-error {
    background: rgba(237, 66, 69, 0.15);
    color: var(--discord-red);
    border: 1px solid var(--discord-red);
}

/* ============================================================================
   Progress Bar
   ============================================================================ */
.progress-bar {
    width: 100%;
    height: 0.75rem;
    background: var(--discord-darker);
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--discord-blurple), #7289DA);
    border-radius: 9999px;
    transition: width var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

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

/* ============================================================================
   Tooltips
   ============================================================================ */
.tooltip {
    position: relative;
}

.tooltip::before,
.tooltip::after {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal), transform var(--transition-normal);
}

.tooltip::before {
    content: attr(data-tooltip);
    bottom: calc(100% + 0.5rem);
    left: 50%;
    transform: translateX(-50%) translateY(5px);
    padding: 0.5rem 0.75rem;
    background: var(--discord-darker);
    color: white;
    border-radius: 6px;
    white-space: nowrap;
    font-size: 0.875rem;
    box-shadow: var(--shadow-lg);
}

.tooltip::after {
    content: '';
    bottom: calc(100% + 0.125rem);
    left: 50%;
    transform: translateX(-50%);
    border: 0.375rem solid transparent;
    border-top-color: var(--discord-darker);
}

.tooltip:hover::before,
.tooltip:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ============================================================================
   Blockquotes
   ============================================================================ */
blockquote {
    border-left: 4px solid var(--discord-blurple);
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: #B9BBBE;
    position: relative;
}

blockquote::before {
    content: '"';
    font-size: 4rem;
    color: var(--discord-blurple);
    opacity: 0.1;
    position: absolute;
    left: -10px;
    top: -20px;
    font-family: Georgia, serif;
}

/* ============================================================================
   Tables
   ============================================================================ */
table {
    border-collapse: collapse;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--discord-darker);
}

th {
    font-weight: 600;
    color: var(--discord-blurple);
    background: rgba(88, 101, 242, 0.05);
}

tr:hover {
    background: rgba(88, 101, 242, 0.02);
}

/* ============================================================================
   Back to Top Button
   ============================================================================ */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--discord-blurple), #7289DA);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
}

.back-to-top:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
}

.back-to-top.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(100px);
}

/* ============================================================================
   Reduced Motion Support
   ============================================================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================================================
   High Contrast Mode
   ============================================================================ */
@media (prefers-contrast: high) {
    :root {
        --discord-blurple: #6B76FF;
    }

    body {
        background: #000;
        color: #fff;
    }

    a {
        text-decoration: underline;
    }
}

/* ============================================================================
   Print Styles
   ============================================================================ */
@media print {
    nav, footer, .no-print, .back-to-top {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    a {
        text-decoration: underline;
        color: #000;
    }

    a[href^="http"]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
}

/* ============================================================================
   Form Inputs Enhancement (for future use)
   ============================================================================ */
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid var(--discord-blurple);
    outline-offset: 2px;
    border-color: var(--discord-blurple);
}

/* ============================================================================
   Utility Classes
   ============================================================================ */
.text-gradient {
    background: linear-gradient(135deg, var(--discord-blurple), #7289DA, #00D4FF);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.glow {
    box-shadow: var(--shadow-glow);
}

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

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