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

:root {
    --bg-dark: #0a0e27;
    --bg-darker: #060913;
    --neon-cyan: #00f0ff;
    --neon-magenta: #ff006e;
    --neon-purple: #8338ec;
    --neon-yellow: #ffbe0b;
    --tier-s: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    --tier-a: linear-gradient(135deg, #84cc16 0%, #65a30d 100%);
    --tier-b: linear-gradient(135deg, #eab308 0%, #ca8a04 100%);
    --tier-c: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    --tier-d: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --tier-f: linear-gradient(135deg, #6c757d 0%, #495057 100%);
}

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

body {
    font-family: 'Rajdhani', sans-serif;
    background: var(--bg-dark);
    color: #fff;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Animated Grid Background */
.grid-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(0, 240, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 240, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: 0;
    animation: gridPulse 4s ease-in-out infinite;
}

@keyframes gridPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

/* Glowing Orbs */
.glow-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
    z-index: 0;
    pointer-events: none;
    animation: float 20s ease-in-out infinite;
}

.glow-orb-1 {
    width: 600px;
    height: 600px;
    background: var(--neon-cyan);
    top: -200px;
    right: -200px;
    animation-delay: 0s;
}

.glow-orb-2 {
    width: 500px;
    height: 500px;
    background: var(--neon-magenta);
    bottom: -150px;
    left: -150px;
    animation-delay: 5s;
}

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

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 40px 20px;
    position: relative;
    z-index: 1;
}

/* Hero Section */
.hero {
    position: relative;
    text-align: center;
    margin-bottom: 60px;
    animation: fadeInDown 1s ease-out;
}

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

.hero h1 {
    font-family: 'Orbitron', monospace;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 900;
    letter-spacing: 4px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-magenta), var(--neon-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 80px rgba(0, 240, 255, 0.5);
    position: relative;
    animation: neonPulse 3s ease-in-out infinite;
    line-height: 1.2;
}

@keyframes neonPulse {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.3); }
}

/* Glitch Effect on Hover */
.glitch {
    position: relative;
    display: inline-block;
}

.glitch:hover::before,
.glitch:hover::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-magenta), var(--neon-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    overflow: hidden;
    z-index: -1;
    pointer-events: none;
}

.glitch:hover::before {
    animation: glitch 0.3s infinite;
    clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
}

.glitch:hover::after {
    animation: glitch 0.3s infinite reverse;
    clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
}

@keyframes glitch {
    0% { transform: translate(0, 0); }
    20% { transform: translate(-1px, 0); }
    40% { transform: translate(1px, 0); }
    60% { transform: translate(-1px, 0); }
    80% { transform: translate(1px, 0); }
    100% { transform: translate(0, 0); }
}

.subtitle {
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* Degen Toggle */
.degen-toggle-wrapper {
    position: absolute;
    top: 0;
    right: 0;
    animation: fadeIn 1s ease-out 0.3s backwards;
}

.degen-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 190, 11, 0.3);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.8);
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(255, 190, 11, 0.1);
}

.degen-toggle:hover {
    background: rgba(255, 190, 11, 0.1);
    border-color: rgba(255, 190, 11, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 190, 11, 0.3);
}

.degen-toggle.active {
    background: linear-gradient(135deg, var(--neon-yellow), var(--neon-magenta));
    border-color: var(--neon-yellow);
    color: #000;
    box-shadow: 0 6px 25px rgba(255, 190, 11, 0.6);
}

.degen-toggle.active:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 30px rgba(255, 190, 11, 0.8);
}

.toggle-icon {
    font-size: 16px;
    animation: pulse 2s ease-in-out infinite;
}

.degen-toggle.active .toggle-icon {
    animation: spin 1s ease-in-out;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

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

/* Controls */
.controls {
    display: flex;
    gap: 20px;
    margin-bottom: 40px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    animation: fadeIn 1s ease-out 0.2s backwards;
}

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

.input-zone {
    display: flex;
    gap: 12px;
    flex: 1;
    min-width: 300px;
}

.search-wrapper {
    flex: 1;
    position: relative;
}

#coinInput {
    width: 100%;
    padding: 16px 24px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(0, 240, 255, 0.3);
    border-radius: 12px;
    color: #fff;
    font-size: 16px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    text-transform: none;
}

