/* Module Dashboard Styles */

/* Module Header Cards */
.module-header-card {
    border: none;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}

.bg-gradient-primary {
    background: linear-gradient(45deg, #4e73df 0%, #2e59d9 100%);
}

.bg-gradient-success {
    background: linear-gradient(45deg, #1cc88a 0%, #13855c 100%);
}

.bg-gradient-info {
    background: linear-gradient(45deg, #36b9cc 0%, #258391 100%);
}

.bg-gradient-warning {
    background: linear-gradient(45deg, #f6c23e 0%, #dda20a 100%);
}

.bg-gradient-secondary {
    background: linear-gradient(45deg, #6c757d 0%, #495057 100%);
}

.module-actions .btn {
    font-weight: 500;
    border-radius: 50px;
    padding: 0.375rem 1rem;
}

/* Module Navigation */
.module-nav .nav-pills .nav-link {
    padding: 0.6rem 1rem;
    border-radius: 50px;
    font-weight: 500;
    transition: all 0.2s;
    margin-right: 0.5rem;
}

.module-nav .nav-pills .nav-link:hover {
    background-color: #f8f9fa;
}

.module-nav .nav-pills .nav-link.active {
    background-color: #0d6efd;
}

/* Module Switcher */
.module-switcher {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.module-switcher .btn {
    border-radius: 50px;
    padding: 0.375rem 1rem;
    transition: all 0.2s;
}

.module-switcher .btn-outline-secondary:hover {
    background-color: #f8f9fa;
    color: #0d6efd;
    border-color: #dee2e6;
}

/* Module Breadcrumb */
.module-breadcrumb {
    background-color: #f8f9fa;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.module-breadcrumb .breadcrumb {
    margin-bottom: 0;
    padding: 0;
}

.module-breadcrumb .breadcrumb-item {
    font-size: 0.875rem;
}

.module-breadcrumb .breadcrumb-item.active {
    color: #495057;
    font-weight: 500;
}

.module-breadcrumb .breadcrumb-item a {
    color: #6c757d;
    text-decoration: none;
    transition: color 0.2s;
}

.module-breadcrumb .breadcrumb-item a:hover {
    color: #0d6efd;
}

/* Widget Cards */
.widget-card {
    height: 100%;
    transition: all 0.3s ease;
    overflow: hidden;
}

.widget-card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

.widget-card.minimized .widget-body {
    display: none;
}

.widget-card.minimized .widget-toggle i {
    transform: rotate(180deg);
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    padding: 1rem;
}

.widget-title {
    margin-bottom: 0;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.widget-title i {
    margin-right: 0.5rem;
    opacity: 0.7;
}

/* Stats Items */
.stats-item {
    text-align: center;
    border-radius: 0.375rem;
    padding: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stats-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
}

.stats-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    margin: 0 auto 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
}

.stats-item h5 {
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #495057;
}

.stats-item h2 {
    margin-bottom: 0.75rem;
    font-size: 1.75rem;
    font-weight: 700;
}

/* Module Content Cards */
.module-content-card {
    border: none;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
}

.module-content-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.module-content-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    background-color: #f8f9fa;
}

.module-content-body {
    padding: 1.25rem;
}

.module-content-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid rgba(0, 0, 0, 0.125);
    background-color: #f8f9fa;
}

/* Module Dashboard Tables */
.module-table {
    width: 100%;
    margin-bottom: 1rem;
}

.module-table th {
    font-weight: 600;
    vertical-align: bottom;
    border-bottom: 2px solid #dee2e6;
    padding: 0.75rem;
}

.module-table td {
    padding: 0.75rem;
    vertical-align: middle;
    border-top: 1px solid #dee2e6;
}

.module-table tr:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

/* Responsive adjustments */
@media (max-width: 767.98px) {
    .module-header-card .module-actions {
        margin-top: 1rem;
    }

    .module-switcher {
        flex-wrap: wrap;
    }

    .module-switcher .btn {
        margin-bottom: 0.5rem;
    }

    .module-header-card .display-6 {
        font-size: 1.5rem;
    }

    .module-header-card .lead {
        font-size: 1rem;
    }

    .module-header-card .module-actions {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
    }

    .module-header-card .module-actions .btn {
        margin-top: 0.5rem;
        margin-left: 0 !important;
    }

    .module-nav {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 0.5rem;
    }

    .module-nav .nav-item {
        white-space: nowrap;
    }

    .widget-card .card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .widget-card .widget-actions {
        margin-top: 0.5rem;
        align-self: flex-end;
    }

    .card-header h5.widget-title {
        font-size: 1rem;
        width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* iPad/Tablet responsiveness */
@media (min-width: 768px) and (max-width: 991.98px) {
    .module-nav {
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .module-nav .nav-item {
        white-space: nowrap;
    }

    .dashboard-widgets-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Progress bar */
.progress {
    height: 0.5rem;
    border-radius: 1rem;
}

.progress-sm {
    height: 0.25rem;
}

/* Table styles */
.table-dashboard {
    margin-bottom: 0;
}

.table-dashboard th {
    font-weight: 600;
    border-top: none;
    background-color: #f8f9fa;
}

/* Chart container */
.chart-container {
    position: relative;
    margin: auto;
}

/* Module navigation */
.module-nav {
    border-radius: 0.375rem;
    background-color: #f8f9fa;
    padding: 0.5rem;
}

.module-nav .nav-pills .nav-link {
    border-radius: 50px;
    padding: 0.5rem 1rem;
    margin: 0.25rem;
    color: #495057;
}

.module-nav .nav-pills .nav-link.active {
    background-color: #0d6efd;
    color: white;
}

.module-nav .nav-pills .nav-link:not(.active):hover {
    background-color: rgba(13, 110, 253, 0.1);
}

/* Breadcrumb */
.module-breadcrumb {
    padding: 0.5rem 1rem;
    background-color: #f8f9fa;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
}

.module-breadcrumb .breadcrumb {
    margin-bottom: 0;
}

/* Dashboard widgets grid */
.widget-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

@media (max-width: 768px) {
    .widget-grid {
        grid-template-columns: 1fr;
    }
}

/* AJAX Widget Placeholders */
.ajax-widget-placeholder {
    min-height: 150px;
    position: relative;
}

.ajax-widget-placeholder .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Widget refresh button animation */
.widget-refresh-btn .fa-spin {
    animation: fa-spin 1s linear infinite;
}

@keyframes fa-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Module Dashboard Widget Layout Improvements */
.dashboard-widgets-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

@media (max-width: 768px) {
    .dashboard-widgets-container {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Dark Mode Support
   ============================================ */
[data-theme="dark"] .module-content-header {
    background-color: rgba(0, 0, 0, 0.2);
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .module-content-footer {
    background-color: rgba(0, 0, 0, 0.2);
    border-top-color: var(--border-color);
}

[data-theme="dark"] .module-breadcrumb {
    background-color: var(--bg-secondary);
    box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .module-breadcrumb .breadcrumb-item.active {
    color: var(--text-primary);
}

[data-theme="dark"] .module-nav {
    background-color: var(--bg-secondary);
}

[data-theme="dark"] .module-nav .nav-pills .nav-link:not(.active):hover {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

[data-theme="dark"] .module-nav .nav-pills .nav-link {
    color: var(--text-secondary);
}

[data-theme="dark"] .module-nav .nav-pills .nav-link.active {
    color: #fff;
}

[data-theme="dark"] .widget-header {
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .stats-item h5 {
    color: var(--text-secondary);
}

[data-theme="dark"] .table-dashboard th {
    background-color: rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .module-table th {
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .module-table td {
    border-top-color: var(--border-color);
}

[data-theme="dark"] .module-table tr:hover {
    background-color: var(--bg-primary);
}

[data-theme="dark"] .module-switcher .btn-outline-secondary:hover {
    background-color: var(--bg-primary);
    color: var(--primary-light);
    border-color: var(--border-color);
}