/* Mobile optimization */
html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    -webkit-tap-highlight-color: rgba(0,0,0,0) !important;
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
}

/* NUCLEAR OPTION - ABSOLUTE REMOVAL */
html, body, *, *::before, *::after {
    -webkit-tap-highlight-color: rgba(0,0,0,0) !important;
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    outline: none !important;
}

/* FORCE REMOVE ALL BLACK HIGHLIGHTS EVERYWHERE */
*, *:before, *:after, 
body, html, div, span, p, h1, h2, h3, h4, h5, h6,
a, button, input, textarea, select, option,
i, svg, img, canvas, video, audio,
nav, header, footer, main, section, article, aside,
ul, ol, li, dl, dt, dd, table, tr, td, th,
form, fieldset, legend, label {
    -webkit-tap-highlight-color: rgba(0,0,0,0) !important;
    -webkit-tap-highlight-color: transparent !important;
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    tap-highlight-color: transparent !important;
}

/* MOBILE TOUCH OPTIMIZATION - REMOVE BLACK HIGHLIGHTS */
*:active, *:focus, *:hover,
button:active, button:focus, button:hover,
a:active, a:focus, a:hover,
span:active, span:focus, span:hover,
div:active, div:focus, div:hover,
i:active, i:focus, i:hover,
p:active, p:focus, p:hover,
h1:active, h1:focus, h1:hover,
h2:active, h2:focus, h2:hover,
h3:active, h3:focus, h3:hover,
h4:active, h4:focus, h4:hover,
h5:active, h5:focus, h5:hover,
h6:active, h6:focus, h6:hover {
    -webkit-tap-highlight-color: rgba(0,0,0,0) !important;
    -webkit-tap-highlight-color: transparent !important;
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

/* Center everything globally */
.main-content,
.dashboard-content,
.section,
.container {
    text-align: center !important;
}

.grid {
    justify-items: center !important;
}

.flex {
    justify-content: center !important;
}

/* Ensure proper mobile viewport */
@media screen and (max-width: 768px) {
    .container {
        padding: 0 16px;
        max-width: 100%;
    }
    
    .sidebar {
        width: 100vw;
        max-width: 280px;
    }
    
    .main-content {
        margin-left: 0;
        padding: 70px 16px 16px;
        width: 100%;
    }
    
    /* Ensure buttons are touch-friendly */
    button {
        min-height: 44px;
        min-width: 44px;
        touch-action: manipulation;
    }
    
    /* Prevent horizontal scrolling */
    html, body {
        overflow-x: hidden;
        width: 100%;
    }
}

/* Custom animations and styles */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.animate-fadeInUp {
    animation: fadeInUp 0.6s ease-out;
}

.animate-pulse-slow {
    animation: pulse 2s infinite;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #0a0b0f;
}

::-webkit-scrollbar-thumb {
    background: #374151;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4b5563;
}

/* Custom gradient text */
.gradient-text {
    background: linear-gradient(45deg, #1e40af, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Glowing effects */
.glow-green {
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.glow-blue {
    box-shadow: 0 0 20px rgba(30, 64, 175, 0.3);
}

/* Trading feed animation */
.trading-item {
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.trading-item:hover {
    border-left-color: #10b981;
    background-color: rgba(16, 185, 129, 0.1);
}

/* Mobile layout fixes */
@media (max-width: 1023px) {
    #main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding-left: 0 !important;
    }
    
    /* Hide sidebar by default on mobile */
    #sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        width: 288px; /* w-72 */
        z-index: 40;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
    }
    
    /* Show sidebar when not hidden */
    #sidebar:not(.-translate-x-full) {
        transform: translateX(0);
    }
    
    /* Ensure overlay covers everything */
    #sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 39;
    }
}

/* Touch interactions */
.touch-manipulation {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Enhanced touch support for all buttons */
button, .touch-manipulation {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    cursor: pointer;
}

/* Button active states for better mobile feedback */
button:active, .touch-manipulation:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

/* PERMANENT DASHBOARD VISIBILITY - NEVER HIDE OVERVIEW */
.dashboard-section {
    padding: 1rem;
}

#overview-section {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 1 !important;
}

#overview-section * {
    visibility: visible !important;
    opacity: 1 !important;
}

