/* 
 * Mobile-specific styles for XCoin Trading Platform
 * Enhances mobile experience with better touch targets and responsive layouts
 */

/* General mobile optimizations */
.mobile-optimized {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    -webkit-touch-callout: none;
    touch-action: manipulation;
}

/* Fix for 100vh issue on mobile browsers */
:root {
    --vh: 1vh;
}

/* Use the custom viewport height variable */
.sidebar {
    height: 100vh;
    height: calc(var(--vh, 1vh) * 100);
    transition: left 0.3s ease;
}

/* Mobile sidebar toggle button */
.mobile-sidebar-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1030;
    display: none;
}

/* Enhanced header styling for mobile */
.top-nav {
    position: relative;
    z-index: 1000;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, rgba(25, 30, 45, 0.95) 0%, rgba(21, 25, 39, 0.98) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Improved header layout for better alignment */
.top-nav .d-flex {
    align-items: center !important;
}

/* Enhanced mobile menu button */
#mobileSidebarToggle {
    font-size: 1.25rem;
    padding: 0.5rem;
    margin-right: 0.5rem;
    z-index: 1500;
    background: transparent;
    border: none;
    color: var(--text-color, #fff);
    transition: all 0.2s;
    min-width: 38px;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

#mobileSidebarToggle:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

#mobileSidebarToggle:active {
    transform: scale(0.95);
    background-color: rgba(255, 255, 255, 0.12);
}

/* Logo styling in header */
.top-nav .logo-small {
    height: 34px !important;
    width: auto;
    margin-right: 0.5rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.gradient-text {
    background: linear-gradient(45deg, #6ab3fa, #9473fd);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 8px rgba(106, 179, 250, 0.3);
    font-weight: 700;
}

/* Icon containers for better spacing */
.top-nav .btn-link {
    padding: 0.5rem;
    margin: 0 0.25rem;
    border-radius: 10px;
    min-width: 42px;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: rgba(255, 255, 255, 0.85);
    background-color: rgba(255, 255, 255, 0.05);
}

.top-nav .btn-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.top-nav .btn-link:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.top-nav .dropdown {
    display: flex;
    align-items: center;
}

/* Profile image styling in header */
.profile-img-header {
    width: 38px !important;
    height: 38px !important;
    border: 2px solid rgba(255, 255, 255, 0.15);
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    object-fit: cover !important;
}

#userDropdown {
    border-radius: 50%;
    padding: 2px;
    background: linear-gradient(45deg, rgba(106, 179, 250, 0.2), rgba(148, 115, 253, 0.2));
    transition: all 0.2s;
}

#userDropdown:hover {
    background: linear-gradient(45deg, rgba(106, 179, 250, 0.3), rgba(148, 115, 253, 0.3));
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

#userDropdown:hover .profile-img-header {
    border-color: rgba(255, 255, 255, 0.3);
}

.xcoin-price-container {
    max-width: 100%;
    padding: 0.25rem 0.5rem;
    background-color: rgba(38, 50, 78, 0.6);
    border-radius: 8px;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.xcoin-price-container.touch-active {
    background-color: rgba(38, 50, 78, 0.8);
    transform: scale(0.98);
}

.xcoin-price-container.small-mobile {
    padding: 0.2rem 0.4rem;
}

.xcoin-price-container.tiny-mobile {
    padding: 0.15rem 0.3rem;
}

.mobile-balance {
    font-size: 0.85rem;
    opacity: 0.9;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.price-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
}

.price-value {
    font-size: 1.1rem !important;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.price-change {
    font-size: 0.8rem;
    padding: 0.1rem 0.3rem !important;
    border-radius: 4px;
}

.price-change.positive {
    background-color: rgba(76, 175, 80, 0.2);
    color: #4caf50 !important;
}

.price-change.negative {
    background-color: rgba(244, 67, 54, 0.2);
    color: #f44336 !important;
}

/* Mobile warning styling */
.mobile-warning {
    display: block !important;
    padding: 0.6rem 0.8rem;
    margin: 0.5rem 0.75rem;
    background-color: rgba(255, 152, 0, 0.1);
    border-left: 3px solid #ff9800;
    color: #ff9800;
    font-size: 0.85rem;
    border-radius: 4px;
}

/* Expanded header for larger content */
.expanded-header {
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
}

/* Enhanced sidebar styles */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 260px;
    background: linear-gradient(180deg, rgba(25, 30, 45, 1) 0%, rgba(21, 25, 39, 1) 100%);
    z-index: 1050;
    overflow-y: auto;
    transition: left 0.3s ease, transform 0.3s ease;
    box-shadow: 3px 0 15px rgba(0, 0, 0, 0.2);
    border-right: 1px solid rgba(255, 255, 255, 0.07);
}

.sidebar-header {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-header .logo {
    height: 38px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.sidebar-nav {
    padding: 1rem 0;
}

.sidebar-nav .nav-link {
    padding: 0.85rem 1.5rem;
    color: rgba(255, 255, 255, 0.75);
    display: flex;
    align-items: center;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    position: relative;
    margin: 4px 0;
}

.sidebar-nav .nav-link i {
    margin-right: 12px;
    font-size: 1.1rem;
    min-width: 24px;
    text-align: center;
    transition: all 0.2s;
    opacity: 0.8;
}

.sidebar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.95);
    padding-left: 1.7rem;
}

.sidebar-nav .nav-link:hover i {
    opacity: 1;
    transform: translateX(3px);
}

.sidebar-nav .nav-link.active {
    background: linear-gradient(90deg, rgba(106, 179, 250, 0.15), rgba(255, 255, 255, 0));
    color: #fff;
    border-left: 3px solid #6ab3fa;
}

.sidebar-nav .nav-link.active i {
    color: #6ab3fa;
    opacity: 1;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(0, 0, 0, 0.1);
}

/* Close button for mobile sidebar */
#closeSidebar {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 1.25rem;
    background: rgba(0, 0, 0, 0.2);
    border: none;
    color: var(--text-color, #fff);
    opacity: 0.7;
    cursor: pointer;
    display: none;
    z-index: 1060;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

#closeSidebar:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1040;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(3px);
    opacity: 0;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

.sidebar.active {
    left: 0;
    transform: translateX(0);
}

.main-content {
    margin-left: 260px;
    transition: margin-left 0.3s ease;
}

/* Responsive design for all screen sizes */
@media (max-width: 991px) {
    .xcoin-price-container {
        flex-wrap: wrap;
        justify-content: space-between;
        width: 100%;
        max-width: 320px;
        padding: 0.35rem 0.6rem;
    }
    
    .price-info {
        flex-wrap: wrap;
        justify-content: space-around;
        width: 100%;
        margin-top: 10px;
    }
    
    .price-info > div {
        padding: 5px 10px;
    }
    
    #current-xcoin-price-wrapper {
        width: 100%;
        justify-content: center;
    }
    
    .row.mb-4.mt-3.mx-2 .col-md-3 {
        margin-bottom: 15px;
    }
    
    .card {
        margin-bottom: 20px;
    }
    
    .btn-group .btn-sm {
        padding: 0.25rem 0.4rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 768px) {
    #mobileSidebarToggle {
        display: flex;
    }
    
    #closeSidebar {
        display: block;
    }
    
    .sidebar {
        left: -300px;
        transform: translateX(-20px);
        width: 280px;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .mobile-sidebar-toggle {
        display: block;
    }
    
    .mobile-sidebar-toggle button {
        width: 50px;
        height: 50px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    }
    
    /* Top navigation enhancements for mobile */
    .top-nav {
        padding: 0.5rem 0.75rem;
        display: flex;
        flex-wrap: wrap;
    }
    
    .top-nav .d-flex {
        width: 80%;
    }
    
    /* Better touch targets */
    .btn, 
    .nav-link, 
    .form-control,
    .dropdown-item {
        min-height: 44px;
    }
    
    /* Larger checkboxes and radio buttons */
    input[type="checkbox"],
    input[type="radio"] {
        width: 20px;
        height: 20px;
    }
    
    /* Improved card spacing on mobile */
    .card {
        margin-bottom: 15px;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* Better spacing for small screens */
    .container-fluid {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .row {
        margin-left: -10px;
        margin-right: -10px;
    }
    
    .row > [class*="col-"] {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    /* Table improvements for mobile */
    .table th, 
    .table td {
        padding: 0.5rem;
    }
    
    /* Fix for modals on mobile */
    .modal-dialog {
        margin: 0.5rem;
    }
    
    /* Fix for price chart on mobile */
    #price-chart, 
    #chart {
        height: 300px !important;
    }
    
    /* Optimized trade buttons for mobile */
    #price-rise-btn, 
    #price-fall-btn {
        padding: 0.8rem;
        font-size: 1rem;
    }
    
    /* More compact form elements */
    .form-label {
        margin-bottom: 0.25rem;
    }
    
    .form-control {
        font-size: 16px; /* Prevents iOS zoom on focus */
    }
    
    /* Responsive recent trades table */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Enhanced sidebar navigation */
    .sidebar-nav .nav-link {
        padding: 0.75rem 1rem;
        transition: background-color 0.2s ease;
    }
    
    .sidebar-nav .nav-link:active {
        background-color: rgba(255, 255, 255, 0.1);
        transform: scale(0.98);
    }
    
    /* Close sidebar button */
    #closeSidebar {
        font-size: 1.2rem;
        padding: 0.5rem;
    }
    
    /* Prevent body scrolling when sidebar is open */
    body.sidebar-open {
        overflow: hidden;
    }
}

/* Very small screens */
@media (max-width: 576px) {
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.875rem;
    }
    
    .top-nav {
        padding: 0.5rem 0.75rem;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    h5 {
        font-size: 1.1rem;
    }
    
    .footer {
        padding: 1rem 0;
        font-size: 0.875rem;
    }
    
    /* Table improvements for very small screens */
    .table th, 
    .table td {
        padding: 0.4rem;
        font-size: 0.8rem;
    }
    
    /* Overflow for long content */
    .text-truncate-mobile {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 120px;
    }
    
    /* Chart height for very small screens */
    #price-chart, 
    #chart {
        height: 250px !important;
    }
    
    /* Stack time interval buttons */
    .btn-group {
        display: flex;
        flex-wrap: wrap;
    }
    
    .btn-group .btn {
        flex: 1 0 auto;
        margin-bottom: 5px;
    }
    
    /* Make the current price more visible */
    #current-xcoin-price {
        font-size: 1.5rem;
    }
    
    /* Better spacing for trade buttons */
    #price-rise-btn, 
    #price-fall-btn {
        padding: 0.7rem;
    }
    
    /* Show fewer columns in tables on very small screens */
    .table-responsive-xs {
        width: 100%;
    }
    
    .table-responsive-xs table {
        width: 100%;
    }
    
    .table-responsive-xs .mobile-optional-column {
        display: none;
    }
    
    /* Adjust XCoin price container sizing for very small screens */
    .xcoin-price-container {
        padding: 0.3rem;
        max-width: 220px;
        margin: 0.2rem auto;
    }
    
    .price-value {
        font-size: 1rem !important;
    }
    
    .price-change {
        font-size: 0.75rem;
        line-height: 1;
    }
    
    .mobile-balance {
        font-size: 0.8rem;
        margin-top: 0.15rem;
    }
    
    /* Adjust positioning of header elements */
    .top-nav .btn-link {
        padding: 0.25rem;
    }
    
    /* Make profile image slightly smaller */
    .profile-img-header {
        width: 28px !important;
        height: 28px !important;
    }
}

