/**
 * ANYSTAT Custom Chart Styles - ENHANCED VERSION
 */

/* Global Typography & Base Styles */
body {
    font-family: "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    color: #333; /* Darker text for better readability */
    background-color: #f8f9fa; /* Light background */
}

/* Chart loading animation */
.loading {
    position: relative;
    min-height: 200px;
}

.loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    border-radius: 8px; /* Match card border-radius */
}

.loading::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border-radius: 50%;
    border: 3px solid rgba(62, 151, 255, 0.2); /* Lighter border */
    border-top-color: #3e97ff; /* Primary blue */
    animation: spin 1s linear infinite;
    z-index: 11;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Chart container styles */
.chart-container {
    position: relative;
    height: 425px;
    width: 100%;
    overflow: hidden;
    transition: all 0.3s ease;
    border-radius: 12px; /* Slightly more rounded */
    background-color: #fff; /* Default light background */
}

.chart-container:hover {
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1); /* Softer, more pronounced shadow */
}

/* Chart tooltip styles */
.tooltip-box {
    border-radius: 8px !important; /* More rounded */
    font-family: inherit !important;
    font-size: 0.9rem !important;
    line-height: 1.5 !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); /* Add shadow to tooltip */
}

.tooltip-box a {
    color: #3e97ff !important; /* Use primary blue */
    text-decoration: none !important;
    font-weight: bold !important;
}

.tooltip-box a:hover {
    text-decoration: underline !important;
}

/* Table styles */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    margin-bottom: 1rem;
    color: #212529;
    vertical-align: middle;
    border-color: #e9ecef; /* Lighter border */
}

.table > thead {
    vertical-align: bottom;
    background-color: #f1f3f5; /* Slightly darker header background */
}

.table > thead th {
    font-weight: 600;
    text-align: center;
    padding: 0.85rem; /* Slightly more padding */
    vertical-align: middle;
    border-bottom: 2px solid #dee2e6;
    color: #495057; /* Darker header text */
}

.table > tbody td {
    padding: 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid #e9ecef; /* Lighter border */
}

.table-striped > tbody > tr:nth-of-type(odd) {
    background-color: #fcfcfc; /* Lighter stripe */
}

.table-bordered {
    border: 1px solid #e9ecef;
}

.table-bordered th,
.table-bordered td {
    border: 1px solid #e9ecef;
}

/* SCALABLE CHART TYPE GRID - FIXED VERSION */
.chart-type-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px; /* Slightly more gap */
    margin-bottom: 1rem;
    justify-content: flex-start;
}

.chart-type-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 8px; /* More padding */
    border: 1px solid #e4e6ef; /* Thinner border */
    border-radius: 10px; /* More rounded */
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fff;
    min-width: 70px;
    flex: 1 1 auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); /* Subtle shadow */
}

.chart-type-option:hover {
    border-color: #3e97ff;
    background: #eaf4ff; /* Lighter hover background */
    transform: translateY(-3px); /* More pronounced lift */
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1); /* Stronger shadow on hover */
}

.chart-type-option.active {
    border-color: #3e97ff;
    background: linear-gradient(45deg, #3e97ff, #2b6cb0); /* Gradient for active state */
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(62, 151, 255, 0.3); /* Shadow for active state */
}

.chart-type-option i {
    font-size: 2.2rem !important; /* Slightly bigger icons */
    margin-bottom: 6px;
    color: #6c757d;
    transition: all 0.3s ease;
}

.chart-type-option.active i {
    color: white !important;
}

.chart-type-option span {
    font-size: 12px; /* Slightly larger text */
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Responsive grid layout */
/* Desktop: Up to 6 per row */
@media (min-width: 1200px) {
    .chart-type-option {
        flex: 1 1 calc(16.66% - 8px); /* Adjust for new gap */
        min-width: 55px;
        max-width: 120px;
    }
}

/* Laptop: 5 per row */
@media (min-width: 992px) and (max-width: 1199px) {
    .chart-type-option {
        flex: 1 1 calc(20% - 8px); /* Adjust for new gap */
        min-width: 70px;
        max-width: 110px;
    }
}

/* Tablet: 4 per row */
@media (min-width: 768px) and (max-width: 991px) {
    .chart-type-option {
        flex: 1 1 calc(25% - 7.5px); /* Adjust for new gap */
        min-width: 65px;
    }
}

/* Mobile: 3 per row */
@media (min-width: 576px) and (max-width: 767px) {
    .chart-type-option {
        flex: 1 1 calc(33.33% - 7px); /* Adjust for new gap */
        min-width: 70px;
        padding: 12px 8px;
    }

    .chart-type-option i {
        font-size: 2rem !important;
    }
}

/* Small mobile: 2 per row */
@media (max-width: 575px) {
    .chart-type-option {
        flex: 1 1 calc(50% - 7px); /* Adjust for new gap */
        min-width: 80px;
        padding: 14px 8px;
    }

    .chart-type-option i {
        font-size: 2rem !important;
    }

    .chart-type-option span {
        font-size: 13px;
    }

    .chart-container {
        height: 280px; /* Slightly taller for small screens */
        min-height: 280px !important;
    }
}

/* Chart download button styles */
.download-btn,
.embed-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border-radius: 8px; /* More rounded */
    font-weight: 600;
}

.download-btn:hover,
.embed-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); /* Stronger shadow on hover */
}

