/* ============================================================
   ENHANCED DASHBOARD PAGE STYLES
   Dashboard-specific layouts, widgets, and comprehensive widget management
   ============================================================ */

/* Bootstrap Icons Import */
@import url('https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css?version=3.3.57.270');

/* Dashboard Container */
.dashboard-container {
    max-width: 100%;
    margin: 0 auto;
    overflow-y: auto;
    padding: 1rem;
    position: relative; /* CRITICAL: Keep relative positioning for absolute children */
    height: var(--content-max-height);
    background-color: var(--transparent-bg);
}

/* CRITICAL FIX: Enhanced Dashboard Grid System with MAXIMUM Specificity */
.dashboard-dynamic-grid {
    display: grid !important;
    gap: 1rem;
    min-height: 350px;
    position: relative;
    transition: all 0.3s ease;
    grid-auto-rows: minmax(200px, auto);
    /* Force grid behavior */
    grid-template-rows: repeat(auto-fit, minmax(350px, auto));
}

/* CRITICAL: Mobile Layout Override */
.dashboard-container .dashboard-dynamic-grid.mobile-layout {
    grid-template-columns: 1fr !important;
    gap: 0.75rem;
}

/* CRITICAL: Responsive Layout Classes with MAXIMUM Specificity */
.dashboard-container .dashboard-dynamic-grid.responsive-layout.cols-1 {
    grid-template-columns: 1fr !important;
}

.dashboard-container .dashboard-dynamic-grid.responsive-layout.cols-2 {
    grid-template-columns: repeat(2, 1fr) !important;
}

.dashboard-container .dashboard-dynamic-grid.responsive-layout.cols-3 {
    grid-template-columns: repeat(3, 1fr) !important;
}

.dashboard-container .dashboard-dynamic-grid.responsive-layout.cols-4 {
    grid-template-columns: repeat(4, 1fr) !important;
}

/* CRITICAL FIX: Force Default Grid Layout if No Classes Applied */
.dashboard-container .dashboard-dynamic-grid:not(.mobile-layout):not(.cols-1):not(.cols-2):not(.cols-3):not(.cols-4) {
    grid-template-columns: repeat(3, 1fr) !important;
}

/* Enhanced Dashboard Widgets */
.dashboard-widget {
    background-color: var(--transparent-bg);
    border: var(--thin-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    transition: all var(--component-transition);
    box-shadow: var(--shadow-sm);
    min-height: 350px;
    display: flex;
    flex-direction: column;
    color: var(--color-fg);
    /* Force proper grid positioning */
    contain: layout;
}

.dashboard-sales-products-details .dealer-products-error,
.dashboard-sales-products-details .coach-products-error {
    margin-left: 10px;
    padding: 10px;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    margin-top: 5px;
    font-size: 0.8em;
    border-radius: 4px;
}

.dashboard-widget:hover {
    box-shadow: var(--shadow-md);
    /*transform: translateY(-2px);*/
}

/* Widget States */
.dashboard-widget.dragging {
    opacity: 0.7;
    transform: rotate(2deg) scale(1.02);
    z-index: var(--z-modal);
    box-shadow: var(--shadow-lg);
}

.dashboard-widget.draggable {
    cursor: move;
}

.dashboard-widget.widget-edit-mode {
    border: 2px solid var(--color-primary);
    background-color: rgba(255, 151, 29, 0.05);
}

.dashboard-widget.widget-edit-mode .resize-handle {
    display: flex !important;
}

/* CRITICAL FIX: Widget Size Control with MAXIMUM Specificity */
.dashboard-container .dashboard-dynamic-grid .dashboard-widget[data-width="1"] {
    grid-column: span 1 !important;
}

.dashboard-container .dashboard-dynamic-grid .dashboard-widget[data-width="2"] {
    grid-column: span 2 !important;
}

.dashboard-container .dashboard-dynamic-grid .dashboard-widget[data-width="3"] {
    grid-column: span 3 !important;
}

.dashboard-container .dashboard-dynamic-grid .dashboard-widget[data-width="4"] {
    grid-column: span 4 !important;
}

.dashboard-container .dashboard-dynamic-grid .dashboard-widget[data-height="1"] {
    grid-row: span 1 !important;
}

.dashboard-container .dashboard-dynamic-grid .dashboard-widget[data-height="2"] {
    grid-row: span 2 !important;
}

.dashboard-container .dashboard-dynamic-grid .dashboard-widget[data-height="3"] {
    grid-row: span 3 !important;
}

/* CRITICAL FIX: Force Fallback for widgets without data attributes with MAXIMUM Specificity */
.dashboard-container .dashboard-dynamic-grid .dashboard-widget:not([data-width]) {
    grid-column: span 1 !important;
}

.dashboard-container .dashboard-dynamic-grid .dashboard-widget:not([data-height]) {
    grid-row: span 1 !important;
}

/* CRITICAL FIX: Prevent widgets from taking full width inappropriately */
.dashboard-container .dashboard-dynamic-grid:not(.mobile-layout) .dashboard-widget {
    max-width: 100%;
    grid-column-end: auto !important;
}

/* CRITICAL FIX: Mobile Force Full Width with MAXIMUM Specificity */
.dashboard-container .dashboard-dynamic-grid.mobile-layout .dashboard-widget:not(.maximized) {
    grid-column: span 1 !important;
    grid-row: span 1 !important;
}

/* Dashboard Container ID Styling */
#dashboardContainer {
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: var(--radius-lg);
    color: white;
    padding: var(--space-lg);
}