/* iPhone SE and other small devices */
@media (max-width: 375px) {
    .btn {
        padding: 0.375rem 0.75rem;
    }
    
    .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    #price-chart, 
    #chart {
        height: 200px !important;
    }
    
    .nav-link {
        padding: 0.6rem 0.75rem;
    }
    
    /* Even smaller tables */
    .table th, 
    .table td {
        padding: 0.35rem;
        font-size: 0.75rem;
    }
    
    /* Adjust the summary cards */
    .row.mb-4.mt-3.mx-2 .col-md-3 h3 {
        font-size: 1.3rem;
    }
    
    /* Even more compact card padding */
    .card-body {
        padding: 0.6rem;
    }
    
    /* Make form inputs bigger */
    .form-control {
        height: 38px;
    }
    
    /* Extremely small screens price adjustments */
    .price-value {
        font-size: 0.9rem !important;
    }
    
    .price-label {
        font-size: 0.8rem;
    }
    
    .price-change {
        font-size: 0.7rem;
        padding: 0.05rem 0.2rem !important;
    }
}

/* Fix for iOS input zoom */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    select,
    textarea,
    input[type="text"],
    input[type="password"],
    input[type="number"],
    input[type="email"] {
        font-size: 16px !important;
    }
}

/* Better scrolling on mobile */
.scrollable-mobile {
    -webkit-overflow-scrolling: touch;
}

