/* ============================================
   PREMIUM VISUAL REDESIGN - COMPLETE OVERHAUL
   Crafted with attention to detail and visual excellence
   ============================================ */

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

/* ============================================
   CSS VARIABLES & GLOBAL SETUP
   ============================================ */
:root {
    --primary-emerald: #10b981;
    --primary-emerald-dark: #059669;
    --primary-emerald-light: #34d399;
    --primary-blue: #3b82f6;
    --primary-indigo: #6366f1;
    --primary-purple: #8b5cf6;
    --primary-pink: #ec4899;
    --bg-dark: #0f172a;
    --bg-darker: #020617;
    --bg-card: rgba(30, 41, 59, 0.85);
    --bg-card-hover: rgba(30, 41, 59, 0.95);
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: rgba(255, 255, 255, 0.1);
    --border-color-hover: rgba(16, 185, 129, 0.3);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(16, 185, 129, 0.3);
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   ANIMATED BACKGROUND WITH DEPTH
   ============================================ */
body {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%) !important;
    background-attachment: fixed !important;
    color: var(--text-primary) !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    position: relative !important;
    overflow-x: hidden !important;
}

/* Static gradient overlay - removed animations for performance */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(16, 185, 129, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(59, 130, 246, 0.06) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* Floating particles removed for performance */

#app-content {
    position: relative;
    z-index: 1;
}

/* Custom scrollbar removed - using default browser scrollbar for better performance */

/* ============================================
   GLASS MORPHISM CARDS - ENHANCED
   ============================================ */
.bg-gray-800, .bg-gray-700, .bg-gray-900 {
    background: var(--bg-card) !important;
    backdrop-filter: blur(12px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(12px) saturate(150%) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 
        var(--shadow-md),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -1px 0 rgba(0, 0, 0, 0.2) !important;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast) !important;
    position: relative !important;
    overflow: hidden !important;
}

/* Card shine effect on hover */
.bg-gray-800::before, .bg-gray-700::before, .bg-gray-900::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.05) 50%,
        transparent 70%
    );
    transform: rotate(45deg);
    transition: all 0.6s ease;
    opacity: 0;
    pointer-events: none;
}

.bg-gray-800:hover::before, .bg-gray-700:hover::before, .bg-gray-900:hover::before {
    opacity: 1;
    animation: shine 0.6s ease;
}

@keyframes shine {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.bg-gray-800:hover, .bg-gray-700:hover, .bg-gray-900:hover {
    transform: translateY(-2px) !important;
    background: var(--bg-card-hover) !important;
    box-shadow: 
        var(--shadow-lg),
        var(--shadow-glow),
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        inset 0 -1px 0 rgba(0, 0, 0, 0.3) !important;
    border-color: var(--border-color-hover) !important;
}

/* ============================================
   PREMIUM BUTTONS WITH RIPPLE EFFECT
   ============================================ */
button {
    position: relative !important;
    overflow: hidden !important;
    transition: all var(--transition-base) !important;
    transform: translateZ(0) !important;
    backface-visibility: hidden !important;
    border-radius: 0.5rem !important;
}

/* Ripple effect */
button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease, opacity 0.6s ease;
    pointer-events: none;
    opacity: 0;
}

button:active::after {
    width: 300px;
    height: 300px;
    opacity: 1;
    transition: width 0s, height 0s, opacity 0.3s;
}

/* Button hover glow */
button::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    padding: 2px;
    background: linear-gradient(45deg, 
        rgba(16, 185, 129, 0.5),
        rgba(59, 130, 246, 0.5),
        rgba(139, 92, 246, 0.5));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    opacity: 0;
    transition: opacity var(--transition-base);
    pointer-events: none;
    z-index: -1;
}

button:hover::before {
    opacity: 1;
    animation: borderGlow 2s ease infinite;
}