#coinInput:focus {
    outline: none;
    border-color: var(--neon-cyan);
    background: rgba(0, 240, 255, 0.1);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.3);
}

#coinInput::placeholder {
    color: rgba(255, 255, 255, 0.4);
    text-transform: none;
}

/* Search Results Dropdown */
.search-results {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: rgba(10, 14, 39, 0.98);
    border: 2px solid rgba(0, 240, 255, 0.4);
    border-radius: 12px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 240, 255, 0.2);
    backdrop-filter: blur(10px);
}

.search-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.search-item:last-child {
    border-bottom: none;
}

.search-item:hover {
    background: rgba(0, 240, 255, 0.1);
    transform: translateX(4px);
}

.search-item.no-results {
    cursor: default;
    color: rgba(255, 255, 255, 0.5);
    justify-content: center;
}

.search-item.no-results:hover {
    background: transparent;
    transform: none;
}

.search-logo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: contain;
}

.search-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.search-name {
    font-family: 'Rajdhani', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}

.search-symbol {
    font-family: 'Orbitron', monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--neon-cyan);
    letter-spacing: 1px;
}

/* Custom scrollbar for search results */
.search-results::-webkit-scrollbar {
    width: 8px;
}

.search-results::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.search-results::-webkit-scrollbar-thumb {
    background: rgba(0, 240, 255, 0.3);
    border-radius: 4px;
}

.search-results::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 240, 255, 0.5);
}

.neon-btn {
    padding: 16px 32px;
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
    border: none;
    border-radius: 12px;
    color: #fff;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 2px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 240, 255, 0.4);
}

.neon-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.neon-btn:hover::before {
    left: 100%;
}

.neon-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 240, 255, 0.6);
}

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

.neon-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.neon-btn:disabled:hover {
    transform: none;
    box-shadow: 0 4px 15px rgba(0, 240, 255, 0.4);
}

.export-btn {
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
}

.share-btn {
    background: linear-gradient(135deg, #1DA1F2, #14171A);
}

.share-btn:hover {
    box-shadow: 0 6px 25px rgba(29, 161, 242, 0.6);
}

.actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.secondary-btn {
    padding: 16px 24px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.8);
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
}

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

/* Coin Pool */
.coin-pool {
    margin-bottom: 60px;
    animation: fadeIn 1s ease-out 0.4s backwards;
}

.coin-pool h2 {
    font-family: 'Orbitron', monospace;
    font-size: 1.5rem;
    letter-spacing: 4px;
    margin-bottom: 24px;
    color: var(--neon-cyan);
    text-transform: uppercase;
}

.coin-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 32px;
    background: rgba(255, 255, 255, 0.02);
    border: 2px solid rgba(0, 240, 255, 0.2);
    border-radius: 16px;
    min-height: 120px;
    position: relative;
}

.coin-grid:empty::after {
    content: 'All coins ranked! Add more or reset.';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.3);
    font-size: 18px;
    letter-spacing: 1px;
}

.coin {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.15), rgba(131, 56, 236, 0.15));
    border: 2px solid rgba(0, 240, 255, 0.4);
    border-radius: 8px;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 2px;
    cursor: grab;
    transition: all 0.2s ease;
    user-select: none;
    box-shadow: 0 4px 12px rgba(0, 240, 255, 0.2);
    animation: coinAppear 0.4s ease-out backwards;
}

.coin-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    transition: transform 0.2s ease;
    pointer-events: none; /* Ensure logo doesn't interfere with dragging */
}

/* Remove Solana filter - CoinMarketCap logos are already accurate */

.coin-text {
    white-space: nowrap;
    pointer-events: none;
}

