/* =========================================================
   Projects Carousel - cleaned final
   Fixes:
   - no second row / no overlap layers
   - arrows visible, not overlapping content
   - swipe stability (no drift)
   =========================================================


/* Hero section styles */
.hero-right {
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
}

.hero-chart-card {
    width: 100% !important;
    max-width: 680px !important;
    padding: 30px 30px 26px !important;
    border-radius: 20px !important;
    box-shadow: none !important;
    background-color: transparent !important;
    background: transparent !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    border: none !important;
}

.hero-chart-wrap {
    position: relative;
    height: 280px;
    width: 100%;
}

.hero-chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}


@media (max-width: 991.98px) {
    .hero-chart-wrap {
        height: 260px;
    }

    .hero-right {
        justify-content: center;
        margin-top: 20px;
    }
}

/* Partners section styles */
.partners-section {
    background-color: #ffffff;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.partners-section .partners-wrapper {
    background-color: #ffffff;
    padding: 20px;
    border-radius: 12px;
}

.partners-section .partners-row {
    background-color: #ffffff !important;
    margin: 0 !important;
}

.partners-section .partners-row > * {
    background-color: #ffffff !important;
}

/* =========================================================
   Modal Scrollbar Fix
   Prevents page shift and black bar when modal opens
   ========================================================= */

/* When modal is open, prevent body from shifting */
body.modal-open {
    padding-right: 0 !important;
    overflow: hidden !important;
    margin-right: 0 !important;
}

/* Also fix navbar and fixed elements when modal is open */
body.modal-open .navbar,
body.modal-open header,
body.modal-open footer {
    padding-right: 0 !important;
}

/* Ensure modal backdrop doesn't cause overflow */
.modal-backdrop {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Prevent modal content from causing horizontal scroll */
.modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

/* Modal dialog centering */
.modal-dialog {
    margin: 1.75rem auto !important;
    max-width: 500px;
}

.modal-dialog-centered {
    display: flex !important;
    align-items: center !important;
    min-height: calc(100% - 3.5rem) !important;
}

/* Ensure modal content doesn't overflow */
.modal-content {
    max-width: 100%;
    overflow: hidden;
}

/* =========================================================
   Mobile Dropdown Positioning Fix
   Prevents dropdowns from appearing on the right side
   and causing huge gaps in the navbar on mobile (< 992px)
   
   Makes dropdowns float above the menu instead of 
   expanding the container
   ========================================================= */

@media (max-width: 991px) {
    /* Ensure dropdown wrappers have position: relative */
    .nav-item.dropdown,
    .nav-item .dropdown {
        position: relative !important;
        display: block !important;
    }
    
    /* Make dropdowns absolute - float above menu content */
    .nav-item.dropdown .dropdown-menu,
    .nav-item .dropdown .dropdown-menu {
        position: absolute !important;
        z-index: 1000 !important;
        /* Position directly below the button */
        top: 100% !important;
        left: 0 !important;
        right: auto !important;
        bottom: auto !important;
        /* Reset any transforms */
        transform: none !important;
        /* Spacing and sizing */
        margin-top: 8px !important;
        min-width: 250px !important;
        max-width: 90vw !important;
        /* Ensure dropdown doesn't affect layout */
        float: none !important;
    }
    
    /* Specific fix for language dropdown */
    .nav-item .dropdown:first-child .dropdown-menu {
        left: 0 !important;
        right: auto !important;
    }
    
    /* Specific fix for notifications dropdown */
    .nav-item.dropdown .dropdown-menu.p-0,
    .nav-item.dropdown .dropdown-menu.dropdown-menu-end {
        left: 0 !important;
        right: auto !important;
    }
    
    /* Override Bootstrap's dropdown-menu-end on mobile */
    .dropdown-menu-end {
        left: 0 !important;
        right: auto !important;
    }
    
    /* Override Popper.js positioning on mobile - highest specificity */
    .dropdown-menu[data-bs-popper] {
        position: absolute !important;
        top: 100% !important;
        left: 0 !important;
        right: auto !important;
        bottom: auto !important;
        transform: none !important;
    }
    
    /* Prevent dropdown from pushing content */
    .navbar-nav .nav-item.dropdown {
        min-height: auto !important;
    }
}

@media (max-width: 767px) {
    .nav-item.dropdown .dropdown-menu,
    .nav-item .dropdown .dropdown-menu {
        max-width: 95vw !important;
        left: 0 !important;
        right: auto !important;
    }
}

/* =========================================================
   Specific fixes for notification and profile dropdowns
   on mobile sidebar
   ========================================================= */

@media (max-width: 991px) {
    /* Notification dropdown specific */
    .nav-item.dropdown:has(.bi-bell) .dropdown-menu {
        position: absolute !important;
        left: 0 !important;
        right: auto !important;
        top: 100% !important;
        min-width: 280px !important;
        max-width: 90vw !important;
    }
    
    /* Profile dropdown specific */
    .nav-item.dropdown:has(#navbarDropdown) .dropdown-menu {
        position: absolute !important;
        left: 0 !important;
        right: auto !important;
        top: 100% !important;
        min-width: 280px !important;
        max-width: 90vw !important;
    }
    
    /* Ensure dropdown toggles don't move when dropdown opens */
    .nav-item.dropdown .dropdown-toggle {
        display: block !important;
        width: 100% !important;
    }
}

/* =========================================================
   Mobile User Slide-up Panel
   Full-screen overlay with slide-up animation
   ========================================================= */

.mobile-user-panel {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-user-panel.active {
    display: block;
    opacity: 1;
}

.mobile-user-panel-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.mobile-user-panel-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 85vh;
    background: var(--fintech-bg-secondary);
    border-radius: 24px 24px 0 0;
    padding: 24px;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15);
}