@keyframes borderGlow {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

button:hover {
    transform: translateY(-2px) !important;
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(16, 185, 129, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

button:active {
    transform: translateY(0) !important;
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.3),
        inset 0 2px 4px rgba(0, 0, 0, 0.2) !important;
}

/* Specific button color enhancements */
button.bg-blue-600, button.bg-emerald-600, button.bg-purple-600, button.bg-pink-600 {
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

button.bg-blue-600:hover {
    box-shadow: 
        0 12px 32px rgba(59, 130, 246, 0.4),
        0 0 24px rgba(59, 130, 246, 0.3) !important;
}

button.bg-emerald-600:hover {
    box-shadow: 
        0 12px 32px rgba(16, 185, 129, 0.4),
        0 0 24px rgba(16, 185, 129, 0.3) !important;
}

button.bg-purple-600:hover {
    box-shadow: 
        0 12px 32px rgba(139, 92, 246, 0.4),
        0 0 24px rgba(139, 92, 246, 0.3) !important;
}

button.bg-pink-600:hover {
    box-shadow: 
        0 12px 32px rgba(236, 72, 153, 0.4),
        0 0 24px rgba(236, 72, 153, 0.3) !important;
}

/* ============================================
   ENHANCED SIDEBAR
   ============================================ */
#sidebar {
    background: rgba(30, 41, 59, 0.9) !important;
    backdrop-filter: blur(16px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(16px) saturate(150%) !important;
    border-right: 1px solid var(--border-color) !important;
    box-shadow: 
        8px 0 32px rgba(0, 0, 0, 0.4),
        inset -1px 0 0 rgba(255, 255, 255, 0.05) !important;
    position: relative !important;
}

#sidebar::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(
        180deg,
        transparent,
        rgba(16, 185, 129, 0.3),
        transparent
    );
    pointer-events: none;
}

/* ============================================
   NAVIGATION LINKS - PREMIUM EFFECTS
   ============================================ */
.nav-link {
    transition: all var(--transition-base) !important;
    border-radius: 0.5rem !important;
    position: relative !important;
    overflow: hidden !important;
}

/* Animated left border */
.nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: linear-gradient(
        180deg,
        rgba(16, 185, 129, 1),
        rgba(59, 130, 246, 1),
        rgba(139, 92, 246, 1)
    );
    transform: scaleY(0);
    transform-origin: bottom;
    transition: transform var(--transition-base);
    border-radius: 0 4px 4px 0;
}

.nav-link:hover::before,
.nav-link.bg-gray-700::before {
    transform: scaleY(1);
}

/* Background glow on hover */
.nav-link::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        circle at left center,
        rgba(16, 185, 129, 0.15),
        transparent 70%
    );
    opacity: 0;
    transition: opacity var(--transition-base);
    pointer-events: none;
}

.nav-link:hover::after {
    opacity: 1;
}

.nav-link:hover {
    transform: translateX(6px) !important;
    background: rgba(16, 185, 129, 0.12) !important;
    box-shadow: 
        -4px 0 12px rgba(16, 185, 129, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

.nav-link.bg-gray-700 {
    background: rgba(16, 185, 129, 0.15) !important;
    box-shadow: 
        -4px 0 12px rgba(16, 185, 129, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

/* ============================================
   HOME PAGE - HERO SECTION
   ============================================ */
#content-home {
    position: relative;
    overflow: hidden;
}

#content-home::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(
        circle,
        rgba(16, 185, 129, 0.1) 0%,
        transparent 50%
    );
    animation: rotate 20s linear infinite;
    pointer-events: none;
}

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

/* Animated coin icon */
#content-home .ph-coins {
    animation: float 3s ease-in-out infinite, glow 2s ease-in-out infinite alternate !important;
    filter: drop-shadow(0 0 20px rgba(16, 185, 129, 0.5)) !important;
    position: relative;
    z-index: 1;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
}

@keyframes glow {
    0% { filter: drop-shadow(0 0 20px rgba(16, 185, 129, 0.5)); }
    100% { filter: drop-shadow(0 0 30px rgba(16, 185, 129, 0.8)); }
}

/* Gradient text for heading */
#content-home h2 {
    background: linear-gradient(
        135deg,
        #ffffff 0%,
        #10b981 50%,
        #3b82f6 100%
    ) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
    animation: textShimmer 3s ease infinite !important;
    position: relative;
    z-index: 1;
}

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

/* Home page buttons with special effects */
#content-home button {
    position: relative;
    overflow: hidden;
    z-index: 1;
}

#content-home button::after {
    background: rgba(255, 255, 255, 0.4);
}

/* ============================================
   DASHBOARD - STAT CARDS
   ============================================ */
#content-dashboard .bg-gray-800 {
    position: relative;
    overflow: visible;
}