@keyframes coinAppear {
    from {
        opacity: 0;
        transform: scale(0.8) rotate(-5deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.coin:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 240, 255, 0.4);
    border-color: var(--neon-cyan);
}

.coin:hover .coin-logo {
    transform: scale(1.1) rotate(-5deg);
}

.coin:active,
.coin.dragging {
    cursor: grabbing;
    opacity: 0.7;
    transform: scale(1.1) rotate(5deg);
}

/* Touch dragging for mobile */
.coin.touch-dragging {
    opacity: 0.9;
    transform: scale(1.15) rotate(5deg);
    box-shadow: 0 12px 30px rgba(0, 240, 255, 0.5);
    transition: none;
}

/* Tier List */
.tier-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: fadeIn 1s ease-out 0.6s backwards;
}

.tier-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 0;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    animation: slideInRight 0.6s ease-out backwards;
}

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

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.tier-row:hover {
    transform: translateX(4px);
}

.tier-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.tier-s .tier-label { background: var(--tier-s); }
.tier-a .tier-label { background: var(--tier-a); }
.tier-b .tier-label { background: var(--tier-b); }
.tier-c .tier-label { background: var(--tier-c); }
.tier-d .tier-label { background: var(--tier-d); }
.tier-f .tier-label { background: var(--tier-f); }

.tier-letter {
    font-family: 'Orbitron', monospace;
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    white-space: nowrap;
}

.tier-name {
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 3px;
    margin-top: 4px;
    opacity: 0.9;
}

.tier-content {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 24px;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid transparent;
    min-height: 100px;
    transition: all 0.3s ease;
    position: relative;
}

.tier-content.drag-over {
    background: rgba(0, 240, 255, 0.1);
    border-color: var(--neon-cyan);
    box-shadow: inset 0 0 30px rgba(0, 240, 255, 0.2);
}

.tier-content:empty::after {
    content: 'DROP HERE';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.2);
    font-family: 'Orbitron', monospace;
    font-size: 14px;
    letter-spacing: 3px;
    pointer-events: none;
}

/* Responsive */
@media (max-width: 768px) {
    .tier-row {
        grid-template-columns: 100px 1fr;
    }

    .tier-letter {
        font-size: 2.5rem;
    }

    .tier-name {
        font-size: 0.75rem;
    }

    .controls {
        flex-direction: column;
    }

    .input-zone {
        width: 100%;
    }

    .actions {
        width: 100%;
        justify-content: stretch;
    }

    .secondary-btn {
        flex: 1;
    }

    .degen-toggle-wrapper {
        position: static;
        margin-bottom: 20px;
    }

    .degen-toggle {
        font-size: 11px;
        padding: 10px 16px;
    }
}

/* Notification Toast */
.notification-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
    color: #fff;
    padding: 16px 32px;
    border-radius: 12px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 1px;
    box-shadow: 0 8px 32px rgba(0, 240, 255, 0.5);
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.notification-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

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

::-webkit-scrollbar-track {
    background: var(--bg-darker);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--neon-cyan), var(--neon-purple));
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--neon-magenta), var(--neon-cyan));
}

/* Mobile touch improvements */
@media (hover: none) and (pointer: coarse) {
    /* Prevent text selection during drag */
    .coin {
        -webkit-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
        -webkit-tap-highlight-color: transparent;
    }

    /* Better touch targets on mobile */
    .coin {
        min-height: 48px;
        padding: 14px 26px;
    }

    /* Improve scrolling on mobile while allowing drag */
    .tier-content,
    .coin-grid {
        touch-action: pan-y;
    }
}

/* Footer */
.footer {
    margin-top: 60px;
    padding: 30px 0;
    text-align: center;
    border-top: 2px solid rgba(0, 240, 255, 0.2);
    animation: fadeIn 1s ease-out 0.8s backwards;
}

.footer p {
    font-family: 'Rajdhani', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.5px;
    margin: 0;
}

.footer a {
    color: var(--neon-cyan);
    text-decoration: none;
    font-weight: 700;
    transition: all 0.3s ease;
    position: relative;
}

.footer a:hover {
    color: var(--neon-magenta);
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

.footer a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-magenta));
    transition: width 0.3s ease;
}

.footer a:hover::after {
    width: 100%;
}