.mobile-user-panel.active .mobile-user-panel-content {
    transform: translateY(0);
}

/* Header */
.mobile-user-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--fintech-border-light);
}

/* Balance section */
.mobile-user-balance-section {
    background: var(--fintech-bg-tertiary);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}

/* Actions */
.mobile-user-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.mobile-user-actions .btn {
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
}

/* Navigation */
.mobile-user-nav-section {
    background: var(--fintech-bg-tertiary);
    border-radius: 16px;
    padding: 8px;
    margin-bottom: 20px;
}

.mobile-user-nav-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    color: var(--fintech-text-primary);
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.2s ease;
    font-size: 15px;
    font-weight: 500;
}

.mobile-user-nav-item:hover {
    background: var(--fintech-bg-secondary);
    color: var(--fintech-primary);
}

.mobile-user-nav-item i {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

/* Logout section */
.mobile-user-logout-section {
    padding-top: 16px;
    border-top: 1px solid var(--fintech-border-light);
}

.mobile-user-logout-section .btn {
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 600;
}

/* Prevent body scroll when panel is open */
body.mobile-panel-open {
    overflow: hidden;
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .mobile-user-panel-content {
        padding: 20px;
        max-height: 90vh;
    }

    .mobile-user-actions .btn {
        padding: 12px 16px;
        font-size: 14px;
    }
}

/* =========================================================
   Stop Copy Trading Modal - Fix for mobile stretching
   Override .modal-dialog-centered for stop trading modal only
   ========================================================= */

/* Stop Trading Modal - don't stretch on mobile */
.stop-trading-modal .modal-dialog {
    min-height: auto !important;
    height: auto !important;
    display: block !important;
    align-items: normal !important;
    margin: 1rem auto !important;
    max-width: 420px !important;
}

.stop-trading-modal .modal-content {
    max-height: calc(100vh - 2rem) !important;
    overflow-y: auto !important;
    display: flex !important;
    flex-direction: column !important;
}

.stop-trading-modal .modal-header,
.stop-trading-modal .modal-footer {
    flex-shrink: 0 !important;
}

.stop-trading-modal .modal-body {
    flex-grow: 1 !important;
    overflow-y: auto !important;
}

/* Mobile specific */
@media (max-width: 576px) {
    .stop-trading-modal .modal-dialog {
        margin: 0.75rem auto !important;
        max-width: calc(100% - 1.5rem) !important;
    }
    
    .stop-trading-modal .modal-content {
        max-height: calc(100vh - 2rem) !important;
    }
    
    .stop-trading-modal .modal-footer {
        flex-direction: column-reverse !important;
        gap: 0.5rem !important;
    }
    
    .stop-trading-modal .modal-footer .btn {
        width: 100% !important;
    }
}