/* Dashboard numbers - static for performance */
#content-dashboard .text-4xl,
#content-dashboard .text-2xl {
    font-weight: 800 !important;
    letter-spacing: -0.02em !important;
    background: linear-gradient(
        135deg,
        var(--primary-emerald) 0%,
        var(--primary-emerald-light) 100%
    ) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
}

/* Number pulse animation removed - static for better performance */

/* Stat card icons */
#content-dashboard .ph-bold {
    font-size: 2rem !important;
    opacity: 0.8;
    transition: all var(--transition-base);
}

#content-dashboard .bg-gray-800:hover .ph-bold {
    opacity: 1;
}

/* Dashboard card stagger animation */
#content-dashboard .grid > div {
    animation: cardSlideIn 0.6s ease-out forwards;
    opacity: 0;
    transform: translateY(30px);
}

#content-dashboard .grid > div:nth-child(1) { animation-delay: 0.1s; }
#content-dashboard .grid > div:nth-child(2) { animation-delay: 0.2s; }
#content-dashboard .grid > div:nth-child(3) { animation-delay: 0.3s; }
#content-dashboard .grid > div:nth-child(4) { animation-delay: 0.4s; }
#content-dashboard .grid > div:nth-child(5) { animation-delay: 0.5s; }
#content-dashboard .grid > div:nth-child(n+6) { animation-delay: 0.6s; }

@keyframes cardSlideIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chart containers */
#content-dashboard canvas {
    transition: all var(--transition-base);
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.2));
}

/* Chart hover effects removed for performance */

/* ============================================
   COLLECTION PAGE - TABLE & ITEMS
   ============================================ */
.data-table tbody tr {
    transition: all var(--transition-fast) !important;
    position: relative;
    border-left: 3px solid transparent;
}

.data-table tbody tr::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: linear-gradient(
        180deg,
        var(--primary-emerald),
        var(--primary-blue)
    );
    transform: scaleY(0);
    transform-origin: top;
    transition: transform var(--transition-base);
}

.data-table tbody tr:hover::before {
    transform: scaleY(1);
}

.data-table tbody tr:hover {
    background: rgba(16, 185, 129, 0.08) !important;
    transform: translateX(2px) !important;
    box-shadow: 
        -4px 0 12px rgba(16, 185, 129, 0.2),
        0 4px 12px rgba(0, 0, 0, 0.15) !important;
    border-left-color: var(--primary-emerald) !important;
}

/* Collection images */
.collection-image-zoom {
    transition: all var(--transition-base) !important;
    border-radius: 0.5rem !important;
    box-shadow: var(--shadow-sm) !important;
}

.collection-image-zoom:hover {
    transform: scale(1.15) translateZ(0) !important;
    box-shadow: 
        var(--shadow-md),
        0 0 15px rgba(16, 185, 129, 0.3) !important;
    z-index: 10 !important;
    position: relative !important;
}

/* Collection stats badges - static for performance */
#collection-result-count,
#collection-stats-badge {
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(16, 185, 129, 0.3) !important;
}

/* ============================================
   INPUT FIELDS - ENHANCED
   ============================================ */
input, select, textarea {
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast) !important;
    background: rgba(30, 41, 59, 0.8) !important;
    border: 1px solid var(--border-color) !important;
    backdrop-filter: blur(8px) !important;
}

input:focus, select:focus, textarea:focus {
    transform: translateY(-1px) !important;
    box-shadow: 
        0 0 0 3px rgba(16, 185, 129, 0.2),
        0 4px 12px rgba(0, 0, 0, 0.2) !important;
    border-color: var(--primary-emerald) !important;
    background: rgba(30, 41, 59, 0.95) !important;
}

/* ============================================
   MODAL - PREMIUM STYLING
   ============================================ */
.modal-backdrop {
    background: rgba(0, 0, 0, 0.9) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    animation: fadeIn 0.3s ease !important;
}

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