.download-btn i,
.embed-btn i {
    margin-right: 0.5rem;
}

/* Select control styles */
.form-select {
    padding: 0.65rem 1.2rem; /* More padding */
    font-size: 0.95rem; /* Slightly larger font */
    background-position: right 0.85rem center;
    transition: all 0.2s ease;
    border-radius: 8px; /* More rounded */
    border-color: #e4e6ef; /* Lighter border */
}

.form-select:focus {
    border-color: #3e97ff; /* Primary blue on focus */
    box-shadow: 0 0 0 0.25rem rgba(62, 151, 255, 0.2); /* Softer focus shadow */
}

/* Chart Card Enhancements */
.chart-card {
    transition: all 0.3s ease;
    border-radius: 12px; /* More rounded */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05); /* Subtle initial shadow */
}

.chart-card:hover {
    transform: translateY(-4px); /* More pronounced lift */
    box-shadow: 0 0.8rem 2rem 0.8rem rgba(0, 0, 0, 0.1) !important; /* Stronger, softer shadow */
}

/* Chart zoom functionality */
.chart-zoomed-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6); /* Darker overlay */
    backdrop-filter: blur(4px); /* More blur */
    z-index: 999;
    display: none;
}

.zoomed {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 95%; /* Wider */
    height: 90%; /* Taller */
    z-index: 1000;
    background: white;
    border-radius: 16px; /* More rounded */
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3); /* Stronger shadow */
    padding: 30px; /* More padding */
}

.chart-zoom-close {
    position: absolute;
    top: 15px; /* More space from top */
    right: 15px; /* More space from right */
    width: 40px; /* Larger button */
    height: 40px;
    background: #f1f3f5; /* Lighter background */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px; /* Larger icon */
    z-index: 1001;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); /* Subtle shadow */
}

