/* Dashboard Styles - Simplified with Bootstrap */
body {
    background-color: #f5f7f6;
    min-height: 100vh;
}

/* Simple navbar styling */
.navbar {
    background: #ffffff !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-bottom: 1px solid #e9ecef;
}

.navbar-brand .brand-title {
    color: #2c3e50 !important;
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: 1px;
    text-shadow: none;
}

.navbar-brand .tagline {
    color: #7f8c8d !important;
    font-size: 0.75rem;
    font-weight: 500;
    font-style: italic;
    letter-spacing: 0.5px;
    margin-top: -2px;
    display: block;
    line-height: 1.2;
}

.navbar-nav .nav-link {
    color: #34495e !important;
    font-weight: 600;
    transition: color 0.3s ease;
}

.navbar-nav .nav-link:hover {
    color: #3498db !important;
}

.navbar-nav .nav-link.active {
    color: #3498db !important;
    background-color: #ecf0f1 !important;
    border-radius: 6px;
}

/* User welcome text styling */
#user-welcome {
    color: #27ae60 !important;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Navbar toggler for mobile */
.navbar-toggler {
    border-color: #bdc3c7 !important;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25) !important;
}

/* Navbar brand hover effect */
.navbar-brand:hover .brand-title {
    color: #3498db !important;
    transition: color 0.3s ease;
}

/* Simple card styling */
.gadget-card {
    background: #ffffff;
    border: 1px solid #e1bee7;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
    width: 100% !important;
    height: auto !important;
    min-height: 400px;
}

/* Card header styling */
.gadget-card .card-header {
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%) !important;
    border-bottom: 1px solid #e1bee7 !important;
    border-radius: 8px 8px 0 0 !important;
    padding: 15px 20px !important;
    min-height: 60px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

.gadget-card .card-header .card-title {
    margin: 0 !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    color: #2c3e50 !important;
    flex: 1 !important;
    text-shadow: 0 1px 2px rgba(255,255,255,0.8);
}

.gadget-card .card-header .gadget-actions {
    display: flex !important;
    gap: 8px !important;
    align-items: center !important;
    flex-shrink: 0 !important;
}

.gadget-card .card-header .gadget-actions .btn {
    padding: 6px 12px !important;
    font-size: 0.875rem !important;
    border-radius: 6px !important;
    transition: all 0.2s ease !important;
    background: rgba(255, 255, 255, 0.9) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    backdrop-filter: blur(10px);
}

.gadget-card .card-header .gadget-actions .btn:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
    background: #3498db !important;
    border-color: #2980b9 !important;
    color: white !important;
}

/* Specific button styling for different types */
.gadget-card .card-header .gadget-actions .btn.btn-outline-primary {
    color: #3498db !important;
    border-color: #3498db !important;
}

.gadget-card .card-header .gadget-actions .btn.btn-outline-primary:hover {
    background: #3498db !important;
    color: white !important;
    border-color: #2980b9 !important;
}

.gadget-card .card-header .gadget-actions .btn.btn-outline-secondary {
    color: #95a5a6 !important;
    border-color: #95a5a6 !important;
}

.gadget-card .card-header .gadget-actions .btn.btn-outline-secondary:hover {
    background: #95a5a6 !important;
    color: white !important;
    border-color: #7f8c8d !important;
}

.gadget-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
    transition: all 0.3s ease;
}