/* Enhanced Widget Content Structure */
.widget-content {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.widget-header {
    background-color: var(--transparent-bg);
    padding: var(--space-md) var(--space-lg);
    border-bottom: var(--thin-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    position: relative;
}

.widget-title {
    margin: 0;
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semi-bold);
    color: var(--color-fg);
}

.widget-body {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.widget-data {
    height: 100%;
    width: 100%;
}

.widget-data .toggle-arrow {
    display: inline-block;
    width: 12px;
    margin-right: 5px;
    font-weight: bold;
    color: var(--color-primary);
    transition: transform 0.2s ease-in-out;
    user-select: none;
}

.widget-config {
    display: none;
    padding: var(--space-md);
    height: 100%;
    overflow-y: auto;
    background: var(--color-gray-50);
}

/* Enhanced Widget Actions */
.widget-actions {
    display: flex;
    gap: var(--space-xs);
    align-items: center;
    z-index: 10;
}

/* Widget Action Buttons */
.widget-edit-btn,
.widget-duplicate-btn,
.widget-maximize-btn,
.widget-delete-btn {
    color: var(--color-gray-600);
    text-decoration: none;
    padding: var(--space-xs) var(--space-sm);
    border: none;
    background: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    transition: all var(--component-transition);
    cursor: pointer;
    border-radius: var(--button-sm-radius);
    line-height: 1;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.widget-edit-btn:hover {
    color: var(--color-primary);
    background-color: rgba(255, 151, 29, 0.1);
    transform: scale(1.1);
}

.widget-duplicate-btn:hover {
    color: var(--color-info);
    background-color: rgba(23, 162, 184, 0.1);
    transform: scale(1.1);
}

.widget-maximize-btn:hover {
    color: var(--color-success);
    background-color: rgba(40, 167, 69, 0.1);
    transform: scale(1.1);
}

.widget-delete-btn:hover {
    color: var(--color-danger);
    background-color: rgba(220, 53, 69, 0.1);
    transform: scale(1.1);
}

.widget-actions .btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 151, 29, 0.25);
}

/* Edit mode button visibility - REVERTED to original */
.dashboard-container:not(.edit-mode) .widget-duplicate-btn,
.dashboard-container:not(.edit-mode) .widget-delete-btn {
    display: none !important;
}

.dashboard-container.edit-mode .widget-duplicate-btn,
.dashboard-container.edit-mode .widget-delete-btn {
    display: flex !important;
}

/* Edit and maximize buttons are always visible */
.widget-edit-btn,
.widget-maximize-btn {
    display: flex !important;
}

/* Widget Configuration Form */
.widget-config-form {
    background: white;
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin: var(--space-sm);
}

.widget-config-section {
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--color-gray-200);
}

