/* Base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Light theme variables */
    --primary-color: #1845F3;
    --primary-hover: #0F2EAE;
    --success-color: #2ecc71;
    --warning-color: #f1c40f;
    --danger-color: #e74c3c;
    --neutral-color: #95a5a6;
    --text-primary: #1d1c1d;
    --text-secondary: #616061;
    --background-light: #f8f9ff;
    --background: #ffffff;
    --border-color: #eaecf5;
    --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.1);
    --shadow-md: 0 2px 6px rgba(16, 24, 40, 0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

/* Dark theme variables */
[data-theme="dark"] {
    --primary-color: #4169E1;
    --primary-hover: #6495ED;
    --success-color: #00b894;
    --warning-color: #ffd32a;
    --danger-color: #ff6b6b;
    --neutral-color: #b2bec3;
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    --background-light: #2d3748;
    --background: #1a202c;
    --border-color: #4a5568;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.3);
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background-light);
    color: var(--text-primary);
    line-height: 1.5;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* Header and Summary */
header {
    background-color: var(--background);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

h1, h2 {
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: -0.02em;
}

h1 {
    font-size: 28px;
    margin-bottom: 24px;
}

h2 {
    font-size: 20px;
    margin-bottom: 16px;
}

.summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 24px;
    margin-bottom: 32px;
}

.stat-box {
    background-color: var(--background);
    padding: 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    text-align: center;
}

.stat-box h3 {
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 12px;
}

.stat-box p {
    color: var(--text-primary);
    font-size: 32px;
    font-weight: 600;
}

/* Filter Buttons */
.filter-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 32px;
    flex-wrap: wrap;
    padding: 8px;
    background-color: var(--background);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.filter-btn {
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    background-color: var(--background);
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    min-width: 100px;
    text-align: center;
}

.filter-btn:hover {
    background-color: var(--background-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-btn.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Charts Container */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.chart-box {
    background-color: #fff;
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    position: relative;
    background: linear-gradient(145deg, #fff 0%, var(--background-light) 100%);
}

.chart-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.monthly-chart {
    grid-column: 1 / -1;
    margin-top: 16px;
}

.monthly-chart canvas {
    min-height: 300px;
}

/* User Cards */
.users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.user-card {
    background-color: #fff;
    padding: 16px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.user-info {
    flex-grow: 1;
    position: relative;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
    display: inline-block;
    vertical-align: middle;
}

.user-info h3 {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    display: inline-block;
    vertical-align: middle;
}

.user-info p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 2px;
}

.last-seen {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.activity-stats {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

/* Executive Insights */
.executive-insights {
    margin-top: 32px;
    margin-bottom: 32px;
}

.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.insight-box {
    background-color: #fff;
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.3s ease,
                border-color 0.3s ease;
}

.insight-box:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.insight-box h3 {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 16px;
}

.insight-value {
    font-size: 32px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

.insight-label {
    color: var(--text-secondary);
    font-size: 14px;
}

.top-users-list {
    margin-top: 16px;
}

.top-user {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.top-user:hover {
    background-color: var(--background-light);
    transform: translateX(4px);
}

.top-user:active {
    transform: scale(0.98) translateX(4px);
}

.top-user:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--primary-color);
    background-color: var(--background-light);
}

.top-user:last-child {
    border-bottom: none;
}

.top-user .rank {
    width: 24px;
    height: 24px;
    background-color: var(--background-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-right: 12px;
}

.top-user .name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.top-user .time {
    font-size: 14px;
    color: var(--primary-color);
    font-weight: 500;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(16, 24, 40, 0.6);
    overflow-y: auto;
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: #fff;
    margin: 40px auto;
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    width: 90%;
    max-width: 1000px;
    position: relative;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

.close {
    position: absolute;
    right: 24px;
    top: 24px;
    font-size: 24px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.close:hover {
    background-color: var(--background-light);
    color: var(--text-primary);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .container {
        padding: 12px;
        width: 100%;
        overflow-x: hidden;
    }

    .charts-container {
        grid-template-columns: 1fr;
    }

    .chart-box {
        min-width: 0;
        width: 100%;
        padding: 16px;
        overflow: hidden;
    }

    .insights-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        margin: 16px;
        padding: 16px;
        width: calc(100% - 32px);
    }

    .stat-box p {
        font-size: 20px;
    }

    .insight-value {
        font-size: 24px;
    }

    /* Adjust user cards for mobile */
    .users-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 0;
    }

    .user-card {
        margin: 6px 0;
        padding: 12px;
        width: 100%;
    }

    .user-header {
        flex-wrap: nowrap;
        gap: 8px;
    }

    .user-avatar {
        width: 32px;
        height: 32px;
    }

    .user-avatar-placeholder {
        width: 32px;
        height: 32px;
    }

    .user-info h3 {
        font-size: 0.95rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Adjust filter buttons for mobile */
    .filter-buttons {
        padding: 6px;
        gap: 6px;
        justify-content: center;
    }

    .filter-btn {
        padding: 8px 16px;
        font-size: 13px;
        min-width: auto;
    }

    /* Adjust summary stats for mobile */
    .summary {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 12px;
    }

    .stat-box {
        padding: 16px 12px;
    }

    .stat-box h3 {
        font-size: 14px;
        margin-bottom: 8px;
    }

    /* Adjust activity stats in user cards */
    .activity-stats {
        font-size: 13px;
    }

    .activity-stats p {
        margin-bottom: 4px;
    }

    /* Adjust last seen text */
    .last-seen {
        font-size: 11px;
    }

    /* Adjust status text */
    .status-text {
        font-size: 12px;
    }
}

/* Add styles for even smaller screens */
@media (max-width: 480px) {
    .container {
        padding: 8px;
    }

    .header-title {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }

    .header-title h1 {
        font-size: 20px;
    }

    .company-logo {
        height: 18px;
    }

    .stat-box {
        padding: 12px 8px;
    }

    .stat-box p {
        font-size: 18px;
    }

    .filter-buttons {
        flex-wrap: wrap;
    }

    .filter-btn {
        flex: 1 1 auto;
        min-width: 100px;
    }

    .chart-box {
        padding: 12px;
    }

    .chart-box canvas {
        height: auto !important;
    }
}

/* Fix chart responsiveness */
.chart-box {
    position: relative;
    width: 100%;
}

.chart-box canvas {
    max-width: 100%;
    height: auto !important;
}

/* Ensure modal doesn't overflow on mobile */
.modal-content {
    max-height: 90vh;
    overflow-y: auto;
}

/* Fix user card layout */
.user-info {
    min-width: 0;
    width: 100%;
}

.user-header {
    width: 100%;
    overflow: hidden;
}

/* Button press effect */
.filter-btn:active {
    transform: scale(0.98);
}

/* Better focus states */
.filter-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--primary-color), 0 0 0 4px rgba(24, 69, 243, 0.2);
}

/* Smooth status transitions */
.status-indicator {
    transition: background-color 0.3s ease;
}

/* Card stack effect */
.user-card {
    position: relative;
}

.user-card::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 2px;
    right: 2px;
    height: 4px;
    background: var(--border-color);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    z-index: -1;
}

/* Gradient text for emphasis */
.insight-value {
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

/* Glass morphism effect for modals */
.modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

/* Pulse animation for active status */
@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

/* Improved scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background-light);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

/* Modal Header */
.modal-header {
    margin-bottom: 24px;
    padding-right: 40px;
}

.user-title {
    flex-grow: 1;
}

.user-title h2 {
    margin-bottom: 4px;
    display: inline-block;
    vertical-align: middle;
}

.user-status {
    display: inline-block;
    vertical-align: middle;
    margin-left: 8px;
}

.user-status .status-indicator {
    margin-right: 4px;
}

.user-status p {
    display: inline-block;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Theme toggle button */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--background);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    font-size: 14px;
    z-index: 1001;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    background: var(--background-light);
}

.theme-toggle svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Dark mode adjustments for existing components */
.user-card {
    background-color: var(--background);
}

.stat-box, .chart-box, .insight-box, .modal-content {
    background-color: var(--background);
    border-color: var(--border-color);
}

.modal {
    background-color: rgba(0, 0, 0, 0.7);
}

.modal-content {
    background: var(--background);
}

[data-theme="dark"] .modal-content {
    backdrop-filter: blur(10px);
    background: rgba(26, 32, 44, 0.95);
}

/* Update chart colors for dark mode */
[data-theme="dark"] .chart-box canvas {
    filter: brightness(0.8) contrast(1.2);
}

/* Theme toggle icons */
.theme-toggle .sun-icon,
.theme-toggle .moon-icon {
    width: 20px;
    height: 20px;
}

[data-theme="dark"] .theme-toggle .sun-icon {
    display: none;
}

[data-theme="light"] .theme-toggle .moon-icon {
    display: none;
}

.theme-toggle:hover {
    transform: scale(1.05);
}

.theme-toggle:active {
    transform: scale(0.95);
}

/* Adjust chart colors for dark mode */
[data-theme="dark"] .chart-box {
    background-color: var(--background);
}

[data-theme="dark"] .chart-box canvas {
    filter: brightness(0.8) contrast(1.2);
}

/* Dark mode transitions */
.modal-content,
.user-card,
.stat-box,
.chart-box,
.insight-box {
    transition: background-color 0.3s ease,
                border-color 0.3s ease,
                box-shadow 0.3s ease;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    background-color: var(--background);
    padding: 12px;
    border-radius: var(--radius-md);
}

.company-logo {
    height: 24px;
    width: auto;
    object-fit: contain;
    mix-blend-mode: normal;
    isolation: isolate;
}

/* Remove any filters or color adjustments in dark mode */
[data-theme="dark"] .company-logo {
    filter: none;
    mix-blend-mode: normal;
}

.header-title h1 {
    margin-bottom: 0;
    font-size: 28px;
    color: var(--text-primary);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .header-title {
        gap: 12px;
        padding: 8px;
    }
    
    .company-logo {
        height: 20px;
    }
    
    .header-title h1 {
        font-size: 24px;
    }
}

/* Status indicators */
.status-active {
    background-color: var(--success-color);
    box-shadow: 0 0 0 2px rgba(46, 204, 113, 0.2);
    animation: pulse 2s infinite;
}

.status-away {
    background-color: var(--warning-color);
    box-shadow: 0 0 0 2px rgba(241, 196, 15, 0.2);
}

.status-offline {
    background-color: var(--neutral-color);
    box-shadow: 0 0 0 2px rgba(149, 165, 166, 0.2);
}

/* Status text colors */
.user-info p.status-text-active {
    color: var(--success-color);
}

.user-info p.status-text-away {
    color: var(--warning-color);
}

.user-info p.status-text-offline {
    color: var(--neutral-color);
}

/* Status legend */
.status-legend {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.status-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.status-legend-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.user-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.user-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-info h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-color);
}

.user-card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 15px;
    margin: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.user-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
    flex-shrink: 0;
}

.status-active {
    background-color: #2ecc71;
    box-shadow: 0 0 8px rgba(46, 204, 113, 0.5);
}

.status-away {
    background-color: #f1c40f;
    box-shadow: 0 0 8px rgba(241, 196, 15, 0.5);
}
 