.chart-zoom-close:hover {
    background: #e9ecef !important;
    color: #333 !important;
    transform: scale(1.15); /* More pronounced scale */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Expanded content styling */
.card-body.zoomed {
    transition: all 0.3s ease;
}

.card-body.zoomed .chart-container,
.card-body.zoomed .table-responsive {
    height: auto !important;
    max-height: calc(90vh - 120px); /* Adjust max-height */
    overflow: auto;
}

.card-body.zoomed .table-responsive {
    font-size: 15px; /* Slightly larger font */
}

.card-body.zoomed .table-responsive table {
    margin-bottom: 0;
}

/* Custom scrollbar for expanded content */
.card-body.zoomed::-webkit-scrollbar {
    width: 8px; /* Wider scrollbar */
}

.card-body.zoomed::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.card-body.zoomed::-webkit-scrollbar-thumb {
    background: #a0a0a0; /* Darker thumb */
    border-radius: 4px;
}

.card-body.zoomed::-webkit-scrollbar-thumb:hover {
    background: #777;
}

/* Hide unwanted elements */
.chart-no-data,
.featured-chart,
.ribbon {
    display: none !important;
}

.chart-loading-indicator {
    display: none !important;
}

/* Media queries for responsive charts */
@media (max-width: 992px) {
    .chart-container {
        height: 380px; /* Slightly taller */
    }
}

@media (max-width: 768px) {
    .chart-container {
        height: 320px; /* Slightly taller */
    }

    .download-btn,
    .embed-btn {
        width: 100%;
        margin-top: 1rem;
    }
}
/* Enhanced table design styles */
.table-container {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.table-rounded {
    border-radius: 8px;
    overflow: hidden;
}

.table-row-hover {
    transition: all 0.2s ease;
}

.table-row-hover:hover {
    background-color: rgba(62, 151, 255, 0.08) !important; /* Slightly more opaque hover */
    transform: translateY(-2px); /* More pronounced lift */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); /* Stronger shadow */
}

.export-section {
    box-shadow: 0 6px 20px rgba(62, 151, 255, 0.2); /* Softer, wider shadow */
    transition: all 0.3s ease;
    border-radius: 12px; /* More rounded */
    background: linear-gradient(135deg, #3e97ff, #2b6cb0); /* Gradient background */
    color: white; /* White text for contrast */
    padding: 25px; /* More padding */
}

.export-section:hover {
    transform: translateY(-3px); /* More pronounced lift */
    box-shadow: 0 8px 25px rgba(62, 151, 255, 0.3); /* Even stronger shadow on hover */
}

/* Better badges */
.badge-light-success {
    background: linear-gradient(135deg, #50cd89, #2f855a);
    color: white !important;
    border: none;
    box-shadow: 0 2px 8px rgba(80, 205, 137, 0.3);
    padding: 0.4em 0.8em; /* More padding */
    border-radius: 6px; /* More rounded */
    font-weight: 700; /* Bolder */
}

/* Dark mode enhancements */
[data-bs-theme="dark"] body {
    background-color: #1a202c;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .table-container {
    background: #2d3748;
    border: 1px solid #4a5568;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

[data-bs-theme="dark"] .table-header-dark th {
    background: linear-gradient(135deg, #2d3748, #1a202c) !important;
    color: #f7fafc !important;
    border-color: #4a5568 !important;
}

[data-bs-theme="dark"] .table {
    color: #f7fafc;
    border-color: #4a5568;
}

[data-bs-theme="dark"] .table > thead {
    background-color: #2a323e;
}

[data-bs-theme="dark"] .table > thead th {
    color: #cbd5e0;
    border-bottom-color: #4a5568;
}

[data-bs-theme="dark"] .table > tbody td {
    border-bottom-color: #4a5568;
}

[data-bs-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) {
    background-color: #252b36;
}

[data-bs-theme="dark"] .table-bordered {
    border-color: #4a5568;
}

[data-bs-theme="dark"] .table-bordered th,
[data-bs-theme="dark"] .table-bordered td {
    border-color: #4a5568;
}

[data-bs-theme="dark"] .table-row-hover:hover {
    background-color: rgba(74, 85, 104, 0.3) !important;
}

[data-bs-theme="dark"] .bg-light-primary {
    background: linear-gradient(135deg, #2b6cb0, #1e40af) !important; /* Darker gradient for dark mode */
    color: white !important;
}

[data-bs-theme="dark"] .text-dark {
    color: #f7fafc !important;
}

[data-bs-theme="dark"] .badge-light-success {
    background: linear-gradient(135deg, #2f855a, #276749) !important;
}

[data-bs-theme="dark"] .chart-type-option {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

[data-bs-theme="dark"] .chart-type-option:hover {
    background: #3a475a;
    border-color: #3e97ff;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .chart-type-option.active {
    background: linear-gradient(45deg, #3e97ff, #2b6cb0);
    border-color: #3e97ff;
    color: white;
}

[data-bs-theme="dark"] .chart-type-option i {
    color: #a0aec0;
}

[data-bs-theme="dark"] .chart-card {
    background: #2d3748;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

[data-bs-theme="dark"] .chart-card:hover {
    box-shadow: 0 0.8rem 2rem 0.8rem rgba(0, 0, 0, 0.3) !important;
}

/* FIX: Ensure chart container background is dark in dark mode */
[data-bs-theme="dark"] .chart-container {
    background-color: #2a323e; /* A dark background for the chart area */
    border-color: #4a5568; /* Adjust border if needed */
}

[data-bs-theme="dark"] .form-select {
    background-color: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .form-select:focus {
    border-color: #3e97ff;
    box-shadow: 0 0 0 0.25rem rgba(62, 151, 255, 0.3);
}

[data-bs-theme="dark"] .modal-content {
    background-color: #2d3748;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .modal-header {
    border-bottom-color: #4a5568;
}

[data-bs-theme="dark"] .modal-footer {
    border-top-color: #4a5568;
}

[data-bs-theme="dark"] .nav-tabs .nav-link {
    color: #cbd5e0;
    border-color: transparent;
}

[data-bs-theme="dark"] .nav-tabs .nav-link.active {
    color: #3e97ff;
    border-bottom-color: #3e97ff;
    background-color: transparent;
}

[data-bs-theme="dark"] .nav-tabs .nav-link:hover:not(.active) {
    color: #3e97ff;
}

[data-bs-theme="dark"] .form-control {
    background-color: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .form-control::placeholder {
    color: #a0aec0;
}

[data-bs-theme="dark"] .bg-light {
    background-color: #2a323e !important;
}

[data-bs-theme="dark"] .text-gray-700 {
    color: #cbd5e0 !important;
}

[data-bs-theme="dark"] .text-gray-500 {
    color: #a0aec0 !important;
}

[data-bs-theme="dark"] .text-gray-600 {
    color: #a0aec0 !important;
}

[data-bs-theme="dark"] .text-gray-800 {
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .alert-info {
    background-color: #2a323e;
    border-color: #4a5568;
    color: #e2e8f0;
}

/* Responsive table improvements */
@media (max-width: 768px) {
    .table-container {
        padding: 15px;
    }

    .export-section {
        padding: 20px !important;
    }

    .export-section .row {
        flex-direction: column;
        gap: 15px;
    }

    .export-section .col-md-4 {
        text-align: center !important;
    }
}

/* Custom No Data Message Style */
.no-data-message {
    background: linear-gradient(135deg, #f0f4f8, #e6edf3);
    border: 1px solid #dbe3ed;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    margin-top: 50px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.no-data-message .icon {
    font-size: 4rem;
    color: #a0aec0;
    margin-bottom: 20px;
}

.no-data-message h4 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 10px;
}

.no-data-message span {
    font-size: 1.1rem;
    color: #666;
    max-width: 600px;
    line-height: 1.6;
}

[data-bs-theme="dark"] .no-data-message {
    background: linear-gradient(135deg, #2a323e, #1e252f);
    border-color: #4a5568;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .no-data-message .icon {
    color: #718096;
}

[data-bs-theme="dark"] .no-data-message h4 {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .no-data-message span {
    color: #a0aec0;
}

/* Mobile App Promo Card Enhancement */
.mobile-app-promo-card {
    background: linear-gradient(135deg, #3e97ff, #2b6cb0); /* Stronger gradient */
    color: white; /* Ensure text is white */
    border-radius: 12px; /* More rounded */
    padding: 30px; /* More padding */
    box-shadow: 0 10px 25px rgba(62, 151, 255, 0.25); /* Stronger shadow */
    transition: all 0.3s ease;
}

.mobile-app-promo-card:hover {
    transform: translateY(-5px); /* Lift more on hover */
    box-shadow: 0 15px 35px rgba(62, 151, 255, 0.35); /* Even stronger shadow */
}

.mobile-app-promo-card .fs-2 {
    font-size: 2.25rem !important; /* Larger title */
    font-weight: 700;
    color: white !important;
}

.mobile-app-promo-card .fs-6 {
    font-size: 1.1rem !important; /* Larger description */
    color: rgba(255, 255, 255, 0.9); /* Slightly transparent white */
    margin-top: 8px;
    margin-bottom: 0;
}

.mobile-app-promo-card .btn {
    border-radius: 8px; /* More rounded buttons */
    font-weight: 600;
    padding: 10px 20px;
    transition: all 0.3s ease;
}

.mobile-app-promo-card .btn-primary {
    background-color: white;
    color: #3e97ff;
    border-color: white;
}

.mobile-app-promo-card .btn-primary:hover {
    background-color: #f0f4f8;
    color: #3e97ff;
    border-color: #f0f4f8;
    transform: translateY(-2px);
}

.mobile-app-promo-card .btn-dark {
    background-color: rgba(0, 0, 0, 0.2); /* Transparent dark */
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
}

.mobile-app-promo-card .btn-dark:hover {
    background-color: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

/* General Card Header/Body Padding */
.card-header {
    padding: 20px 25px !important; /* Consistent padding */
}

.card-body {
    padding: 25px !important; /* Consistent padding */
}

/* Modal Enhancements */
.modal-content {
    border-radius: 12px; /* More rounded */
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2); /* Stronger shadow */
}

.modal-header {
    border-bottom: 1px solid #e9ecef;
    padding: 20px 25px;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    border-top: 1px solid #e9ecef;
    padding: 20px 25px;
}

.nav-tabs .nav-link {
    font-weight: 600;
    color: #6c757d;
    padding: 12px 20px;
    border-radius: 8px 8px 0 0;
    transition: all 0.2s ease;
}

.nav-tabs .nav-link.active {
    color: #3e97ff;
    border-color: #e9ecef #e9ecef #fff;
    background-color: #fff;
}

.nav-tabs .nav-link:hover:not(.active) {
    color: #3e97ff;
}

.form-control {
    border-radius: 8px;
    border-color: #e4e6ef;
    padding: 10px 15px;
    transition: all 0.2s ease;
}

.form-control:focus {
    border-color: #3e97ff;
    box-shadow: 0 0 0 0.25rem rgba(62, 151, 255, 0.2);
}

.copy-btn {
    border-radius: 8px;
    font-weight: 600;
    padding: 8px 15px;
}

.preview-expand-btn {
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.preview-expand-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Initial Page Loading Spinner */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    background-color: rgba(255, 255, 255, 0.9); /* Slightly more opaque */
}

.page-loader .spinner-border {
    width: 4rem; /* Larger spinner */
    height: 4rem;
    border-width: 0.35em; /* Thicker border */
    color: #3e97ff !important; /* Primary blue */
}

.page-loader .fw-semibold {
    font-size: 1.1rem; /* Larger text */
    color: #555;
}

[data-bs-theme="dark"] .page-loader {
    background-color: rgba(26, 32, 44, 0.95);
}

[data-bs-theme="dark"] .page-loader .fw-semibold {
    color: #cbd5e0;
}