.widget-config-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.widget-config-section h6 {
    color: var(--color-gray-700);
    margin-bottom: var(--space-md);
    font-weight: var(--font-weight-semi-bold);
}

/* Schema-driven settings fields (rendered by dashboard.js in edit mode) */
.widget-config-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    margin-bottom: var(--space-md);
}

.widget-config-field > label {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semi-bold);
    color: var(--color-gray-700);
}

.widget-config-field input[type="number"],
.widget-config-field input[type="text"],
.widget-config-field select {
    width: 100%;
    padding: var(--space-xs) var(--space-sm);
    border: 1px solid var(--color-gray-300);
    border-radius: var(--button-sm-radius);
    font-size: var(--font-size-sm);
    background: white;
    color: var(--color-gray-800);
}

.widget-config-field input:focus,
.widget-config-field select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(255, 151, 29, 0.2);
}

/* Boolean settings rendered as an inline checkbox + label */
.widget-config-field-bool .widget-config-switch {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semi-bold);
    color: var(--color-gray-700);
    cursor: pointer;
}

.widget-config-field-bool .widget-config-switch input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--color-primary);
    cursor: pointer;
}

.widget-config-help {
    color: var(--color-gray-500);
    font-size: var(--font-size-xs);
}

.widget-config-empty {
    color: var(--color-gray-500);
    font-size: var(--font-size-sm);
    margin: 0 0 var(--space-md);
}

/* Save / Cancel footer */
.widget-config-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    padding-top: var(--space-sm);
}

.widget-config-actions .btn-config-primary,
.widget-config-actions .btn-config-secondary {
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--button-sm-radius);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semi-bold);
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--component-transition);
}

.widget-config-actions .btn-config-primary {
    background: var(--color-primary);
    color: white;
}

.widget-config-actions .btn-config-primary:hover {
    background: var(--color-primary-hover);
}

.widget-config-actions .btn-config-primary:disabled {
    opacity: 0.6;
    cursor: default;
}

.widget-config-actions .btn-config-secondary {
    background: white;
    color: var(--color-gray-700);
    border-color: var(--color-gray-300);
}

.widget-config-actions .btn-config-secondary:hover {
    background: var(--color-gray-100);
}

/* Enhanced Resize Handles */
.resize-handle {
    position: absolute;
    background: var(--color-primary);
    color: white;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: se-resize;
    z-index: 15;
    transition: all 0.2s ease;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.resize-handle:hover {
    background: var(--color-primary-hover);
    transform: scale(1.1);
}

.resize-handle.resize-se {
    bottom: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: var(--radius-sm) 0 var(--radius-md) 0;
}

.resize-handle i {
    font-size: 10px;
    transform: rotate(45deg);
}

/* Edit Mode Styling */
.dashboard-container.edit-mode .dashboard-widget:not(.maximized) {
    border: 2px dashed var(--color-primary);
    cursor: default;
}

.dashboard-container.edit-mode .dashboard-widget:not(.maximized):hover {
    box-shadow: 0 4px 16px rgba(255, 151, 29, 0.3);
    border-style: solid;
}

.dashboard-container.edit-mode .dashboard-widget.draggable {
    cursor: move;
}

/* News Carousel Widget */
.news-carousel-widget {
    /* Definite height so the % height chain below resolves (widget-body flex height ->
       news-carousel-widget -> carousel-widget -> carousel-widget-container). */
    height: 100%;
}

.news-carousel-widget .carousel-widget {
    position: relative;
    width: 100%;
    height: 100%;
}

.news-carousel-widget .widget-body {
    padding: 0;
}

.carousel-widget-container {
    position: relative;
    width: 100%;
    /* Fill the widget body so the carousel grows with the widget's row span (e.g. 3x2)
       instead of being pinned to a fixed height. Maximize keeps its own (more specific) rule. */
    height: 100%;
    min-height: 200px;
    overflow: hidden;
    border-radius: var(--radius-sm);
}

.dashboard-widget.maximized .carousel-widget-container {
    height: 580px;
}

.carousel-widget-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.carousel-widget-slide.active {
    opacity: 1;
}

.carousel-widget-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-widget-image {
    /* Fill the container in both dimensions; object-fit: contain scales up OR down while
       preserving the image's aspect ratio (letterboxing as needed). */
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.carousel-widget-content embed {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-sm);
}

.carousel-widget-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    padding: var(--space-md);
    cursor: pointer;
    z-index: 10;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xl);
    transition: all var(--component-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    box-shadow: var(--shadow-md);
}

