/* ============================================
   MODERN DASHBOARD STYLES
   Enhanced UI/UX for Gentellella Template
   ============================================ */

/* ============================================
   BASE STYLES & VARIABLES
   ============================================ */
:root {
    /* Modern Color Palette */
    --primary-color: #667eea;
    --primary-dark: #5568d3;
    --secondary-color: #764ba2;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    
    /* Gradient Colors */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-warning: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --gradient-danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --gradient-info: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    
    /* Spacing & Sizing */
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    
    /* Border Radius */
    --border-radius-sm: 6px;
    --border-radius-md: 10px;
    --border-radius-lg: 12px;
    --border-radius-xl: 16px;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
    
    /* Transitions */
    --transition-fast: all 0.2s ease;
    --transition-normal: all 0.3s ease;
    --transition-slow: all 0.4s ease;
}

/* ============================================
   TYPOGRAPHY ENHANCEMENTS
   ============================================ */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #374151;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

h2 {
    font-size: 1.5rem;
    position: relative;
    padding-bottom: 0.5rem;
}

h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 3px;
}

.text-muted {
    color: #9ca3af !important;
    font-size: 0.875rem;
}

/* ============================================
   MODERN CARD DESIGN
   ============================================ */
.dashboard-card {
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    transition: var(--transition-normal);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    border: 1px solid #f3f4f6;
}

.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

.dashboard-card.gradient-card {
    background: var(--gradient-primary);
    color: white;
    border: none;
}

.dashboard-card.gradient-card h3,
.dashboard-card.gradient-card h4,
.dashboard-card.gradient-card .metric-value {
    color: white;
}

.dashboard-card.gradient-card .metric-label {
    opacity: 0.9;
}

/* ============================================
   KPI CARDS - MODERN DESIGN
   ============================================ */
.kpi-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-md);
    color: white;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(30%, -30%);
}

.kpi-card.primary {
    background: var(--gradient-primary);
}

.kpi-card.success {
    background: var(--gradient-success);
}

.kpi-card.warning {
    background: var(--gradient-warning);
}

.kpi-card.danger {
    background: var(--gradient-danger);
}

.kpi-card.info {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

.kpi-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 4px 0;
    display: block;
}

.metric-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.metric-trend {
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.2);
}

.metric-trend.up {
    color: #10b981;
}

.metric-trend.down {
    color: #ef4444;
}

/* ============================================
   PROGRESS BARS - MODERN STYLE
   ============================================ */
.progress-modern {
    height: 8px;
    border-radius: 8px;
    overflow: hidden;
    background: #e5e7eb;
    margin: var(--spacing-sm) 0;
}

.progress-modern .progress-bar {
    transition: width 1s ease;
}

.progress-modern .progress-bar.blue {
    background: var(--primary-color);
}

.progress-modern .progress-bar.green {
    background: var(--success-color);
}

.progress-modern .progress-bar.orange {
    background: var(--warning-color);
}

.progress-modern .progress-bar.red {
    background: var(--danger-color);
}

/* ============================================
   CHART CONTAINERS
   ============================================ */
.chart-container {
    position: relative;
    height: 250px;
    width: 100%;
}

.chart-container canvas {
    max-height: 250px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.chart-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
}

.chart-legend {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: var(--spacing-sm);
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
}

.chart-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

/* ============================================
   QUICK ACTION BUTTONS
   ============================================ */
.quick-action-btn {
    display: block;
    width: 100%;
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--border-radius-md);
    font-weight: 500;
    transition: var(--transition-normal);
    border: 1px solid transparent;
    margin-bottom: var(--spacing-sm);
}

.quick-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.quick-action-btn i {
    margin-right: 8px;
}

/* ============================================
   RECENT ACTIVITIES TIMELINE
   ============================================ */
.activity-timeline {
    position: relative;
    padding-left: 20px;
}

.activity-timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e5e7eb;
}

.activity-item {
    position: relative;
    padding-left: 15px;
    margin-bottom: var(--spacing-lg);
}

.activity-item::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-color);
}

.activity-item:last-child {
    margin-bottom: 0;
}

