:root {
    --primary-bg: #0f172a;
    --secondary-bg: #1e293b;
    --accent-color: #3b82f6;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --hover-bg: #334155;
    --primary-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --accent-hover: #2563eb;
    --card-bg: #1e293b;
    --border-color: #334155;
    --card-radius: 12px;
    --element-radius: 8px;
    --hover-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.2);
}

* {
    box-sizing: border-box;
}

body {
    background: var(--primary-gradient);
    color: var(--text-primary);
    min-height: 100vh;
}

/* Container */
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
}

/* Title */
.dashboard-title {
    display: flex;
    align-items: center;
    font-size: clamp(1.25rem, 3vw, 2rem);
    font-weight: 700;
    gap: 0.75rem;
    margin-bottom: 2rem;
    color: var(--text-primary);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.dashboard-title i {
    color: var(--accent-color);
    font-size: 1.2em;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

/* Stats Card */
.stats-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    padding: 1.5rem;
    transition: var(--hover-transition);
    position: relative;
    overflow: hidden;
}

.stats-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-color), var(--accent-hover));
    opacity: 0;
    transition: var(--hover-transition);
}

.stats-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.stats-card:hover::before {
    opacity: 1;
}

/* Header */
.stats-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    color: var(--text-primary);
    font-weight: 600;
}

.stats-header i {
    color: var(--accent-color);
    font-size: 1.3em;
    padding: 0.5rem;
    background: rgba(59, 130, 246, 0.1);
    border-radius: var(--element-radius);
}

/* Stats Content */
.stats-content {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.stats-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: var(--element-radius);
    padding: 1rem;
    font-size: 0.95rem;
    transition: var(--hover-transition);
    background: rgba(30, 41, 59, 0.5);
}

.stats-item:hover {
    background: var(--hover-bg);
    border-color: var(--accent-color);
}

.stats-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.stats-value {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1.1em;
}

/* Chart */
canvas {
    width: 100% !important;
    height: auto !important;
    border-radius: var(--element-radius);
}

/* Recent Items */
.recent-items {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 0.75rem;
}

.recent-item {
    border: 1px solid var(--border-color);
    border-radius: var(--element-radius);
    padding: 1.25rem;
    transition: var(--hover-transition);
    background: rgba(30, 41, 59, 0.3);
    position: relative;
}

.recent-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent-color);
    border-radius: 0 var(--element-radius) var(--element-radius) 0;
    opacity: 0;
    transition: var(--hover-transition);
}

.recent-item:hover {
    border-color: var(--accent-color);
    background: var(--hover-bg);
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
}

.recent-item:hover::before {
    opacity: 1;
}

.item-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.ticket-id {
    font-weight: 700;
    color: var(--accent-color);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ticket-title {
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.4;
}

.item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.item-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.item-meta i {
    color: var(--accent-color);
    font-size: 0.9em;
}

/* Full Width Card */
.full-width {
    grid-column: 1 / -1;
}

/* Responsive Design */
@media (max-width: 480px) {
    .dashboard-container {
        padding: 0.75rem;
    }
    
    .dashboard-title {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .stats-card {
        padding: 1.25rem;
    }
    
    .stats-header {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }
    
    .stats-item {
        padding: 0.875rem;
        font-size: 0.9rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .stats-value {
        font-size: 1.2em;
        color: var(--accent-color);
    }
    
    .recent-item {
        padding: 1rem;
    }
    
    .item-meta {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .ticket-title {
        font-size: 1rem;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .dashboard-container {
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .stats-item {
        padding: 1rem;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .full-width {
        grid-column: span 2;
    }
}

@media (min-width: 1025px) {
    .dashboard-container {
        padding: 2rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    
    .full-width {
        grid-column: span 2;
    }
    
    .dashboard-title {
        margin-bottom: 2.5rem;
    }
}

@media (min-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .full-width {
        grid-column: span 2;
    }
}

/* Touch and Accessibility Improvements */
@media (hover: none) and (pointer: coarse) {
    .stats-card:hover,
    .recent-item:hover,
    .stats-item:hover {
        transform: none;
    }
    
    .stats-card,
    .recent-item,
    .stats-item {
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(59, 130, 246, 0.1);
    }
}

/* Focus states for accessibility */
.stats-card:focus,
.recent-item:focus,
.stats-item:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Animation for loading states */
@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.loading {
    background: linear-gradient(90deg, var(--card-bg) 0px, var(--hover-bg) 100px, var(--card-bg) 200px);
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite;
}