/* Custom scrollbar styles */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: hsl(var(--b3));
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: hsl(var(--bc / 0.3));
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--bc / 0.5));
}

/* Ensure consistent height */
html, body {
    height: 100%;
    overflow: hidden;
}

/* Main content area scrolling */
.content-area {
    height: calc(100vh - 4rem); /* Adjust based on your navbar height */
    overflow-y: auto;
}

/* Price change animations */
@keyframes price-flash {
    0% { opacity: 0.5; }
    100% { opacity: 1; }
}

@keyframes price-flash-up {
    0% { 
        opacity: 0.5;
        background-color: rgba(34, 197, 94, 0.1); /* green-500 with opacity */
    }
    100% { 
        opacity: 1;
        background-color: transparent;
    }
}

@keyframes price-flash-down {
    0% { 
        opacity: 0.5;
        background-color: rgba(239, 68, 68, 0.1); /* red-500 with opacity */
    }
    100% { 
        opacity: 1;
        background-color: transparent;
    }
}

/* Animation classes */
.flash-animation {
    animation: price-flash 1s ease-out;
    border-radius: 4px;
    padding: 0 4px;
    margin: 0 -4px;
}

.text-green-500.flash-animation {
    animation: price-flash-up 1s ease-out;
}

.text-red-500.flash-animation {
    animation: price-flash-down 1s ease-out;
}

/* Smooth transitions for price changes */
.ltp, .current-price, .current-ltp, .change, .change-percent, .price-change {
    transition: color 0.2s ease-in-out;
}

/* Market depth animations */
.market-depth {
    transition: all 0.2s ease-in-out;
    max-height: 500px;
    opacity: 1;
}