.dashboard-section.active {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Signup bonus animation */
@keyframes bonusPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

#signup-bonus-banner {
    animation: bonusPulse 2s infinite;
}

/* Mobile modal and button fixes */
@media (max-width: 768px) {
    .fixed.inset-0 {
        z-index: 9999 !important;
    }
    
    .modal-content {
        margin: 1rem;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    /* Ensure buttons work properly on mobile */
    button {
        min-height: 44px;
        padding: 12px 16px;
    }
    
    /* Make wallet buttons more touch-friendly */
    #addWalletModal button {
        min-height: 48px;
        font-size: 14px;
    }
}

/* Mobile and desktop fixes for dashboard visibility */
@media (max-width: 1024px) {
    .dashboard-section {
        padding: 0.75rem;
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    .dashboard-section.active {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        min-height: calc(100vh - 120px);
        position: relative !important;
        z-index: 1 !important;
    }
    
    /* Ensure main content is visible on mobile */
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding-top: 80px !important;
        display: block !important;
        visibility: visible !important;
        min-height: 100vh !important;
    }
    
    /* Force mobile dashboard content to be visible */
    #main-content[data-mobile="true"] {
        margin-left: 0 !important;
        width: 100% !important;
        display: block !important;
        position: relative !important;
        z-index: 1 !important;
    }
    
    /* Override any potential hiding of content */
    #overview-section, .dashboard-section.active {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
        overflow: visible !important;
    }
}

/* Force visibility for all screen sizes */
.dashboard-section.active,
#overview-section.active {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-height: 100vh;
}

/* Mobile header improvements */
@media (max-width: 640px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Header spacing adjustments */
    header .flex {
        gap: 0.5rem;
    }
    
    /* Ensure buttons don't overlap logo text */
    header .flex.justify-between {
        align-items: center;
        min-height: 4rem;
    }
    
    /* Hero section mobile optimizations */
    .py-20 {
        padding-top: 3rem;
        padding-bottom: 3rem;
    }
    
    /* Crypto ticker mobile responsiveness */
    .crypto-ticker .flex {
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: center;
    }
    
    .crypto-ticker .flex > div {
        font-size: 0.75rem;
    }
}

@media (min-width: 1024px) {
    .dashboard-section {
        padding: 1.5rem;
    }
}

/* Fix modal z-index issues */
.modal-overlay {
    z-index: 9999 !important;
}

/* Improve mobile scrolling */
body {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: none;
}

/* Mobile responsive styles */
.mobile-full-width {
    width: 100vw;
}

/* Enhanced mobile touch support */
.touch-manipulation {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

/* Mobile button improvements */
@media (max-width: 768px) {
    .touch-manipulation {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 16px;
    }
    
    /* Ensure buttons are easily tappable */
    button, a {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Mobile hamburger menu fix */
    #mobile-menu-btn {
        z-index: 9999 !important;
        position: fixed !important;
        top: 16px;
        left: 16px;
        border: 2px solid #374151;
        backdrop-filter: blur(10px);
    }
    
    /* Mobile header title positioning */
    .mobile-header-title {
        position: fixed;
        top: 20px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 9998;
        pointer-events: none;
    }
    
    /* Sidebar mobile positioning */
    #sidebar {
        z-index: 9998 !important;
    }
    
    /* Overlay mobile positioning */
    #mobile-sidebar-overlay {
        z-index: 9997 !important;
    }
}

/* Mobile-specific improvements */
@media (max-width: 1024px) {
    /* Fix sidebar width and main content margin */
    .main-content {
        margin-left: 0 !important;
    }
    
    /* Ensure full width on mobile */
    .mobile-full-width {
        width: 100% !important;
        margin-left: 0 !important;
    }
    
    /* Better mobile button sizing */
    .touch-manipulation {
        min-height: 44px;
        touch-action: manipulation;
    }
    
    /* Mobile grid improvements */
    .mobile-grid-1 {
        grid-template-columns: 1fr !important;
    }
    
    /* Mobile text sizing */
    .mobile-text-base {
        font-size: 1rem !important;
    }
    
    /* Mobile padding adjustments */
    .mobile-p-4 {
        padding: 1rem !important;
    }
}