.carousel-widget-arrow:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translateY(-50%) scale(1.1);
}

.carousel-widget-arrow.left-widget-arrow {
    left: 10px;
}

.carousel-widget-arrow.right-widget-arrow {
    right: 10px;
}

/* Video Capsules Widget */
.video-capsules-widget .video-table-container {
    max-height: 100%;
    overflow-y: auto;
}

.video-item-widget {
    display: flex;
    align-items: center;
    padding: var(--space-md);
    margin-bottom: var(--space-sm);
    background: var(--color-gray-100);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--component-transition);
}

.video-item-widget:hover {
    background: var(--color-gray-200);
    transform: translateX(4px);
}

.video-item-content {
    display: flex;
    align-items: center;
    width: 100%;
}

.play-button-icon-widget {
    width: 24px;
    height: 24px;
    margin-right: var(--space-md);
    flex-shrink: 0;
}

.video-info-widget {
    flex: 1;
}

.video-title-widget {
    margin: 0;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-gray-700);
    line-height: var(--line-height-tight);
}

/* News Ticker Widget */
.news-ticker-widget .news-ticker-container {
    background: var(--color-primary);
    color: white;
    padding: var(--space-sm);
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
}

.news-ticker-content {
    white-space: nowrap;
    animation: scroll-left linear infinite;
    animation-duration: 30s;
}

@keyframes scroll-left {
    0% {
        transform: translateX(100%);
    }
    100% {
        transform: translateX(-100%);
    }
}

/* Enhanced Dealer Sales Widget */
.dealer-sales-widget .widget-body {
    padding: 0;
    overflow-y: auto;
}

.dealer-sales-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.dealer-sales-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: rgba(255, 151, 29, 0.1);
    border-bottom: 1px solid var(--color-border);
    font-weight: var(--font-weight-semi-bold);
    font-size: var(--font-size-sm);
    color: var(--color-gray-700);
    position: sticky;
    top: 0;
    z-index: 2;
}

.dealer-name-header {
    text-align: left;
}

.sales-count-header {
    text-align: center;
}

.total-amount-header {
    text-align: right;
}

.dealer-sales-list {
    flex: 1;
    overflow-y: auto;
}

.dealer-name {
    font-weight: var(--font-weight-medium);
    color: var(--color-gray-700);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sales-count {
    text-align: right;
    /*padding-right:5px;*/
    /*display: flex;*/
    align-items: center;
    /*justify-content: center;
    background: var(--color-primary);
    color: white;*/
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-full);
    /*font-size: var(--font-size-sm);*/
    font-weight: var(--font-weight-semi-bold);
    min-width: 2rem;
    text-align: right;
}

.total-amount {
    text-align: right;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    white-space: nowrap;
}

.amount-number {
    font-weight: var(--font-weight-semi-bold);
}

.sales-by-coach-widget {
    overflow: hidden;
}

/* Enhanced Sales By Coach Widget */
.sales-by-coach-widget .widget-body {
    padding: 0;
    overflow-y: auto;
}

.dashboard-widget .maximized .dashboard-sales-by-list {
    height: 600px;
}


.dashboard-sales-by-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    /*font-size: 1rem;*/
}

.dashboard-sales-by-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    padding: var(--space-sm) var(--space-lg);
    background: var(--transparent-bg);
    border-bottom: 1px solid var(--color-border);
    font-weight: var(--font-weight-semi-bold);
    position: sticky;
    top: 0;
    z-index: 2;
}