/* Animations optimized for mobile */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Make tables more responsive on mobile */
.table-responsive-mobile {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Fixed position elements adjustments for mobile */
.mobile-fixed-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1020;
    background-color: var(--secondary-bg);
    padding: 10px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

/* Show/hide elements based on screen size */
.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only {
        display: block;
    }
    
    .desktop-only {
        display: none;
    }
}

/* Desktop dropdown styles (override bootstrap) */
@media (min-width: 577px) {
    .dropdown-menu {
        background: linear-gradient(180deg, rgba(30, 35, 50, 0.97) 0%, rgba(25, 30, 45, 0.98) 100%);
        border: 1px solid rgba(255, 255, 255, 0.08);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3) !important;
        border-radius: 12px !important;
        overflow: hidden;
        min-width: 280px;
    }
    
    .dropdown-item {
        color: rgba(255, 255, 255, 0.85);
        padding: 0.75rem 1.25rem;
        transition: all 0.2s;
    }
    
    .dropdown-item:hover, .dropdown-item:active {
        background-color: rgba(255, 255, 255, 0.08);
        color: #fff;
    }
    
    .dropdown-divider {
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        margin: 0.5rem 0;
    }
    
    /* Position user dropdown menu right-aligned */
    #userDropdown + .dropdown-menu {
        right: 0 !important;
        left: auto !important;
    }
    
    /* Position notification dropdown menu right-aligned */
    .notification-dropdown .dropdown-menu {
        right: 0 !important;
        left: auto !important;
        width: 320px;
        max-height: 500px;
        overflow-y: auto;
    }
}

