/* $TAP Mini App - Unified Optimized Styles */

:root {
    /* 🎨 Enhanced Premium Colors */
    --primary-bg: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
    --secondary-bg: linear-gradient(145deg, #1e1e3f 0%, #2a2a5a 100%);
    --card-bg: linear-gradient(145deg, #1a1a3a 0%, #2d2d5d 50%, #1f1f4f 100%);
    --accent-blue: #4FC3F7;
    --accent-red: #FF6B6B;
    --accent-orange: #FFB74D;
    --accent-green: #4CAF50;
    --accent-purple: #AB47BC;
    --accent-gold: #FFD700;
    --text-primary: #FFFFFF;
    --text-secondary: #E0E0E0;
    --text-muted: #9E9E9E;
    --border-color: rgba(255, 255, 255, 0.15);
    --gradient-primary: linear-gradient(135deg, #FF6B6B 0%, #FFD700 50%, #4FC3F7 100%);
    --gradient-secondary: linear-gradient(135deg, #4FC3F7 0%, #AB47BC 100%);
    --gradient-success: linear-gradient(135deg, #4CAF50 0%, #81C784 100%);
    --gradient-warning: linear-gradient(135deg, #FFB74D 0%, #FFCC02 100%);
    --gradient-card: linear-gradient(145deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 12px;
    --spacing-lg: 16px;
    --spacing-xl: 24px;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-xs: 11px;
    --font-size-sm: 13px;
    --font-size-md: 15px;
    --font-size-lg: 17px;
    --font-size-xl: 21px;
    --font-size-2xl: 28px;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.3);
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

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

body {
    font-family: var(--font-family);
    background: var(--primary-bg);
    color: var(--text-primary);
    font-size: var(--font-size-md);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    overflow-x: hidden;
}

/* 🌌 Animated Background */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 107, 107, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(79, 195, 247, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 20% 80%, rgba(171, 71, 188, 0.1) 0%, transparent 50%);
    animation: backgroundFloat 20s ease-in-out infinite;
    z-index: -1;
    pointer-events: none;
}

@keyframes backgroundFloat {
    0%, 100% { transform: rotate(0deg) scale(1); }
    33% { transform: rotate(120deg) scale(1.1); }
    66% { transform: rotate(240deg) scale(0.9); }
}

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 100vw;
    overflow-x: hidden;
}

/* 🏠 Premium Header */
.app-header {
    background: var(--card-bg);
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 10;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: var(--font-size-xl);
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 4px 8px rgba(255, 107, 107, 0.3);
    position: relative;
}

.logo::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: var(--gradient-primary);
    border-radius: 8px;
    z-index: -1;
    opacity: 0.1;
    filter: blur(8px);
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: var(--font-size-sm);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-sm);
    font-weight: 600;
}

/* Balance Section */
.balance-section {
    padding: var(--spacing-lg);
    text-align: center;
}

.balance-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-lg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4),
                0 0 30px rgba(255, 215, 0, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

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

.balance-card:hover::before {
    left: 100%;
}

.balance-amount {
    font-size: 32px;
    font-weight: 800;
    background: linear-gradient(135deg, #FFD700 0%, #FF6B6B 50%, #4FC3F7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--spacing-xs);
    text-shadow: 0 4px 20px rgba(255, 215, 0, 0.3);
    position: relative;
    animation: balanceGlow 3s ease-in-out infinite;
}

@keyframes balanceGlow {
    0%, 100% {
        filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.3));
    }
    50% {
        filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.6));
    }
}

