/* Dashboard Specific Styles */

/* CSS Variables already defined in style.css but dashboard specific ones */
:root {
    --sidebar-width: 260px;
    --sidebar-collapsed: 80px;
}

/* Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
}

.sidebar.collapsed .sidebar-header {
    padding: 1.5rem 1rem;
    justify-content: center;
    flex-direction: column;
    gap: 1rem;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    position: relative;
    min-height: 40px;
    overflow: hidden;
    width: 100%;
    justify-content: flex-start;
}

.sidebar.collapsed .sidebar-logo {
    justify-content: center;
    width: 40px;
}

.logo-full-img {
    height: 40px;
    width: auto;
    max-width: 120px;
    transition: all 0.3s ease;
}

.logo-compact-img {
    height: 40px;
    width: 40px;
    position: absolute;
    left: 50%;
    top: 0;
    opacity: 0;
    transition: all 0.3s ease;
    object-fit: contain;
    transform: translateX(-50%);
}

.sidebar.collapsed .logo-full-img {
    opacity: 0;
    visibility: hidden;
}

.sidebar.collapsed .logo-compact-img {
    opacity: 1;
    visibility: visible;
}

.toggle-sidebar {
    background: none;
    border: none;
    color: var(--gray-600);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.toggle-sidebar:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.25rem;
    border-radius: var(--radius);
    color: var(--gray-700);
    text-decoration: none;
    transition: all 0.2s;
    position: relative;
}

.nav-item:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 70%;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.nav-icon {
    font-size: 1.25rem;
    min-width: 24px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-icon i {
    font-size: 1.1rem;
    width: 18px;
    text-align: center;
}

.nav-label {
    white-space: nowrap;
    transition: opacity 0.3s;
}

.sidebar.collapsed .nav-label {
    display: none;
}

.nav-divider {
    height: 1px;
    background: var(--gray-200);
    margin: 1rem 0;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--gray-200);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border-radius: var(--radius);
    background: var(--gray-100);
    position: relative;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    overflow: hidden;
}

.user-avatar .gravatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.user-info {
    flex: 1;
    transition: opacity 0.3s;
    min-width: 0;
    overflow: hidden;
}

.sidebar.collapsed .user-info {
    display: none;
}

.user-name {
    font-weight: 500;
    font-size: 0.75rem;
    color: var(--dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.user-role {
    font-size: 0.7rem;
    color: var(--gray-600);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    margin-top: 2px;
}

.logout-btn {
    padding: 0.5rem;
    color: var(--gray-500);
    text-decoration: none;
    border-radius: var(--radius);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
}

.logout-btn:hover {
    color: var(--primary);
    background: var(--gray-200);
    transform: scale(1.1);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed + .main-content {
    margin-left: var(--sidebar-collapsed);
}

/* Top Bar */
.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
}

.topbar-filters {
    display: flex;
    gap: 1rem;
}

.filter-select {
    padding: 0.5rem 1rem;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius);
    background: white;
    color: var(--gray-700);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 150px;
}

.filter-select:hover {
    border-color: var(--primary);
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 116, 198, 0.1);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.period-selector {
    position: relative;
    min-width: 180px;
}

.period-dropdown {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: white;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.2s;
}

.period-dropdown:hover {
    border-color: var(--primary);
}

.period-dropdown.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 116, 198, 0.1);
}

.period-dropdown-icon {
    transition: transform 0.2s;
}

.period-dropdown.active .period-dropdown-icon {
    transform: rotate(180deg);
}

.period-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.5rem;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    display: none;
    overflow: hidden;
}

.period-menu.show {
    display: block;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.period-option {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.period-option:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.period-option.selected {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.period-option.selected::after {
    content: '✓';
    color: var(--primary);
}

.period-divider {
    height: 1px;
    background: var(--gray-200);
    margin: 0.25rem 0;
}

/* Dashboard Content */
.dashboard-content {
    padding: 2rem;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-content {
    flex: 1;
}

.stat-title {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.5rem;
    font-variant-numeric: tabular-nums;
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
}

.stat-change.positive {
    background: var(--success-light);
    color: var(--success);
}

.stat-change.negative {
    background: var(--danger-light);
    color: var(--danger);
}

.stat-icon {
    width: 48px;
    height: 48px;
    background: var(--gray-100);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon i {
    font-size: 1.3rem;
    color: var(--gray-600);
}

.stat-card.primary .stat-icon {
    background: var(--primary-light);
}

.stat-card.primary .stat-icon i {
    color: var(--primary);
}

.stat-card.success .stat-icon {
    background: var(--success-light);
}

.stat-card.success .stat-icon i {
    color: var(--success);
}

.stat-card.warning .stat-icon {
    background: var(--warning-light);
}

.stat-card.warning .stat-icon i {
    color: var(--warning);
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: visible;
}

.chart-card.full-width {
    grid-column: 1 / -1;
}

.chart-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chart-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-info {
    width: 16px;
    height: 16px;
    background: var(--gray-300);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--gray-600);
    cursor: help;
}

.chart-actions {
    display: flex;
    gap: 0.5rem;
}

.chart-action-btn {
    padding: 0.375rem 0.75rem;
    background: var(--gray-100);
    border: none;
    border-radius: var(--radius);
    color: var(--gray-700);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.chart-action-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.chart-action-btn.active {
    background: var(--primary);
    color: white;
}

.chart-body {
    padding: 1.5rem;
    height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-500);
    font-weight: 500;
    background: var(--gray-50);
}

/* Table */
.table-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 2rem;
}

.table-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--dark);
}

.table-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--gray-100);
    border-radius: var(--radius);
    width: 250px;
}

.table-search input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--gray-700);
    font-size: 0.875rem;
}

.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: var(--gray-50);
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-200);
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.875rem;
    color: var(--gray-700);
}

.data-table tr:hover {
    background: var(--gray-50);
}

.table-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

/* Insights Panel */
.insights-panel {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
}

.insights-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.insights-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--dark);
}

.insights-badge {
    background: var(--warning-light);
    color: var(--warning);
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
}

.insight-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    transition: all 0.2s;
}

.insight-item:hover {
    background: var(--primary-light);
}

.insight-icon {
    width: 40px;
    height: 40px;
    background: white;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.insight-icon i {
    font-size: 1.1rem;
    color: var(--primary);
}

.insight-content {
    flex: 1;
}

.insight-title {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.25rem;
}

.insight-description {
    font-size: 0.875rem;
    color: var(--gray-600);
    line-height: 1.4;
}

.insight-action {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    box-shadow: var(--shadow-xl);
    cursor: pointer;
    transition: all 0.3s;
    z-index: 100;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 10px 30px 0 rgba(0, 116, 198, 0.4);
}

/* Loading State */
.skeleton {
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: var(--radius);
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Responsive */
@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .topbar-filters {
        display: none;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .topbar {
        padding: 1rem;
    }
    
    .dashboard-content {
        padding: 1rem;
    }
    
    .table-search {
        width: 150px;
    }
}

/* Tooltips */
[data-tooltip] {
    position: relative;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--dark);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.75rem;
    white-space: normal;
    max-width: 250px;
    width: max-content;
    z-index: 1001;
    margin-bottom: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    line-height: 1.4;
}

/* Animation classes */
.fade-in {
    animation: fadeIn 0.3s ease forwards;
}

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

.slide-in {
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

/* Pulse animation for live indicator */
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

/* Utility classes for text colors */
.text-success {
    color: var(--success) !important;
}

.text-danger {
    color: var(--danger) !important;
}

.text-muted {
    color: var(--gray-500) !important;
}