/* Custom overrides if needed, mostly Tailwind handled */
body {
    -webkit-tap-highlight-color: transparent;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ===== ANIMATIONS ===== */

/* Modal animations */
@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modalFadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes modalSlideDown {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
}

/* Modal backdrop animation */
.modal-animate {
    animation: modalFadeIn 0.2s ease-out forwards;
}

.modal-animate-out {
    animation: modalFadeOut 0.15s ease-in forwards;
}

/* Modal content animation */
.modal-content-animate {
    animation: modalSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.modal-content-animate-out {
    animation: modalSlideDown 0.15s ease-in forwards;
}

/* Page transitions */
@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.page-animate {
    animation: fadeSlideIn 0.2s ease-out forwards;
}

/* List item stagger animation */
@keyframes listItemFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.list-item-animate {
    animation: listItemFadeIn 0.3s ease-out forwards;
    opacity: 0;
}

/* Button press effect */
.btn-press {
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn-press:active {
    transform: scale(0.97);
}

/* Smooth hover transitions for cards */
.card-hover {
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.card-hover:hover {
    transform: translateY(-2px);
}

/* Pulse animation for loading states */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse-subtle {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Carousel smooth transition */
#banner-carousel {
    transition: transform 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* Banner hover effect */
.banner-item {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.banner-item:hover {
    transform: scale(1.02);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

/* Ripple effect for buttons */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}

.ripple:active::after {
    width: 200px;
    height: 200px;
    opacity: 1;
    transition: 0s;
}

/* Smooth icon rotation */
.icon-rotate {
    transition: transform 0.3s ease;
}

.icon-rotate:hover {
    transform: rotate(15deg);
}

/* Tab indicator animation */
.tab-indicator {
    transition: left 0.3s cubic-bezier(0.25, 0.1, 0.25, 1), width 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* Skeleton loading animation */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, #1d2633 25%, #2c3440 50%, #1d2633 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* Toast notification animation */
@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(-100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-100%);
    }
}

.toast-animate-in {
    animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast-animate-out {
    animation: toastSlideOut 0.2s ease-in forwards;
}

/* Number counter animation */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.count-animate {
    animation: countUp 0.4s ease-out forwards;
}

/* Checkbox/Toggle animation */
.toggle-animate {
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.toggle-animate:active {
    transform: scale(0.95);
}

/* Dropdown animation */
@keyframes dropdownOpen {
    from {
        opacity: 0;
        transform: translateY(-10px) scaleY(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scaleY(1);
    }
}

.dropdown-animate {
    animation: dropdownOpen 0.2s ease-out forwards;
    transform-origin: top;
}

/* Subtle bounce for success states */
@keyframes successBounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.success-bounce {
    animation: successBounce 0.3s ease-out;
}

/* Shake animation for errors */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    20%, 60% {
        transform: translateX(-5px);
    }
    40%, 80% {
        transform: translateX(5px);
    }
}

.shake {
    animation: shake 0.4s ease-out;
}

/* Mobile Safe Area */
.safe-area-pb {
    padding-bottom: env(safe-area-inset-bottom, 20px);
}

/* Hide scrollbar for mobile nav if needed */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ===== MOBILE RESPONSIVE OVERRIDES ===== */
@media (max-width: 767px) {
    /* Hide desktop sidebar - target by class */
    #view-dashboard > .w-\[260px\],
    #view-dashboard > div.hidden.md\:flex.w-\[260px\] {
        display: none !important;
    }
    
    /* Hide desktop header bar */
    #header-bar,
    div[id="header-bar"] {
        display: none !important;
    }
    
    /* Hide middle navigation */
    #middle-nav,
    div[id="middle-nav"] {
        display: none !important;
    }
    
    /* Mobile header - always show */
    .mobile-header {
        display: flex !important;
    }
    
    /* Content area adjustments */
    #view-dashboard {
        flex-direction: column !important;
    }
    
    /* Make right content take full width */
    #view-dashboard > .flex-1 {
        width: 100% !important;
    }
    
    /* Main body split should be column on mobile */
    #view-dashboard .flex-1.flex.overflow-hidden {
        flex-direction: column !important;
    }
    
    /* Adjust content padding for bottom nav */
    .flex-1.overflow-y-auto {
        padding: 16px !important;
        padding-bottom: 100px !important;
    }
    
    /* Mobile dashboard hero visible */
    .mobile-hero {
        display: block !important;
    }
    
    /* Mobile bottom nav visible */
    .mobile-bottom-nav {
        display: flex !important;
    }
    
    /* Token list mobile styles */
    #list-tokens > div {
        padding: 14px 12px;
        border-radius: 16px;
        margin-bottom: 8px;
        background: #1c2431;
    }
    
    /* History list mobile styles */
    #list-history > div {
        padding: 14px 12px;
        border-radius: 16px;
        margin-bottom: 8px;
        background: #1c2431;
    }
    
    /* Settings page mobile */
    #page-settings {
        padding: 16px !important;
    }
    
    /* Page home full height */
    #page-home {
        min-height: auto;
    }
    
    /* Content title smaller on mobile */
    #content-title {
        font-size: 16px;
        margin-bottom: 16px;
    }
    
    /* Modals full width on mobile */
    .modal-content {
        margin: 16px;
        max-width: calc(100% - 32px);
    }
    
    /* Fix double $ sign - hide desktop balance in content */
    #dash-balance-usd {
        display: none;
    }
    
    /* Mobile nav button styles */
    .mobile-nav-btn {
        transition: all 0.15s ease;
    }
    
    .mobile-nav-btn.active {
        color: #45AEF5 !important;
    }
    
    /* Mobile wallet selector animation */
    #mobile-wallet-selector {
        transition: transform 0.25s ease, opacity 0.25s ease;
        transform-origin: top;
    }
    
    #mobile-wallet-selector.show {
        display: block !important;
        animation: slideDown 0.25s ease forwards;
    }
    
    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    /* Mobile hero improvements */
    .mobile-hero {
        background: linear-gradient(180deg, rgba(16, 22, 31, 0.8) 0%, transparent 100%);
        padding-top: 20px;
        padding-bottom: 24px;
    }
    
    /* Mobile action buttons */
    .mobile-hero button > div:first-child {
        transition: transform 0.15s ease, box-shadow 0.15s ease;
    }
    
    .mobile-hero button:active > div:first-child {
        transform: scale(0.95);
    }
    
    /* Improve NFT grid on mobile */
    #list-nfts {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
    
    /* Swap page mobile */
    #page-swap .max-w-xl {
        max-width: 100% !important;
    }
    
    #page-swap .bg-\[#1c2431\] {
        border-radius: 16px;
    }
    
    /* Token list item - fix text overflow */
    #list-tokens > div {
        display: flex;
        align-items: center;
        overflow: hidden;
    }
    
    #list-tokens > div > div:first-child {
        flex-shrink: 0;
    }
    
    #list-tokens > div .flex-1 {
        min-width: 0;
        overflow: hidden;
    }
    
    #list-tokens > div .text-right {
        flex-shrink: 0;
        max-width: 45%;
        text-align: right;
    }
    
    /* Token amount text - prevent overflow */
    #list-tokens .font-bold,
    #list-tokens .text-sm {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    /* History list - fix overflow */
    #list-history > div {
        display: flex;
        align-items: center;
        overflow: hidden;
    }
    
    #list-history > div .text-right {
        flex-shrink: 0;
        max-width: 45%;
    }
    
    /* Mobile bottom nav - ensure proper z-index and positioning */
    .mobile-bottom-nav {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 50 !important;
        background: #10161f !important;
    }
    
    /* Mobile nav buttons - proper spacing */
    .mobile-bottom-nav .mobile-nav-btn {
        min-width: 50px;
    }
    
    /* Content area - ensure space for bottom nav */
    #page-home {
        padding-bottom: 80px !important;
    }
    
    /* Fix modals on mobile - ensure they're above bottom nav */
    [id^="modal-"] {
        z-index: 100 !important;
    }
    
    /* Mobile balance display */
    .mobile-hero .text-4xl {
        font-size: 2rem;
    }
    
    /* Token icon size on mobile */
    #list-tokens img,
    #list-tokens .w-10 {
        width: 40px !important;
        height: 40px !important;
        flex-shrink: 0;
    }
    
    /* Settings page tokens list */
    #page-settings #list-tokens > div {
        padding: 12px;
    }
}

/* Desktop styles */
@media (min-width: 768px) {
    /* Hide mobile-only elements */
    .mobile-header,
    .mobile-hero,
    .mobile-bottom-nav {
        display: none !important;
    }
}