.market-depth.hidden {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

/* Price change display styles */
.change, .change-percent, .price-change {
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.2px;
}

/* Button hover effects */
.price-adjust {
    transition: all 0.15s ease-in-out;
}

.price-adjust:active {
    transform: scale(0.95);
}

/* Market depth icon rotation */
.market-depth-icon {
    transition: transform 0.2s ease-in-out;
}

.market-depth:not(.hidden) + button .market-depth-icon {
    transform: rotate(180deg);
}

/* Improve readability of numbers */
.ltp, .current-price, .current-ltp {
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.3px;
    font-weight: 500;
}

/* Optional: Add subtle hover effect on watchlist items */
.watchlist-item {
    transition: background-color 0.2s ease-in-out;
}

.watchlist-item:hover {
    background-color: hsl(var(--b2));
}

/* Price info styles */
.price-info {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.price-info .ltp {
    font-variant-numeric: tabular-nums;
}

.price-info .change,
.price-info .change-percent {
    font-variant-numeric: tabular-nums;
    display: none; /* Initially hidden, will be shown based on settings */
}

/* Show elements when settings are enabled */
.price-info[data-show-change="true"] .change,
.price-info[data-show-change-percent="true"] .change-percent {
    display: inline;
}

/* Optional: Add hover effect for the whole item */
.watchlist-item {
    transition: background-color 0.2s ease-in-out;
}

.watchlist-item:hover .order-buttons {
    display: flex;
    gap: 0.25rem;
}

/* Order buttons styling */
.buy-btn, .sell-btn {
    min-height: 1.5rem;
    height: 1.5rem;
    padding: 0 0.5rem;
}

/* Theme Switcher Enhanced Styles */
.theme-switcher {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    padding: 0.75rem 1rem;
    border-radius: 2rem;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
}

/* Light theme styles */
[data-theme='light'] .theme-switcher {
    background: rgba(226, 232, 240, 0.95); /* Slightly darker background */
    border: 1px solid rgba(148, 163, 184, 0.2); /* Subtle border */
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Dark theme styles */
[data-theme='dark'] .theme-switcher {
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.2),
        0 2px 4px -1px rgba(0, 0, 0, 0.1);
}

/* Theme icons */
.theme-icon {
    width: 1.25rem;
    height: 1.25rem;
    transition: all 0.3s ease;
    stroke-width: 2px;
}

/* Dark theme icon states */
[data-theme='dark'] .theme-icon-dark {
    opacity: 1;
    color: rgb(250, 204, 21); /* Bright yellow for moon */
}

[data-theme='dark'] .theme-icon-light {
    opacity: 0.4;
    color: rgb(226, 232, 240);
}

/* Light theme icon states */
[data-theme='light'] .theme-icon-dark {
    opacity: 1;
    color: rgb(30, 41, 59); /* Dark color for better contrast */
}

[data-theme='light'] .theme-icon-light {
    opacity: 1;
    color: rgb(234, 88, 12); /* Orange for sun */
}

/* Toggle switch styles */
.theme-controller {
    --tglbg: var(--bc);
    border-color: var(--bc);
}

[data-theme='light'] .theme-controller {
    background-color: rgb(203, 213, 225) !important; /* Slightly darker in light mode */
}

[data-theme='dark'] .theme-controller {
    background-color: rgb(51, 65, 85) !important; /* Darker in dark mode */
}

/* Hover effects */
.theme-switcher:hover {
    transform: translateY(-2px);
}

[data-theme='light'] .theme-switcher:hover {
    background: rgba(203, 213, 225, 0.95); /* Darker on hover in light mode */
}

[data-theme='dark'] .theme-switcher:hover {
    background: rgba(30, 41, 59, 0.98); /* Slightly darker on hover in dark mode */
}

/* Mobile adjustments */
@media (max-width: 640px) {
    .theme-switcher {
        bottom: 1rem;
        right: 1rem;
        padding: 0.5rem 0.75rem;
    }
}

/* Optional: Add focus styles for accessibility */
.theme-switcher:focus-within {
    outline: 2px solid hsl(var(--p));
    outline-offset: 2px;
}

/* Ensure footer doesn't overlap theme switcher */
.footer {
    padding-right: 5rem;
}

@media (max-width: 640px) {
    .theme-switcher {
        bottom: 1rem;
        right: 1rem;
    }
}


/* Watchlist Item Styles */
.watchlist-item {
    transition: all 0.2s ease-in-out;
    position: relative;
    border: 1px solid transparent;
}

/* Light theme hover styles */
[data-theme='light'] .watchlist-item:hover {
    background-color: rgba(243, 244, 246, 0.8);  /* Light gray with opacity */
    border-color: rgba(209, 213, 219, 0.5);      /* Subtle border */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Dark theme hover styles */
[data-theme='dark'] .watchlist-item:hover {
    background-color: rgba(17, 24, 39, 0.7);     /* Dark gray with opacity */
    border-color: rgba(55, 65, 81, 0.5);         /* Subtle border */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Market depth section styles */
.market-depth {
    backdrop-filter: blur(8px);
    border-top: 1px solid transparent;
}

[data-theme='light'] .market-depth {
    background-color: rgba(249, 250, 251, 0.95);  /* Very light background */
    border-color: rgba(229, 231, 235, 0.5);
}

[data-theme='dark'] .market-depth {
    background-color: rgba(17, 24, 39, 0.95);     /* Dark background */
    border-color: rgba(55, 65, 81, 0.5);
}

/* Buy/Sell button styles */
.order-buttons {
    transition: opacity 0.2s ease-in-out;
}

/* Override default button colors */
.btn-xs.buy-btn {
    background-color: rgba(34, 197, 94, 0.9) !important;  /* Slightly transparent green */
    border: none;
}

.btn-xs.sell-btn {
    background-color: rgba(239, 68, 68, 0.9) !important;  /* Slightly transparent red */
    border: none;
}

/* Hover effects for buttons */
.btn-xs.buy-btn:hover {
    background-color: rgb(34, 197, 94) !important;
    transform: translateY(-1px);
}

.btn-xs.sell-btn:hover {
    background-color: rgb(239, 68, 68) !important;
    transform: translateY(-1px);
}

/* Add subtle accent on active watchlist item */
.watchlist-item.active {
    border-left: 2px solid hsl(var(--p));
}

/* Improve readability of symbol info */
.symbol-name {
    font-weight: 500;
    letter-spacing: -0.01em;
}

.exchange-name {
    opacity: 0.7;
}


/* Market Depth Modern Styling */
.market-depth {
    border-radius: 0.5rem;
    margin: 0.5rem;
    padding: 0.75rem;
}

/* Light theme depth styling */
[data-theme='light'] .market-depth {
    background: linear-gradient(
        145deg,
        rgba(255, 255, 255, 0.95) 0%,
        rgba(249, 250, 251, 0.95) 100%
    );
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.05),
        0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

/* Dark theme depth styling */
[data-theme='dark'] .market-depth {
    background: linear-gradient(
        145deg,
        rgba(17, 24, 39, 0.95) 0%,
        rgba(24, 31, 46, 0.95) 100%
    );
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.2),
        0 2px 4px -1px rgba(0, 0, 0, 0.1);
}

/* OHLC and Volume stats styling */
.market-depth table th,
.market-depth .grid {
    font-size: 0.75rem;
    opacity: 0.8;
}

/* Bid/Ask prices */
.bid-price {
    color: rgb(34, 197, 94) !important;  /* Green */
    font-weight: 500;
}

.ask-price {
    color: rgb(239, 68, 68) !important;  /* Red */
    font-weight: 500;
}

/* Add subtle hover effect on prices */
.bid-price:hover,
.ask-price:hover {
    opacity: 0.8;
    transform: translateY(-1px);
    transition: all 0.2s ease;
}

/* Volume stats styling */
.volume-stats {
    font-size: 0.75rem;
    opacity: 0.8;
    padding-top: 0.5rem;
    margin-top: 0.5rem;
    border-top: 1px solid rgba(156, 163, 175, 0.1);
}

/* Hide scrollbars but keep functionality */
.market-depth {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.market-depth::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}