.gadget-card:hover .card-header {
    background: linear-gradient(135deg, #bbdefb 0%, #e1bee7 100%) !important;
    transition: background 0.3s ease;
}

/* Card body styling */
.gadget-card .card-body {
    padding: 20px;
    min-height: 300px;
    display: flex;
    flex-direction: column;
}

.gadget-card .card-body .gadget-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Card footer styling */
.gadget-card .card-footer {
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    border-radius: 0 0 8px 8px;
    padding: 10px 20px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Chart container */
.chart-container {
    width: 100% !important;
    min-height: 250px;
    padding: 10px;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
}

/* Canvas sizing */
canvas {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box;
    object-fit: contain;
    overflow: hidden;
}

/* Specific canvas heights for different chart types */
canvas[data-chart-type="pie"] {
    height: 300px !important;
    max-height: 300px !important;
}

canvas[data-chart-type="doughnut"] {
    height: 300px !important;
    max-height: 300px !important;
}

canvas[data-chart-type="bar"] {
    height: 350px !important;
    max-height: 350px !important;
    width: 70% !important;
    max-width: 70% !important;
    margin: 0 auto !important;
}

canvas[data-chart-type="line"] {
    height: 350px !important;
    max-height: 350px !important;
}

canvas[data-chart-type="stackedbar"] {
    height: 500px !important;
    max-height: 500px !important;
}

canvas[data-chart-type="table"] {
    height: 350px !important;
    max-height: 350px !important;
}

/* Global filter styling */
.global-filter {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Button styling */
.btn {
    border-radius: 6px;
    font-weight: 500;
}

/* Table styling */
.gadget-table {
    font-size: 0.9rem;
}

.gadget-table th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .global-filter .row > div {
        margin-bottom: 0.5rem;
    }
    
    .gadget-card {
        margin-bottom: 1rem;
    }
    
    /* Mobile card header adjustments */
    .gadget-card .card-header {
        padding: 12px 15px;
        min-height: 50px;
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .gadget-card .card-header .card-title {
        text-align: center;
        font-size: 0.9rem;
    }
    
    .gadget-card .card-header .gadget-actions {
        justify-content: center;
        gap: 6px;
    }
    
    .gadget-card .card-header .gadget-actions .btn {
        padding: 5px 10px;
        font-size: 0.8rem;
    }
    
    /* Mobile legend adjustments */
    .stackedbar-container .custom-legend {
        height: auto !important;
        min-height: 120px !important;
        padding: 4px !important;
        gap: 6px !important;
    }
    
    .stackedbar-container .legend-item {
        margin: 2px 4px !important;
        padding: 2px 4px !important;
        font-size: 0.8rem !important;
        max-width: 200px !important;
        min-width: 100px !important;
    }
    
    .stackedbar-container .legend-circle {
        width: 12px !important;
        height: 12px !important;
    }
}

/* Bootstrap grid compatibility */
.col-12, .col-md-6, .col-lg-6, .col-xl-4 {
    display: flex;
    flex-direction: column;
}

.col-12 .gadget-card,
.col-md-6 .gadget-card,
.col-lg-6 .gadget-card,
.col-xl-4 .gadget-card {
    width: 100% !important;
    height: auto !important;
    min-height: 400px;
}

/* Simple animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.gadget-card {
    animation: fadeIn 0.3s ease-out;
}

/* Specific card body heights for different chart types */
.gadget-card[data-chart-type="pie"] .card-body {
    height: 400px !important;
    min-height: 400px !important;
}

.gadget-card[data-chart-type="doughnut"] .card-body {
    height: 400px !important;
    min-height: 400px !important;
}

.gadget-card[data-chart-type="bar"] .card-body {
    height: 450px !important;
    min-height: 450px !important;
}

.gadget-card[data-chart-type="line"] .card-body {
    height: 450px !important;
    min-height: 450px !important;
}

.gadget-card[data-chart-type="stackedbar"] .card-body {
    height: 650px !important;
    min-height: 650px !important;
}

.gadget-card[data-chart-type="table"] .card-body {
    height: 450px !important;
    min-height: 450px !important;
}

/* Ensure content div fits properly */
.gadget-content {
    width: 100% !important;
    box-sizing: border-box;
    overflow: hidden;
}

/* Specific content div heights for different chart types */
.gadget-content[data-chart-type="pie"] {
    height: 350px !important;
    min-height: 350px !important;
}

.gadget-content[data-chart-type="doughnut"] {
    height: 350px !important;
    min-height: 350px !important;
}

.gadget-content[data-chart-type="bar"] {
    height: 400px !important;
    min-height: 400px !important;
}

.gadget-content[data-chart-type="line"] {
    height: 400px !important;
    min-height: 400px !important;
}

.gadget-content[data-chart-type="stackedbar"] {
    height: 600px !important;
    min-height: 600px !important;
}

.gadget-content[data-chart-type="table"] {
    height: 400px !important;
    min-height: 400px !important;
}





/* Hide Y-axis labels for bar charts */
.chart-container[data-chart-type="bar"] .chartjs-tick-label,
.chart-container[data-chart-type="bar"] .chartjs-axis-label,
.chart-container[data-chart-type="bar"] .chartjs-tick {
    display: none !important;
}

/* Hide Y-axis grid lines for bar charts */
.chart-container[data-chart-type="bar"] .chartjs-grid-line {
    display: none !important;
}

/* Stacked bar chart specific styling */
.stackedbar-container {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    height: 100% !important;
}

.stackedbar-container .chart-area {
    flex: 1 !important;
    position: relative !important;
    width: 100% !important;
}

.stackedbar-container .custom-legend {
    height: auto !important;
    min-height: 100px !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    padding: 5px !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent;
    border-radius: 0;
    margin-top: 5px;
    overflow: visible !important;
    max-width: 100%;
}

.stackedbar-container .legend-item {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    margin: 2px 4px !important;
    padding: 4px 6px !important; /* Slightly more padding for better click area */
    background: transparent;
    border-radius: 4px; /* Small border radius for hover feedback */
    border: none;
    box-shadow: none;
    max-width: 300px;
    min-width: 120px;
    flex-shrink: 0;
    cursor: pointer !important; /* Ensure cursor pointer is visible */
    user-select: none !important; /* Prevent text selection */
    transition: background-color 0.2s ease !important;
}

.stackedbar-container .legend-circle {
    width: 16px !important;
    height: 16px !important;
    border-radius: 50% !important;
    border: 2px solid #fff !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.stackedbar-container .legend-name {
    font-size: 0.875rem !important;
    color: #333 !important;
    font-weight: 500 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
}

/* Stacked bar chart hidden legend items */
.stackedbar-container .legend-item.hidden .legend-name {
    text-decoration: line-through !important;
    text-decoration-thickness: 2px !important; /* Make strikethrough thicker */
    opacity: 0.8 !important; /* Less faded - was 0.6 */
    color: #666 !important; /* Less faded color - was #999 */
    font-weight: 400 !important; /* Slightly lighter font weight when hidden */
}

.stackedbar-container .legend-item.hidden .legend-circle {
    opacity: 0.6 !important; /* Less faded circle - was 0.4 */
}

/* Make sure legend items are clickable */
.stackedbar-container .legend-item,
.stackedbar-legend-item {
    cursor: pointer !important;
    transition: opacity 0.2s ease, background-color 0.2s ease, transform 0.1s ease !important;
    position: relative !important;
}

/* Additional specific styling for stackedbar legend items */
.stackedbar-legend-item {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    margin: 2px 4px !important;
    padding: 4px 6px !important;
    background: transparent;
    border-radius: 4px;
    border: none;
    box-shadow: none;
    max-width: 300px;
    min-width: 120px;
    flex-shrink: 0;
    cursor: pointer !important;
    user-select: none !important;
}

.stackedbar-container .legend-item:hover {
    background-color: rgba(0, 0, 0, 0.05) !important;
    opacity: 0.9 !important;
    transform: scale(1.02) !important;
}

/* Metric chart styling */
.gadget-metrics-container {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    padding: 20px !important;
}

.gadget-metric-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 10px 0 !important;
    padding: 15px !important;
    border-radius: 8px !important;
    background: rgba(52, 152, 219, 0.05) !important;
    border: 1px solid rgba(52, 152, 219, 0.15) !important;
    width: 100% !important;
    max-width: 300px !important;
}

.gadget-metric-value {
    font-size: 3.5rem !important; /* Increased from default */
    font-weight: 800 !important;
    line-height: 1.1 !important;
    margin-bottom: 8px !important;
    color: #2c3e50 !important;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
    letter-spacing: -1px !important;
}

.gadget-metric-label {
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    color: #7f8c8d !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    text-align: center !important;
    margin-top: 5px !important;
}

/* Metric card specific sizing */
.gadget-card[data-chart-type="metric"] {
    min-height: 280px !important;
}

.gadget-card[data-chart-type="metric"] .card-body {
    height: 220px !important;
    min-height: 220px !important;
    padding: 15px !important;
}

.gadget-content[data-chart-type="metric"] {
    height: 190px !important;
    min-height: 190px !important;
}

/* Mobile responsive for metrics */
@media (max-width: 768px) {
    .gadget-metric-value {
        font-size: 2.8rem !important;
    }
    
    .gadget-metric-label {
        font-size: 1rem !important;
    }
    
    .gadget-metric-item {
        padding: 12px !important;
        max-width: 100% !important;
    }
}

/* Multi-select dropdown styling */
.dropdown-menu {
    border: 1px solid #dee2e6 !important;
    border-radius: 0.375rem !important;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
    padding: 0.5rem !important;
    max-height: 300px !important;
    overflow-y: auto !important;
    min-width: 200px !important;
}

.dropdown-menu .form-check {
    margin-bottom: 0.25rem !important;
    padding: 0.375rem 0.5rem !important;
    border-radius: 0.25rem !important;
    transition: background-color 0.15s ease-in-out !important;
    cursor: pointer !important;
    display: block !important;
    position: relative !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.dropdown-menu .form-check:hover {
    background-color: #f8f9fa !important;
}

.dropdown-menu .form-check-input {
    margin-top: 0.25rem !important;
    margin-left: 0 !important;
    margin-right: 0.5rem !important;
    margin-bottom: 0 !important;
    cursor: pointer !important;
    position: relative !important;
    float: left !important;
}

.dropdown-menu .form-check-label {
    cursor: pointer !important;
    font-size: 0.875rem !important;
    color: #495057 !important;
    margin-left: 1.5rem !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    display: block !important;
    padding-left: 0 !important;
}

/* Dropdown divider styling */
.dropdown-divider {
    margin: 0.5rem 0 !important;
    border-top: 1px solid #dee2e6 !important;
}
/* Dropdown button styling for multi-select */
.dropdown-toggle {
    background-color: #fff !important;
    border: 1px solid #ced4da !important;
    color: #495057 !important;
}

.dropdown-toggle:hover {
    background-color: #f8f9fa !important;
    border-color: #adb5bd !important;
}

.dropdown-toggle:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important;
    border-color: #80bdff !important;
}

/* Animation for dropdown items */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-menu.show {
    animation: slideInDown 0.2s ease-out !important;
}

/* Chart.js Legend Styles for Hidden Items */
.chartjs-legend li.hidden {
    text-decoration: line-through !important;
    text-decoration-thickness: 2px !important; /* Thicker strikethrough */
    opacity: 0.8 !important; /* Less faded - was 0.6 */
    color: #666 !important; /* Less faded color - was #999 */
}

.chartjs-legend li.hidden span {
    opacity: 0.6 !important; /* Less faded - was 0.4 */
}

/* Custom legend styles */
.custom-legend .legend-item.hidden {
    text-decoration: line-through !important;
    text-decoration-thickness: 2px !important; /* Thicker strikethrough */
    opacity: 0.8 !important; /* Less faded - was 0.6 */
    color: #666 !important; /* Less faded color - was #999 */
}

.custom-legend .legend-item.hidden .legend-color {
    opacity: 0.6 !important; /* Less faded - was 0.4 */
}

/* Responsive adjustments for multi-select */
@media (max-width: 768px) {
    .dropdown-menu {
        min-width: 100% !important;
        max-width: 300px !important;
    }
    
    .dropdown-menu .form-check-label {
        font-size: 0.8rem !important;
    }
}

/* ============================================================================
   DRAG AND DROP STYLES
   ============================================================================ */

/* Gadget wrapper drag styles */
.gadget-wrapper {
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.gadget-wrapper.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
    z-index: 1000;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.gadget-wrapper.drag-over {
    transform: translateY(-10px);
    box-shadow: 0 8px 16px rgba(0, 123, 255, 0.3);
}

/* Drag handle styles */
.drag-handle {
    cursor: grab;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.drag-handle:hover {
    opacity: 1;
    cursor: grab;
}

.drag-handle:active {
    cursor: grabbing;
}

.gadget-wrapper:hover .drag-handle {
    opacity: 0.8;
}

/* Drop zone styles */
.drop-zone {
    border: 2px dashed #007bff;
    background-color: rgba(0, 123, 255, 0.1);
    border-radius: 8px;
    margin: 10px 0;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #007bff;
    font-weight: bold;
    transition: all 0.2s ease;
}

.drop-zone.active {
    background-color: rgba(0, 123, 255, 0.2);
    border-color: #0056b3;
}

/* Improved dropdown styling for filter dropdowns */
.dropdown .btn {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.dropdown .btn:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

.dropdown .btn:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.dropdown-menu {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    font-size: 0.875rem;
}

.dropdown-menu .form-check {
    padding: 0.25rem 0.5rem;
    margin: 0;
    border-radius: 0.25rem;
    transition: background-color 0.2s ease;
}

.dropdown-menu .form-check:hover {
    background-color: #f8f9fa;
}

.dropdown-menu .form-check-input {
    margin-top: 0.125rem;
}

.dropdown-menu .form-check-label {
    font-size: 0.875rem;
    line-height: 1.4;
    word-wrap: break-word;
    white-space: normal;
    padding-left: 0.25rem;
}

/* Specific styling for long filter names */
.dropdown[id*="jeevesSuperCategory"] .btn,
.dropdown[id*="jeevesSubCategory"] .btn {
    font-size: 0.8rem;
}

.dropdown[id*="jeevesSuperCategory"] .dropdown-menu,
.dropdown[id*="jeevesSubCategory"] .dropdown-menu {
    min-width: 220px;
}

/* Ensure proper text truncation */
.dropdown .btn span {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================================================
   ADMIN PAGES NAVBAR STYLES
   ============================================================================ */

/* Admin navbar with dark background */
.navbar.navbar-dark.bg-dark {
    background-color: #02304f !important;
}

.navbar.navbar-dark.bg-dark .navbar-brand,
.navbar.navbar-dark.bg-dark .nav-link {
    color: white !important;
}

/* Admin dropdown menu styling */
.navbar.navbar-dark.bg-dark .dropdown-menu {
    background-color: #e9ecef !important;
    border: 1px solid #dee2e6 !important;
}

.navbar.navbar-dark.bg-dark .dropdown-item {
    color: #0d6efd !important;
}

.navbar.navbar-dark.bg-dark .dropdown-item:hover {
    background-color: #dee2e6 !important;
    color: #0a58ca !important;
}