.activity-item.success::before {
    background: var(--success-color);
}

.activity-item.warning::before {
    background: var(--warning-color);
}

.activity-item.danger::before {
    background: var(--danger-color);
}

.activity-block {
    background: white;
    padding: var(--spacing-md);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
    border-left: 3px solid var(--primary-color);
}

.activity-block.success {
    border-left-color: var(--success-color);
}

.activity-block.warning {
    border-left-color: var(--warning-color);
}

.activity-block.danger {
    border-left-color: var(--danger-color);
}

.activity-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.activity-time {
    font-size: 0.75rem;
    color: #9ca3af;
}

/* ============================================
   CLASS DISTRIBUTION GRID
   ============================================ */
.class-distribution-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--spacing-md);
}

.class-distribution-card {
    background: white;
    border-radius: var(--border-radius-md);
    padding: var(--spacing-md);
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-normal);
    border: 1px solid #f3f4f6;
}

.class-distribution-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.class-distribution-card .class-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.class-distribution-card .student-count {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
}

.class-distribution-card .student-label {
    font-size: 0.75rem;
    color: #9ca3af;
}

/* ============================================
   RESPONSIVE ENHANCEMENTS
   ============================================ */
@media (max-width: 768px) {
    .kpi-card {
        min-height: auto;
    }

    .metric-value {
        font-size: 1.75rem;
    }

    .class-distribution-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .chart-container {
        height: 200px;
    }
}

@media (max-width: 576px) {
    .dashboard-card {
        padding: var(--spacing-md);
    }

    .metric-value {
        font-size: 1.5rem;
    }

    .class-distribution-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }

    .chart-container {
        height: 180px;
    }
}

/* ============================================
   ANIMATIONS & TRANSITIONS
   ============================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

.slide-in-right {
    animation: slideInRight 0.6s ease-out;
}

/* Delay animations for staggered effect */
.fade-in-up-1 { animation-delay: 0.1s; }
.fade-in-up-2 { animation-delay: 0.2s; }
.fade-in-up-3 { animation-delay: 0.3s; }
.fade-in-up-4 { animation-delay: 0.4s; }

/* ============================================
   UTILITY CLASSES
   ============================================ */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bg-gradient-primary { background: var(--gradient-primary); }
.bg-gradient-success { background: var(--gradient-success); }
.bg-gradient-warning { background: var(--gradient-warning); }
.bg-gradient-danger { background: var(--gradient-danger); }

.text-gradient-primary { 
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   DASHBOARD HEADER STYLES
   ============================================ */
.dashboard-header {
    background: var(--gradient-primary);
    color: white;
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--border-radius-lg);
    margin-bottom: var(--spacing-lg);
    position: relative;
    overflow: hidden;
}

.dashboard-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.dashboard-header-content {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-lg);
}

.user-greeting {
    font-size: 1.1rem;
    font-weight: 600;
}

.term-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    font-size: 0.875rem;
}

.quick-actions-header {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

/* ============================================
   TOOLTIP ENHANCEMENTS
   ============================================ */
.tooltip-modern {
    position: relative;
    display: inline-block;
}

.tooltip-modern .tooltiptext {
    visibility: hidden;
    background-color: #374151;
    color: white;
    text-align: center;
    border-radius: 6px;
    padding: 6px 10px;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.75rem;
    white-space: nowrap;
}

.tooltip-modern:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* ============================================
   LOADING STATES
   ============================================ */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-md);
    z-index: 10;
}

.spinner-modern {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f4f6;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   EMPTY STATES
   ============================================ */
.empty-state {
    text-align: center;
    padding: var(--spacing-xl);
    color: #9ca3af;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
}

.empty-state-description {
    font-size: 0.875rem;
}

/* ============================================
   BADGE STYLES
   ============================================ */
.badge-modern {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
}

.badge-modern.primary {
    background: #dbeafe;
    color: #1e40af;
}

.badge-modern.success {
    background: #d1fae5;
    color: #065f46;
}

.badge-modern.warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-modern.danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-modern.info {
    background: #dbeafe;
    color: #1e40af;
}