.dashboard-sales-by-list {
    height:250px;
    overflow-y: auto;
}

.dashboard-widget.maximized .dashboard-sales-by-list {
    height: 600px;
}

.dashboard-sales-by-item {
    display: grid;
    grid-template-columns: 50% 15% 35%;
   /* gap: var(--space-sm);*/
    padding: var(--space-sm) var(--space-lg);
    border-bottom: 1px solid var(--color-gray-200);
    transition: all var(--component-transition);
    cursor: pointer;
}

.dashboard-widget.maximized .dashboard-sales-by-item {
    grid-template-columns: 50% 15% 35%;
}


.dashboard-sales-by-item:hover,
.dashboard-sales-by-item.highlighted {
    background: var(--color-primary-hover);
    border-left: 3px solid var(--color-success);
    overflow-x: hidden !important;
    /*color: black;*/
    color: var(--color-primary);
}

.coach-name {
    font-weight: var(--font-weight-light);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-sales-by-item .sales-number {
    background: black;
    color: white;
    padding: 0px var(--space-sm);
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    min-width: 2rem;
    text-align: center;
}

.dashboard-sales-products-details {
    padding-left: 35px;
    padding-right: 10px;
    margin-top: 5px;
    margin-bottom: 10px;
    background-color: #2b2b2b;
}

/*
.dashboard-sales-products-details .products-list {
    font-size: 1rem;
}
*/

.dashboard-sales-products-details .products-list .product-row {
    display: grid;
    grid-template-columns: 50% 10% 10% 30%;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid #e9ecef;
}

.dashboard-widget.maximized .dashboard-sales-products-details .products-list .product-row {
    /*font-size: 10px;*/
    grid-template-columns: 52% 9% 9% 20%;
}

.dashboard-sales-products-details .products-list .product-row .product-name {
    flex: 1;
    min-width: 0;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


.dashboard-sales-products-details .products-list .product-row .product-stats {
    display: flex;
    gap: 25px;
    align-items: center;
    flex-shrink: 0;
}

.dashboard-sales-products-details .products-list .product-row .sales-count {
    min-width: 30px;
    text-align: right !important;
}

.dashboard-sales-products-details .products-list .product-row .percentage {
    min-width: 40px;
    text-align: right;
}

.dashboard-sales-products-details .products-list .product-row .amount {
    min-width: 80px;
    text-align: right;
    font-weight: 600;
    color: #28a745;
}

.dashboard-sales-products-details .no-products {
    text-align: center;
    padding: 15px;
    color: #6c757d;
    font-style: italic;
}

.dashboard-sales-products-details .no-products i.bi {
    font-size: 1.2em;
}

.dashboard-sales-products-details .no-products div {
    margin-top: 5px;
}

/* Header Controls */
.dashboard-header-controls {
    display: inline-flex;
    align-items: center;
}

.dashboard-header-controls .add-widget-btn {
    font-size: var(--font-size-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--button-sm-radius);
    transition: all var(--component-transition);
    border: none;
    background-color: var(--color-success);
    color: white;
}

.dashboard-header-controls .add-widget-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
    background-color: #218838;
} 

.dashboard-header-controls .add-widget-btn i {
    margin-right: var(--space-xs);
}

    /* Enhanced Widget Gallery (Add Widget Modal) */
.widget-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-lg);
    padding: var(--space-lg) 0;
} 

.widget-option {
    text-align: center;
    padding: var(--space-xl);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--component-transition);
    background: white;
} 

.widget-option:hover {
    border-color: var(--color-primary);
    background: var(--color-gray-100);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
} 

.widget-preview {
    font-size: var(--font-size-4xl);
    color: var(--color-gray-600);
    margin-bottom: var(--space-lg);
} 

.widget-option h6 {
    margin: var(--space-sm) 0;
    color: var(--color-gray-700);
    font-weight: var(--font-weight-semi-bold);
} 

.widget-option p {
    margin: 0;
    font-size: var(--font-size-sm);
    color: var(--color-gray-600);
}