.modal-content {
    animation: modalSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 
        var(--shadow-xl),
        0 0 40px rgba(16, 185, 129, 0.2) !important;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ============================================
   HEADER - ENHANCED
   ============================================ */
header {
    background: rgba(30, 41, 59, 0.9) !important;
    backdrop-filter: blur(16px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(16px) saturate(150%) !important;
    border-bottom: 1px solid var(--border-color) !important;
    box-shadow: 
        0 4px 24px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}

/* ============================================
   ICONS - ANIMATED
   ============================================ */
i {
    transition: all var(--transition-base) !important;
    display: inline-block !important;
}

button:hover i, .nav-link:hover i, a:hover i {
    transform: rotate(3deg) !important;
}

/* ============================================
   PAGE TRANSITIONS & CENTERING
   ============================================ */
.content-view {
    animation: pageFadeIn 0.5s ease-out !important;
}

/* Only apply flex when view is visible (not hidden) */
.content-view:not(.hidden) {
    display: flex !important;
    flex-direction: column !important;
}

/* Ensure all max-w containers are properly centered */
.max-w-7xl, .max-w-4xl, .max-w-3xl, .max-w-md {
    margin-left: auto !important;
    margin-right: auto !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* Fix main content area centering */
#main-content-area {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
}

/* Center content within available space (accounting for sidebar) */
@media (min-width: 768px) {
    /* The main-content-area already has md:ml-64 (16rem) to account for sidebar */
    /* We need to center content in the remaining space, so add padding-right equal to sidebar width */
    .content-view:not(.hidden) {
        padding-right: 16rem !important; /* Match sidebar width to center content */
        padding-left: 1rem !important; /* Minimal left padding */
    }
    
    /* Ensure max-w containers are centered */
    .content-view:not(.hidden) > .max-w-7xl,
    .content-view:not(.hidden) > .max-w-4xl,
    .content-view:not(.hidden) > .max-w-3xl,
    .content-view:not(.hidden) > .max-w-md {
        margin-left: auto !important;
        margin-right: auto !important;
    }
}

/* Mobile: no extra padding needed */
@media (max-width: 767px) {
    .content-view:not(.hidden) > .max-w-7xl,
    .content-view:not(.hidden) > .max-w-4xl,
    .content-view:not(.hidden) > .max-w-3xl,
    .content-view:not(.hidden) > .max-w-md {
        margin-left: auto !important;
        margin-right: auto !important;
    }
}

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

/* ============================================
   GRID ITEMS - STAGGERED ANIMATION
   ============================================ */
.grid > div {
    animation: itemFadeIn 0.6s ease-out forwards;
    opacity: 0;
    transform: translateY(20px);
}

.grid > div:nth-child(1) { animation-delay: 0.05s; }
.grid > div:nth-child(2) { animation-delay: 0.1s; }
.grid > div:nth-child(3) { animation-delay: 0.15s; }
.grid > div:nth-child(4) { animation-delay: 0.2s; }
.grid > div:nth-child(5) { animation-delay: 0.25s; }
.grid > div:nth-child(6) { animation-delay: 0.3s; }
.grid > div:nth-child(n+7) { animation-delay: 0.35s; }

@keyframes itemFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   ROUNDED ELEMENTS - ENHANCED
   ============================================ */
.rounded-lg, .rounded-md {
    transition: all var(--transition-base) !important;
}

.rounded-lg:hover, .rounded-md:hover {
    transform: translateY(-4px) !important;
    box-shadow: 
        var(--shadow-xl),
        var(--shadow-glow),
        inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
}

/* ============================================
   TEXT ENHANCEMENTS
   ============================================ */
.text-emerald-400, .text-emerald-300 {
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.3) !important;
}

.text-blue-400 {
    text-shadow: 0 0 10px rgba(59, 130, 246, 0.3) !important;
}

.text-pink-400 {
    text-shadow: 0 0 10px rgba(236, 72, 153, 0.3) !important;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    button:hover {
        transform: translateY(-1px) !important;
    }
    
    .bg-gray-800:hover, .bg-gray-700:hover {
        transform: translateY(-2px) !important;
    }
    
    .data-table tbody tr:hover {
        transform: translateX(2px) !important;
    }
    
    #content-home .ph-coins {
        font-size: 4rem !important;
    }
    
    #content-home h2 {
        font-size: 2.5rem !important;
    }
}

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

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

/* ============================================
   ADDITIONAL POLISH
   ============================================ */
/* will-change removed for better performance - browser handles optimization */

/* Prevent layout shift during animations */
* {
    box-sizing: border-box;
}

/* Selection color */
::selection {
    background: rgba(16, 185, 129, 0.3);
    color: var(--text-primary);
}

::-moz-selection {
    background: rgba(16, 185, 129, 0.3);
    color: var(--text-primary);
}