/* Touch device improvements */
@media (hover: none) and (pointer: coarse) {
    /* Better touch targets */
    button, .button, .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Remove hover effects on touch devices */
    .hover\:bg-gray-700:hover {
        background-color: initial;
    }
    
    /* Active states for touch */
    button:active, .button:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
}

/* Mobile sidebar styling */
#sidebar {
    z-index: 1000;
    width: 280px;
}

.lg\:pl-64 {
    padding-left: 17.5rem;
}

/* Better spacing for main content */
@media (min-width: 1024px) {
    .lg\:ml-64 {
        margin-left: 290px !important;
    }
}

/* Ensure sidebar content doesn't overflow */
#sidebar .truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Better responsive logo text layout */
@media (max-width: 280px) {
    #sidebar h1 {
        font-size: 0.9rem;
    }
    #sidebar .text-xs {
        font-size: 0.7rem;
    }
}

/* Mobile optimizations */
@media (max-width: 768px) {
    /* Ensure buttons are properly sized for touch */
    button {
        min-height: 48px !important;
        min-width: 48px !important;
        padding: 12px 16px !important;
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
    
    /* Modal improvements for mobile */
    .modal-content {
        margin: 16px !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* Fix modal scrolling on mobile */
    .fixed.inset-0 {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* Modal inner content scrolling */
    .bg-crypto-darker {
        max-height: calc(90vh - 32px) !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* Fix iOS scroll issues */
    @supports (-webkit-overflow-scrolling: touch) {
        .fixed.inset-0 {
            position: fixed !important;
            overflow-y: scroll !important;
            -webkit-overflow-scrolling: touch !important;
        }
    }
    
    /* Force modal scrolling to work */
    [id$="Modal"] {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain !important;
    }
    
    /* Prevent background scroll when modal is open */
    body.modal-open {
        position: fixed !important;
        width: 100% !important;
        overflow: hidden !important;
    }
    
    /* Dashboard grid improvements */
    .grid-cols-1.md\\:grid-cols-2.lg\\:grid-cols-4 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
    
    /* Header improvements */
    .space-x-4 {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        justify-content: center !important;
    }
    
    .space-x-4 button {
        flex: 1 !important;
        min-width: 100px !important;
        margin: 0 !important;
    }
    
    /* Chart container mobile */
    .chart-container canvas {
        height: 250px !important;
        margin: 16px 0 !important;
    }
    
    /* Stats cards mobile */
    .bg-crypto-darker {
        padding: 12px !important;
        text-align: center !important;
    }
    
    /* Table responsiveness */
    .overflow-x-auto {
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* Text sizing for mobile */
    .text-3xl {
        font-size: 1.875rem !important;
    }
    
    .text-2xl {
        font-size: 1.5rem !important;
    }
    
    /* Fixed bottom indicator mobile */
    .fixed.bottom-4.right-4 {
        bottom: 80px !important;
        right: 16px !important;
        left: 16px !important;
        max-width: none !important;
        text-align: center !important;
    }
    
    /* Modal backdrop improvements */
    .fixed.inset-0 {
        padding: 16px !important;
    }
    
    /* Input improvements */
    input, textarea {
        font-size: 16px !important;
        min-height: 44px !important;
    }
    
    /* Prevent horizontal scroll */
    body {
        overflow-x: hidden !important;
    }
}

/* Modal backdrop blur */
.modal-backdrop {
    backdrop-filter: blur(5px);
}

/* Loading spinner */
.spinner {
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid #1e40af;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

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

/* Floating elements */
.floating {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Success/Error message styles */
.message-success {
    background: linear-gradient(135deg, #10b981, #059669);
    border: 1px solid #10b981;
}

.message-error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border: 1px solid #ef4444;
}

.message-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border: 1px solid #f59e0b;
    color: #000;
}

/* Table row hover effects */
tr:hover {
    background-color: rgba(30, 64, 175, 0.1);
}

/* Custom button styles */
.btn-crypto {
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-crypto:hover {
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(30, 64, 175, 0.3);
}

/* Profit/Loss indicators */
.profit-positive {
    color: #10b981;
}

.profit-negative {
    color: #ef4444;
}

/* Status indicators */
.status-active {
    color: #10b981;
}

.status-completed {
    color: #6b7280;
}

.status-failed {
    color: #ef4444;
}

/* Responsive improvements */
@media (max-width: 768px) {
    .trading-feed {
        font-size: 0.875rem;
    }
    
    .modal-content {
        margin: 1rem;
    }
}

/* MOBILE PROFESSIONAL STYLING */
@media (max-width: 768px) {
    /* Professional mobile button styling */
    button {
        border: none !important;
        outline: none !important;
        box-shadow: none !important;
        -webkit-appearance: none !important;
        background: transparent !important;
        color: inherit !important;
        font-family: inherit !important;
        font-size: inherit !important;
        padding: 0.75rem 1rem !important;
        border-radius: 8px !important;
        transition: all 0.3s ease !important;
    }
    
    /* Professional mobile text styling */
    h1, h2, h3, h4, h5, h6, p, span, div {
        color: #ffffff !important;
        font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
        font-weight: 400 !important;
        line-height: 1.5 !important;
        letter-spacing: 0.01em !important;
    }
    
    /* Professional mobile input styling */
    input, textarea, select {
        border: 1px solid #374151 !important;
        background: #1f2937 !important;
        color: #ffffff !important;
        padding: 0.75rem !important;
        border-radius: 8px !important;
        font-family: inherit !important;
        outline: none !important;
        box-shadow: none !important;
        -webkit-appearance: none !important;
    }
    
    /* Professional mobile card styling */
    .bg-crypto-dark, .bg-crypto-darker {
        background: #1f2937 !important;
        border: 1px solid #374151 !important;
        border-radius: 12px !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2) !important;
    }
}

/* Custom scrollable areas */
.custom-scroll {
    scrollbar-width: thin;
    scrollbar-color: #374151 #0a0b0f;
}


/* Mobile fullscreen optimization - FORCE BLACK BACKGROUND */
@media (max-width: 1024px) {
    html, body {
        margin: 0 !important;
        padding: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
        height: 100vh !important;
        min-height: 100vh !important;
        background: #0a0b0f !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        min-height: 100vh !important;
        max-width: 100vw !important;
        background: #0a0b0f !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        overflow-y: auto !important;
    }
    
    .dashboard-container {
        padding: 0.5rem !important;
        width: 100vw !important;
        max-width: 100vw !important;
        min-height: 100vh !important;
        box-sizing: border-box !important;
        background: #0a0b0f !important;
        margin: 0 !important;
    }
    
    /* FORCE ALL BACKGROUNDS TO BLACK */
    *:not(button):not(.bg-crypto-blue):not(.bg-crypto-green):not(.bg-crypto-purple):not([class*="gradient"]) {
        background: #0a0b0f !important;
        background-color: #0a0b0f !important;
    }
    
    .bg-crypto-dark,
    .bg-crypto-darker,
    div[class*="bg-crypto-dark"],
    section[class*="bg-crypto-dark"],
    header[class*="bg-crypto-dark"] {
        background: #0a0b0f !important;
        background-color: #0a0b0f !important;
    }
    
    /* Header mobile optimization */
    header {
        padding: 0.5rem !important;
        width: 100vw !important;
        max-width: 100vw !important;
        background: #0a0b0f !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 30 !important;
        border-bottom: 1px solid #1f2937 !important;
    }
    
    /* Mobile sidebar improvements */
    #sidebar {
        backdrop-filter: blur(10px);
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75);
        z-index: 50 !important;
        width: 280px !important;
        max-width: 85vw !important;
        height: 100vh !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        background: #151621 !important;
    }
    
    #sidebar-overlay {
        z-index: 40 !important;
        background: transparent !important;
        backdrop-filter: none !important;
    }
    
    /* Mobile menu button improvements */
    #mobile-menu-btn {
        z-index: 60 !important;
        backdrop-filter: blur(10px);
        position: fixed !important;
        top: 0.5rem !important;
        left: 0.5rem !important;
    }
    
    /* Grid improvements for mobile */
    .grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    /* Remove any viewport overflow */
    * {
        max-width: 100vw !important;
        box-sizing: border-box !important;
    }
}

/* Homepage title gradient fix */
h1.bg-gradient-to-r {
    background: linear-gradient(90deg, #60a5fa 0%, #a855f7 50%, #ec4899 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
}