/* Enhanced Empty Dashboard State */
.empty-dashboard {
    grid-column: 1 / -1;
    grid-row: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(248, 249, 250, 0.5);
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-md);
    min-height: 300px;
} 

.no-widgets-message {
    grid-column: 1 / -1;
    min-height: 300px;
} 

.no-widgets-message .card-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Loading States */
.dealer-sales-loading, .dashboard-sales-by-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: var(--space-xl);
}
/* Unknown Widget */
.unknown-widget {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
} 

.unknown-widget .widget-header {
    background: #fff3cd;
    border-bottom-color: #ffeaa7;
}

/* No Content Message */
.no-content-message {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--color-gray-600);
    padding: var(--space-xl);
}

/* Widget Animation Classes */
@keyframes widgetSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
} 

@keyframes widgetSlideOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.8);
    }
} 

.widget-animate-in {
    animation: widgetSlideIn 0.3s ease-out;
} 

.widget-animate-out {
    animation: widgetSlideOut 0.3s ease-in;
}

/* Maximized Widget Overlay */
.widget-maximized-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    backdrop-filter: blur(4px);
}
    /* CRITICAL DEFENSIVE CSS RULES - MAXIMUM SPECIFICITY TO PREVENT REGRESSIONS */
    /* Force widgets to respect grid positioning - HIGHEST PRIORITY */
    .dashboard-container .dashboard-dynamic-grid .dashboard-widget.widget-dimension-fixed {
    /* Ensure forced dimensions are always respected */
    grid-column: var(--forced-width, inherit) !important;
    grid-row: var(--forced-height, inherit) !important;
}
    /* Prevent any widget from accidentally taking full width unless intended */
    .dashboard-container .dashboard-dynamic-grid:not(.mobile-layout) .dashboard-widget {
    max-width: 100% !important;
    min-width: 0 !important;
    width: auto !important;
}
    /* Emergency fallback: If no grid classes are applied, force 3-column layout */
    .dashboard-container .dashboard-dynamic-grid:not([class*="cols-"]):not(.mobile-layout) {
    grid-template-columns: repeat(3, 1fr) !important;
}
    /* Force grid behavior over any conflicting CSS */
    .dashboard-container .dashboard-dynamic-grid {
    display: grid !important;
    grid-auto-flow: row !important;
    justify-items: stretch !important;
    align-items: stretch !important;
}
    /* Ensure widgets don't overflow grid boundaries */
    .dashboard-container .dashboard-dynamic-grid .dashboard-widget {
    overflow: hidden !important;
    box-sizing: border-box !important;
    contain: layout size !important;
}
    /* Additional CSS Support for Manual Widget Size Fixes - ENHANCED */
    .dashboard-widget.widget-size-fixed, .dashboard-widget.widget-dimension-fixed {
    /* Ensure manual fixes are always respected with maximum specificity */
    grid-column: var(--widget-width, span 1) !important;
    grid-row: var(--widget-height, span 1) !important;
}
    /* Force proper CSS variable support with fallbacks */
    .dashboard-container .dashboard-dynamic-grid .dashboard-widget {
    --widget-width: attr(data-width, 1);
    --widget-height: attr(data-height, 1);
}
    /* Responsive overrides - ensure mobile takes precedence */
    @media (max-width: 768px) {
    .dashboard-container .dashboard-dynamic-grid.mobile-layout .dashboard-widget:not(.maximized) {
        grid-column: span 1 !important;
        grid-row: span 1 !important;
        max-width: 100% !important;
        width: 100% !important;
    }
    
    /* Force mobile grid to single column */
    .dashboard-container .dashboard-dynamic-grid.mobile-layout {
        grid-template-columns: 1fr !important;
        grid-auto-columns: 1fr !important;
    }
}
    /* Desktop responsive breakpoints - ensure proper column counts */
    @media (min-width: 769px) and (max-width: 992px) {
    .dashboard-container .dashboard-dynamic-grid.responsive-layout.cols-2 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
} @media (min-width: 993px) and (max-width: 1850px) {
    .dashboard-container .dashboard-dynamic-grid.responsive-layout.cols-3 {
        grid-template-columns: repeat(3, 1fr) !important;
    }
} @media (min-width: 1921px) {
    .dashboard-container .dashboard-dynamic-grid.responsive-layout.cols-4 {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}
    /* CRITICAL: Enhanced Maximized Widget Styling */
.dashboard-widget.maximized {
    /* Position and sizing - use absolute positioning within dashboard container */
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: unset !important; /* Allow height control instead of bottom positioning */
    width: 100% !important; /* Keep perfect full width as requested */
    /*height: calc((350px * 2) + 1rem) !important;*/ /* 2 rows height: 350px per row + 1rem gap */
    height: var(--content-max-height);
    z-index: 9999 !important;
    /* 100% opaque black background as specified */
    background-color: rgba(0, 0, 0, 1.0) !important;
    color: white !important;
    /* Remove margins and padding for full coverage */
    margin: 0 !important;
    padding: 0 !important;

    /* Enhanced styling */
    box-shadow: 0 0 0 4px rgba(255, 151, 29, 0.3), var(--shadow-xl) !important;
    border: 2px solid var(--color-primary) !important;
    border-radius: var(--radius-lg) !important;

    /* Ensure content is visible on black background */
    --color-fg: white;
    --color-bg: black;
    /* Remove grid positioning */
    grid-column: unset !important;
    grid-row: unset !important;
    transform: none !important;
    /* Ensure proper overflow handling */
    overflow: auto !important;
}
    /* Ensure maximized widget content is properly styled for black background */
    .dashboard-widget.maximized .widget-header {
    background-color: rgba(0, 0, 0, 0.9) !important;
    color: white !important;
    border-bottom: 1px solid #333 !important;
} .dashboard-widget.maximized .widget-title {
    color: white !important;
} .dashboard-widget.maximized .widget-body {
    background-color: rgba(0, 0, 0, 1.0) !important;
    color: white !important;
}
    /* Ensure widget action buttons are visible on dark background */
    .dashboard-widget.maximized .widget-actions .btn {
    background: rgba(255, 255, 255, 0.9) !important;
    color: #333 !important;
} .dashboard-widget.maximized .widget-actions .btn:hover {
    background: rgba(255, 255, 255, 1.0) !important;
}
    /* Sales by Coach Widget Styles */
    .clickable-dashboard-item {
    transition: all 0.2s ease;
    padding: 5px 15px;
    margin: 2px 0;
}
        .clickable-dashboard-item:hover {
            background-color: var(--color-primary-hover);
            transform: translateX(2px);
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
            overflow-x: hidden !important;
        }

        .clickable-dashboard-item:active {
            transform: translateX(0px);
            overflow-x: hidden !important;
        }
.clickable-dashboard-item.highlighted {
    background-color: rgba(255, 255, 255, 0.15);
}
    /* Coach Products Modal Styles */
    #coachProductsModal .stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
} #coachProductsModal .stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 4px;
} #coachProductsModal .stat-label {
    font-size: 0.85rem;
    opacity: 0.9;
} #coachProductsModal .product-name {
    font-weight: 500;
    color: #495057;
} #coachProductsModal .company-name {
    font-size: 0.9rem;
    color: #6c757d;
} #coachProductsModal .table th {
    border-top: none;
    font-weight: 600;
    color: #495057;
    background-color: #f8f9fa;
} #coachProductsModal .table td {
    vertical-align: middle;
} #coachProductsModal .modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom: none;
} #coachProductsModal .modal-header .btn-close {
    filter: invert(1);
} #coachProductsModal .modal-footer {
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
}
    /* Responsive adjustments for coach products modal */
    @media (max-width: 768px) {
    #coachProductsModal .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    #coachProductsModal .stat-card {
        margin-bottom: 10px;
    }
    
    #coachProductsModal .table-responsive {
        font-size: 0.85rem;
    }
    
    #coachProductsModal .stat-value {
        font-size: 1.2rem;
    }
}