/* Enhanced dropdown menu for mobile */
@media (max-width: 576px) {
    /* Top navigation styling */
    .top-nav {
        padding: 0.6rem 1rem;
    }
    
    /* Header flex container improvement */
    .top-nav .d-flex.justify-content-between {
        justify-content: space-between !important;
        flex-wrap: nowrap !important;
    }
    
    /* Left side container */
    .top-nav .d-flex.align-items-center {
        flex: 0 0 auto;
    }
    
    /* Logo styling for header */
    .logo-small {
        height: 30px !important;
        width: auto;
    }
    
    /* Right side icons improvement */
    .top-nav .dropdown {
        margin-left: 0.25rem;
    }
    
    /* Notification badge position fix */
    .notification-badge {
        top: 0px !important;
        right: 0px !important;
        transform: translate(25%, -25%) !important;
        font-size: 0.65rem !important;
        padding: 0.2rem 0.4rem !important;
    }
    
    /* Improved dropdown positioning for mobile */
    .dropdown-menu {
        position: fixed !important;
        top: auto !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        bottom: 0 !important;
        margin: 0;
        border-radius: 16px 16px 0 0 !important;
        border: none;
        box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.3) !important;
        max-height: 80vh !important;
        overflow-y: auto !important;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        z-index: 1080 !important;
        padding: 0.75rem 0;
        background: linear-gradient(180deg, rgba(30, 35, 50, 0.97) 0%, rgba(25, 30, 45, 0.98) 100%);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
    
    .dropdown-menu.show {
        transform: translateY(0) !important;
    }
    
    .dropdown-menu::after {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: rgba(255, 255, 255, 0.2);
        border-radius: 4px;
        margin: 0.5rem auto;
        position: absolute;
        top: 8px;
        left: 0;
        right: 0;
}

    /* Position from bottom for user dropdown */
    .dropdown-menu-up {
        bottom: 0 !important;
        transform: none !important;
}

    /* Fix for notification dropdown */
    .notification-dropdown .dropdown-menu {
        max-height: 70vh !important;
    }
    
    /* Improved touch target for dropdown items */
    .dropdown-item {
        padding: 0.85rem 1.25rem;
    min-height: 44px;
        display: flex;
        align-items: center;
        transition: background-color 0.2s;
        color: rgba(255, 255, 255, 0.85);
    }
    
    .dropdown-item:hover, .dropdown-item:active {
        background-color: rgba(255, 255, 255, 0.08);
        color: #fff;
    }
    
    .dropdown-divider {
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        margin: 0.5rem 0;
    }
}