.balance-subtext {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

/* Progress Section */
.progress-section {
    padding: 0 var(--spacing-lg) var(--spacing-lg);
}

.progress-text {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--spacing-sm);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.progress-bar {
    background: var(--secondary-bg);
    border-radius: var(--radius-md);
    height: 8px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    transition: width var(--transition-normal);
}

/* Main Content */
.main-content {
    flex: 1;
    padding-bottom: 80px; /* Space for navigation */
}

/* Screens */
.screen {
    display: none;
    padding: var(--spacing-lg);
    min-height: 60vh;
}

.screen.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.screen-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.screen-header h2 {
    font-size: var(--font-size-xl);
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

.screen-header p {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

/* Tap Game */
.tap-container {
    text-align: center;
    max-width: 400px;
    margin: 0 auto;
}

.tap-area {
    position: relative;
    margin: var(--spacing-xl) 0;
}

.tap-button {
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: var(--gradient-primary);
    border: 6px solid transparent;
    background-clip: padding-box;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.3),
        0 0 60px rgba(255, 107, 107, 0.4),
        inset 0 2px 0 rgba(255, 255, 255, 0.3),
        inset 0 -2px 0 rgba(0, 0, 0, 0.3);
    user-select: none;
    position: relative;
    overflow: hidden;
}

.tap-button::before {
    content: '';
    position: absolute;
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
    background: linear-gradient(45deg, #FFD700, #FF6B6B, #4FC3F7, #AB47BC);
    border-radius: 50%;
    z-index: -1;
    animation: borderRotate 4s linear infinite;
}

.tap-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 80%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
    border-radius: 50%;
    opacity: 0.8;
    animation: innerGlow 2s ease-in-out infinite;
}

@keyframes borderRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes innerGlow {
    0%, 100% {
        opacity: 0.3;
        transform: translate(-50%, -50%) scale(0.8);
    }
    50% {
        opacity: 0.7;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

.tap-button:active,
.tap-button.tapped {
    transform: scale(0.9);
    box-shadow: 
        0 10px 20px rgba(0, 0, 0, 0.4),
        0 0 40px rgba(255, 107, 107, 0.6),
        inset 0 4px 0 rgba(255, 255, 255, 0.2);
}

.tap-button:hover {
    transform: scale(1.05);
    box-shadow: 
        0 30px 60px rgba(0, 0, 0, 0.4),
        0 0 80px rgba(255, 107, 107, 0.5),
        inset 0 2px 0 rgba(255, 255, 255, 0.4);
}

.tap-icon {
    font-size: 64px;
    color: white;
    text-shadow: 
        0 0 20px rgba(255, 255, 255, 0.8),
        0 4px 8px rgba(0, 0, 0, 0.3);
    z-index: 2;
    position: relative;
    animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% {
        transform: scale(1);
        text-shadow: 
            0 0 20px rgba(255, 255, 255, 0.8),
            0 4px 8px rgba(0, 0, 0, 0.3);
    }
    50% {
        transform: scale(1.1);
        text-shadow: 
            0 0 30px rgba(255, 255, 255, 1),
            0 0 40px rgba(255, 215, 0, 0.6),
            0 4px 12px rgba(0, 0, 0, 0.4);
    }
}

.tap-counter {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--accent-orange);
    opacity: 0;
    transition: all var(--transition-normal);
    pointer-events: none;
}

.tap-counter.show {
    opacity: 1;
    transform: translateX(-50%) translateY(-20px);
}

/* Timer */
.tap-timer {
    margin: var(--spacing-lg) 0;
}

.timer-text {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
}

.timer-bar {
    background: var(--secondary-bg);
    border-radius: var(--radius-md);
    height: 12px;
    overflow: hidden;
}

.timer-fill {
    height: 100%;
    background: var(--gradient-primary);
    transition: width 1s linear;
}

/* Instructions */
.tap-instructions {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    font-size: var(--font-size-md);
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    min-height: 44px; /* Touch-friendly */
    justify-content: center;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.btn:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 12px 30px rgba(0, 0, 0, 0.2),
        0 0 25px rgba(79, 195, 247, 0.3);
    filter: brightness(1.1);
}

.btn:active {
    transform: translateY(-1px) scale(0.98);
    transition: all 0.1s ease-out;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    filter: grayscale(1);
}

/* 💫 Enhanced Button Variants */
.btn-primary {
    background: var(--gradient-primary);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.btn-primary::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;
}

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

.btn-success {
    background: var(--gradient-success);
    box-shadow: 0 8px 20px rgba(76, 175, 80, 0.3);
}

.btn-warning {
    background: var(--gradient-warning);
    box-shadow: 0 8px 20px rgba(255, 183, 77, 0.3);
}

/* Staking Section */
.staking-overview {
    margin-bottom: var(--spacing-xl);
}

.staking-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    text-align: center;
    border: 1px solid var(--border-color);
}

.stat-icon {
    font-size: var(--font-size-xl);
    margin-bottom: var(--spacing-sm);
}

.stat-value {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--accent-orange);
    display: block;
}

.stat-label {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    margin-top: var(--spacing-xs);
}

.stakes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.stakes-actions {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.action-btn {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-sm);
    min-height: auto;
}

/* Bottom Navigation */
.bottom-nav-optimized {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(145deg, rgba(26, 26, 46, 0.95) 0%, rgba(22, 33, 62, 0.95) 100%);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    justify-content: space-around;
    padding: 12px 0 20px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 1000;
    box-shadow: 
        0 -10px 30px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.nav-item-opt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 8px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    min-width: 65px;
    position: relative;
    border-radius: 12px;
}

.nav-item-opt .nav-icon {
    font-size: 22px;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
}

.nav-item-opt.active {
    color: #FFFFFF;
    background: linear-gradient(135deg, #FF6B6B 0%, #4FC3F7 100%);
    box-shadow: 
        0 6px 20px rgba(255, 107, 107, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.nav-item-opt.active .nav-icon {
    transform: scale(1.1);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.nav-item-opt.active::before {
    content: '';
    position: absolute;
    top: -3px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 3px;
    background: linear-gradient(90deg, #FFD700, #FF6B6B);
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.nav-item-opt:hover {
    color: var(--accent-blue);
    transform: translateY(-1px) scale(1.02);
    background: rgba(79, 195, 247, 0.1);
}

.nav-item-opt:hover .nav-icon {
    transform: scale(1.05);
    filter: drop-shadow(0 0 8px rgba(79, 195, 247, 0.4));
}

.nav-item-opt:active {
    transform: translateY(0) scale(0.98);
    transition: all 0.1s ease-out;
}
    color: var(--text-primary);
}

.nav-icon {
    font-size: 20px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-label {
    font-size: var(--font-size-xs);
    font-weight: 500;
}

.nav-badge {
    position: absolute;
    top: -2px;
    right: 8px;
    background: var(--accent-red);
    color: white;
    font-size: 8px;
    padding: 2px 4px;
    border-radius: 8px;
    font-weight: 600;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--primary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-screen.hidden {
    display: none;
}

.loading-content {
    text-align: center;
    animation: pulse 2s infinite;
}

.tap-logo {
    font-size: 48px;
    color: var(--accent-orange);
    margin-bottom: var(--spacing-md);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--accent-orange);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: var(--spacing-lg) auto;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes coinFloat {
    0% { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
    }
    100% { 
        opacity: 0; 
        transform: translateY(-50px) scale(0.8); 
    }
}

@keyframes coinChain {
    0% { 
        opacity: 1; 
        transform: scale(1); 
    }
    100% { 
        opacity: 0; 
        transform: scale(0.5) translateY(-20px); 
    }
}

@keyframes confettiFall {
    0% { 
        opacity: 1; 
        transform: translateY(-100vh) rotate(0deg); 
    }
    100% { 
        opacity: 0; 
        transform: translateY(100vh) rotate(360deg); 
    }
}

/* Responsive Design */
@media (max-width: 480px) {
    .header-content {
        padding: var(--spacing-sm);
    }
    
    .balance-card {
        padding: var(--spacing-lg);
    }
    
    .tap-button {
        width: 160px;
        height: 160px;
    }
    
    .tap-icon {
        font-size: 36px;
    }
    
    .stakes-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .stakes-actions {
        justify-content: center;
    }
}

@media (min-width: 768px) {
    .app {
        max-width: 480px;
        margin: 0 auto;
        box-shadow: var(--shadow-lg);
    }
    
    .staking-stats {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Touch and Accessibility */
@media (pointer: coarse) {
    .btn, .nav-item-opt {
        min-height: 44px;
    }
}

/* 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;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-color: rgba(255, 255, 255, 0.3);
        --text-secondary: #E0E0E0;
    }
}