/* Custom Styles Moved from View Files */

/* Layout Master Styles */
.top-header {
    padding-top: 70px;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
}

.main-wrapper {
    flex: 1;
    overflow-x: hidden;
}

.top-header .market-status-bar {
    position: fixed;
    top: 70px;
    left: 260px;
    right: auto;
    right: 0;
    height: 35px;
    background-color: var(--bs-body-bg);
    border-top: 1px solid var(--bs-border-color-translucent);
    border-bottom: 1px solid var(--bs-border-color-translucent);
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    min-height: 35px;
    box-shadow: none;
    z-index: 9;
}

.toggled .top-header .market-status-bar {
    left: 70px;
}

/* Layout Head Styles */
/* Hide Pace.js loading spinner */
.pace .pace-activity {
    display: none !important;
}

.pulse-animation {
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

[data-bs-theme="light"],
[data-bs-theme="semi-dark"],
[data-bs-theme="bordered-theme"] {
    --text-primary: #000000;
}

/* Global Mobile Responsiveness Tweaks */
@media (max-width: 767.98px) {
    .sidebar-wrapper {
        width: 280px !important;
        left: -280px !important;
        z-index: 1045 !important;
    }

    .sidebar-wrapper .sidebar-header {
        width: 280px !important;
        z-index: 1046 !important;
    }

    .toggled .sidebar-wrapper {
        left: 0 !important;
    }

    .toggled .sidebar-wrapper .sidebar-header {
        width: 280px !important;
    }

    .toggled .overlay {
        z-index: 1040 !important;
        opacity: 0.6 !important;
    }

    .main-content {
        padding: 12px !important;
    }

    .card-body {
        padding: 15px !important;
    }

    .table-responsive {
        border-radius: 8px;
        margin-bottom: 1rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .dashboard-table-wrap {
        overflow: visible;
    }

    .dashboard-table-wrap .dataTables_wrapper {
        overflow: visible;
    }

    .dashboard-table-wrap .dataTables_scrollBody {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .dashboard-table-wrap .dataTables_scroll {
        margin-bottom: 1rem;
    }

    .nav-pills {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 5px;
    }

    .nav-pills .nav-item {
        flex: 0 0 auto;
    }

    .performers-swipe-zone {
        touch-action: pan-y;
    }

    .dashboard-breadcrumb {
        margin-bottom: 0.75rem !important;
    }

    .dashboard-main-wrapper {
        margin-top: 0 !important;
    }

    .dashboard-main-wrapper .main-content {
        padding-top: 0 !important;
    }

    .market-status-bar {
        left: 0 !important;
        justify-content: flex-start !important;
        padding-left: 0;
        padding-right: 0;
        overflow: visible;
    }

    .market-status-inner {
        width: 100%;
        justify-content: flex-start;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    #marketStatus {
        font-size: 0.68rem !important;
    }
}

/* Dashboard View Styles */
.select2-container--bootstrap-5 .select2-selection--multiple {
    min-height: 100px !important;
    max-height: 400px !important;
    overflow-y: auto !important;
}
.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__rendered {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    padding: 10px !important;
}
.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__choice {
    margin: 0 !important;
    padding: 4px 12px !important;
    background-color: var(--bs-primary) !important;
    color: white !important;
    border: none !important;
    border-radius: 50px !important;
    font-size: 0.85rem !important;
}
.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__choice__remove {
    color: white !important;
    margin-right: 8px !important;
}
.select2-container--bootstrap-5 .select2-selection--multiple .select2-search {
    width: auto !important;
    margin-top: 4px !important;
}
.hover-expand {
    transition: transform 0.2s ease;
}
.hover-expand:hover {
    transform: scale(1.02);
    cursor: pointer;
}

.market-status-bar {
    overflow: hidden;
}

.market-status-inner {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    scrollbar-width: none;
}

.market-status-inner::-webkit-scrollbar {
    display: none;
}

/* FII / DII View Styles */
.fii-dii-table td {
    vertical-align: middle;
}

#fiiDiiChart .apexcharts-datalabels text {
    transform: rotate(-90deg) !important;
    transform-origin: center center !important;
    dominant-baseline: middle !important;
}

.bg-dark .card-header h6 {
    color: #fff !important;
}

.bg-dark .nav-pills .nav-link {
    color: #adb5bd;
}

.bg-dark .nav-pills .nav-link.active {
    background-color: #0d6efd;
    color: #fff;
}

/* Heatmap View Styles */
.heatmap-card {
    transition: background-color 0.4s ease, color 0.4s ease, transform 0.2s ease;
}

.heatmap-card.hover-expand:hover {
    transform: scale(1.05);
}

@keyframes pulse-update {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.value-updated {
    animation: pulse-update 0.3s ease-in-out;
}

@media (max-width: 767.98px) {
    .heatmap-card {
        margin-bottom: 0 !important;
    }
    .stock-card-wrapper {
        margin-bottom: 0 !important;
    }
}

/* OTP Verification Styles */
.otp-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.otp-box {
    width: 50px;
    height: 55px;
    border-radius: 8px;
    border: 2px solid #3c4061;
    background: #0d1226;
    text-align: center;
    font-size: 22px;
    font-weight: bold;
    color: #fff;
    outline: none;
    transition: .2s;
}

.otp-box:focus {
    border-color: #7366ff;
    transform: scale(1.12);
    background: #161d38;
}

/* Market and Setup Shared Styles */
.glass-card {
    background: rgba(255, 255, 255, 0.7) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.performance-tabs .nav-pills-custom .nav-link {
    color: #555;
    font-weight: 600;
    transition: all 0.3s ease;
}

.performance-tabs .nav-pills-custom .nav-link.active {
    background-color: var(--bs-primary) !important;
    color: #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.bg-grd-success, .bg-success-grd {
    background: linear-gradient(45deg, #2ecc71, #27ae60) !important;
}

.bg-grd-danger {
    background: linear-gradient(45deg, #e74c3c, #c0392b) !important;
}

.bg-grd-info {
    background: linear-gradient(45deg, #3498db, #2980b9) !important;
}

.bg-grd-primary {
    background: linear-gradient(45deg, #8e44ad, #2c3e50) !important;
}

.setups-view .bg-grd-primary {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%) !important;
}

.widgets-icons-2 {
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

/* Watchlist and Portfolio Table Styles */
.watchlist-card .table > :not(caption) > * > * {
    padding: 1rem 0.5rem;
}

#watchlist-table thead th,
#portfolio-table thead th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
    font-weight: 700;
}

#watchlist-table_wrapper .dataTables_info,
#portfolio-table_wrapper .dataTables_info {
    font-size: 0.85rem;
    color: #6c757d;
    padding-top: 0.5rem !important;
}

#watchlist-table_wrapper .pagination,
#portfolio-table_wrapper .pagination {
    margin-bottom: 0;
    gap: 4px;
}

#watchlist-table_wrapper .page-link,
#portfolio-table_wrapper .page-link {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    border-radius: 8px !important;
    margin: 0;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #64748b;
    padding: 0;
}

#watchlist-table_wrapper .page-item.active .page-link,
#portfolio-table_wrapper .page-item.active .page-link {
    background: var(--bs-primary);
    color: #fff !important;
    border-color: var(--bs-primary);
    box-shadow: 0 4px 12px rgba(var(--bs-primary-rgb), 0.2);
}

#watchlist-table_wrapper .page-item.disabled .page-link,
#portfolio-table_wrapper .page-item.disabled .page-link {
    opacity: 0.5;
    background: #f8fafc;
}

#watchlist-table_wrapper .dataTables_filter input,
#portfolio-table_wrapper .dataTables_filter input {
    border-radius: 20px;
    padding: 0.4rem 1rem;
    border: 1px solid #e2e8f0;
    font-size: 0.85rem;
}

#watchlistGroupList .dropdown-item {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
}

#watchlistGroupList .dropdown-item.active {
    background-color: var(--bs-primary);
    color: #fff;
}

/* Mobile Optimizations for Watchlist */
@media (max-width: 576px) {
    .watchlist-card .card-body {
        padding: 1rem !important;
    }

    #watchlist-table tbody tr {
        display: table-row;
    }

    #watchlist-table tbody td {
        padding: 0.75rem 0.35rem !important;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    #watchlist-table td:nth-child(1) {
        font-size: 1rem;
        font-weight: 600;
    }

    #watchlist-table td:nth-child(2) {
        color: #64748b;
    }

    #watchlist-table td:nth-child(3) {
        font-weight: 600;
    }

    #watchlist-table td:nth-child(4) {
        text-align: right;
    }

    .remove-watchlist-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        color: var(--bs-danger) !important;
        transition: all 0.2s;
    }

    .remove-watchlist-btn:active {
        transform: scale(0.95);
    }

    .btn-filter {
        font-size: 0.8rem;
    }
}