/* Fix for safe areas on modern mobile browsers */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .dropdown-menu-up {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .sidebar {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Fix for Bootstrap dropdown positioning */
.dropdown-menu.show {
    z-index: 1060;
}

/* Improved visible feedback for active elements */
.nav-link:active,
.dropdown-item:active,
.btn:active {
    transform: scale(0.98);
    transition: transform 0.1s;
}

/* Bottom fixed mobile navigation */
.mobile-fixed-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    z-index: 1020;
    display: none;
}

@media (max-width: 768px) {
    .mobile-fixed-bottom {
        display: flex;
    }
    
    /* Add padding to ensure content is not hidden behind fixed navigation */
    .main-content {
        padding-bottom: calc(56px + 1rem);
    }
}

/* Fixed position button for mobile actions */
.mobile-action-button {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 1010;
    display: none;
}

@media (max-width: 768px) {
    .mobile-action-button {
        display: flex;
    }
}

/* Safe area insets for modern mobile browsers */
.safe-area-padding-bottom {
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.safe-area-padding-top {
    padding-top: env(safe-area-inset-top, 0);
}

/* Improved accessibility for touch targets */
@media (max-width: 768px) {
    .nav-link,
    .dropdown-item,
    button,
    .form-check-label,
    .form-control {
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(var(--bs-primary-rgb), 0.1);
    }
}

/* Balance display improvements for mobile */
.balance-display-container {
    text-align: center;
    background-color: rgba(38, 50, 78, 0.3);
    border-radius: 6px;
    padding: 0.5rem;
    margin: 0.5rem 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.balance-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.2rem;
}

.balance-change {
    font-size: 0.8rem;
    color: #4caf50;
}

/* Fix overlapping elements in the mobile header */
@media (max-width: 576px) {
    .main-content {
        padding-top: 0.5rem;
    }
    
    /* Handle very large balances by truncating with ellipsis */
    .balance-value {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
        font-size: 1.25rem;
    }
    
    /* Adjust cycle info for better visibility */
    #cycle-info {
        margin: 0.4rem 0.5rem 0.8rem;
        padding: 0.5rem 0.75rem;
        border-radius: 6px;
        font-size: 0.85rem;
    }
}

@media (max-width: 375px) {
    .balance-value {
        font-size: 1.1rem;
    }
    
    .balance-change {
        font-size: 0.7rem;
    }
}

/* Style for highlighted balances */
.balance-highlight {
    animation: balance-pulse 1.5s ease-in-out;
}

@keyframes balance-pulse {
    0% { background-color: rgba(38, 50, 78, 0.3); }
    50% { background-color: rgba(76, 175, 80, 0.2); }
    100% { background-color: rgba(38, 50, 78, 0.3); }
}

/* Dropdown overlay for mobile */
.dropdown-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1070;
    transition: opacity 0.2s;
    opacity: 0;
    backdrop-filter: blur(3px);
}

.dropdown-overlay.active {
    display: block;
    opacity: 1;
}

/* Mobile dropdown styles */
.mobile-menu {
    position: fixed !important;
    top: auto !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    bottom: 0 !important;
    margin: 0;
    border-radius: 16px 16px 0 0 !important;
    border: none;
    box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.3) !important;
    max-height: 80vh !important;
    overflow-y: auto !important;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 1080 !important;
    padding: 0.75rem 0;
    background: linear-gradient(180deg, rgba(30, 35, 50, 0.97) 0%, rgba(25, 30, 45, 0.98) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.mobile-menu.show {
    transform: translateY(0) !important;
}

.mobile-menu::after {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    margin: 0.5rem auto;
    position: absolute;
    top: 8px;
    left: 0;
    right: 0;
}

/* Override Bootstrap dropdown styles for mobile */
@media (max-width: 576px) {
    /* Ensure dropdowns are visible on mobile */
    .dropdown-menu {
        display: block;
        visibility: hidden;
        opacity: 0;
        transform: translateY(100%);
        transition: transform 0.3s ease, opacity 0.3s ease, visibility 0s linear 0.3s;
    }
    
    .dropdown-menu.show {
        visibility: visible;
        opacity: 1;
        transition: transform 0.3s ease, opacity 0.3s ease;
    }
    
    /* Remove Bootstrap's dropdown-toggle caret */
    .dropdown-toggle::after {
        display: none !important;
    }
    
    /* Ensure notification badge is visible */
    .notification-badge {
        top: 0px !important;
        right: 0px !important;
        transform: translate(25%, -25%) !important;
    }
}

/* Dropdown overlay for mobile */
.dropdown-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1070;
    transition: opacity 0.2s;
    opacity: 0;
    backdrop-filter: blur(3px);
}

.dropdown-overlay.active {
    display: block;
    opacity: 1;
} 