@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
    body {
        font-family: 'Inter', system-ui, sans-serif;
        -webkit-tap-highlight-color: transparent;
    }
}

@layer components {
    .neon-card {
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .neon-card:hover {
        transform: translateY(-4px) scale(1.03);
        box-shadow: 0 0 30px -5px rgb(0 240 255);
        border-color: rgb(0 240 255);
    }

    .truth-badge {
        animation: glow 2s ease-in-out infinite alternate;
    }
}

/* =========================
   ANIMATIONS
========================= */

@keyframes glow {
    from { text-shadow: 0 0 10px #00F0FF; }
    to { text-shadow: 0 0 25px #00F0FF, 0 0 40px #00F0FF; }
}

@keyframes pulse-slow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

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

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

.animate-pulse-slow {
    animation: pulse-slow 4s ease-in-out infinite;
}

/* =========================
   LEADERBOARD
========================= */

.leader-card {
    background: linear-gradient(145deg, #0A1428, #1a2338);
    border: 1px solid rgba(0, 240, 255, 0.3);
    transition: all 0.4s ease;
}

.leader-card:hover {
    border-color: #00F0FF;
    box-shadow: 0 0 35px rgba(0, 240, 255, 0.25);
    transform: translateY(-6px);
}

.rank-1 { border-color: #FFD700; box-shadow: 0 0 30px #FFD700; }
.rank-2 { border-color: #C0C0C0; }
.rank-3 { border-color: #CD7F32; }

.truth-score-bar {
    height: 6px;
    background: linear-gradient(to right, #00F0FF, #67E8F9);
    border-radius: 9999px;
}

/* =========================
   CHANNELS
========================= */

.channel-card {
    background: linear-gradient(145deg, #0A1428, #1a2338);
    transition: all 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.channel-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 0 40px rgba(0, 240, 255, 0.3);
}

/* =========================
   FAVORITE HEART
========================= */

.fav-heart {
    color: white;
    background: rgba(10, 20, 40, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 9999px;
    padding: 6px 12px;
    backdrop-filter: blur(8px);
    transition: transform 0.2s ease, color 0.2s ease, background 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

.fav-heart:hover {
    transform: scale(1.08);
    background: rgba(10, 20, 40, 0.9);
}

.fav-heart.active {
    color: #ef4444;
    transform: scale(1.12);
    animation: pop 0.3s ease;
}

.fav-heart .fav-count {
    font-size: 0.95rem;
    line-height: 1;
}

/* =========================
   SHARE BUTTONS
========================= */

.share-btn {
    transition: all 0.2s;
}

.share-btn:hover {
    transform: scale(1.15);
    color: #00F0FF;
}

/* =========================
   DROPDOWNS / MOBILE MENU
========================= */

#notifications-dropdown,
#mobile-menu {
    animation: slideDown 0.3s ease forwards;
}

/* =========================
   LOADING
========================= */

#loading .animate-spin {
    animation: spin 1.2s linear infinite;
}

/* =========================
   LOGO BACKGROUND ENHANCEMENT
========================= */

section.relative::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(0, 240, 255, 0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 1;
}

/* =========================
   MOBILE & TOUCH IMPROVEMENTS
========================= */

/* General mobile touch improvements */
input, textarea, select, button {
    -webkit-appearance: none;
    appearance: none;
    touch-action: manipulation;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

/* Mobile touch targets */
@media (max-width: 768px) {
    button, a, .fav-heart, .neon-card {
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(0, 240, 255, 0.3);
        touch-action: manipulation;
    }
    
    /* Increase tap targets for mobile */
    .fav-heart {
        padding: 8px 14px;
        min-height: 44px;
        min-width: 44px;
    }
    
    #mobile-menu-btn {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Better scrolling on mobile */
    #cards-container {
        -webkit-overflow-scrolling: touch;
    }
}

/* Fix for iOS Safari input issues */
@supports (-webkit-touch-callout: none) {
    input, textarea, select, button {
        font-size: 16px; /* Prevents zoom on focus in iOS */
    }
    
    #search-input {
        -webkit-text-fill-color: white !important;
        opacity: 1 !important;
    }
}

/* =========================
   LIGHT THEME
========================= */

body.light {
    background: #f4f8fb !important;
    color: #0A1428 !important;
}

body.light nav {
    background: rgba(255, 255, 255, 0.95) !important;
    border-color: rgba(0, 180, 255, 0.2) !important;
}

body.light .neon-card,
body.light .bg-black\/40,
body.light .bg-black\/60,
body.light .bg-\[\#0A1428\],
body.light .leader-card,
body.light .channel-card {
    background: rgba(255, 255, 255, 0.95) !important;
    color: #0A1428 !important;
}

body.light .text-white {
    color: #0A1428 !important;
}

body.light .text-cyan-400 {
    color: #0284c7 !important;
}

body.light .border-cyan-400\/30,
body.light .border-cyan-500\/30,
body.light .border-cyan-500\/20 {
    border-color: rgba(2, 132, 199, 0.25) !important;
}

body.light input {
    background: white !important;
    color: #0A1428 !important;
    border-color: rgba(2,132,199,0.35) !important;
}

body.light input::placeholder {
    color: rgba(2,132,199,0.7) !important;
}

body.light footer {
    background: rgba(255,255,255,0.9) !important;
    color: rgba(10,20,40,0.7) !important;
}

body.light .truth-badge {
    font-weight: 600;
}

body.light .fav-heart {
    background: rgba(255,255,255,0.88);
    border: 1px solid rgba(2,132,199,0.18);
    box-shadow: 0 0 10px rgba(0,0,0,0.08);
    color: #0A1428;
}

body.light .fav-heart.active {
    color: #ef4444;
}

/* Light theme mobile fixes */
body.light #mobile-menu {
    background: rgba(255, 255, 255, 0.98) !important;
}

body.light #mobile-menu a,
body.light #mobile-menu button {
    color: #0A1428 !important;
}
