/* ============================================
   eduSYMS Enhanced Dashboard Cards
   Improved Layout, Typography & Color System
   ============================================ */

:root {
  /* Enhanced Card Colors - Better Contrast & Readability */
  --card-bg-primary: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  --card-bg-success: linear-gradient(135deg, rgba(124, 200, 32, 0.05) 0%, rgba(148, 196, 60, 0.08) 100%);
  --card-bg-info: linear-gradient(135deg, rgba(52, 152, 219, 0.05) 0%, rgba(41, 128, 185, 0.08) 100%);
  --card-bg-warning: linear-gradient(135deg, rgba(243, 156, 18, 0.05) 0%, rgba(241, 196, 15, 0.08) 100%);
  --card-bg-danger: linear-gradient(135deg, rgba(231, 76, 60, 0.05) 0%, rgba(192, 57, 43, 0.08) 100%);
  
  /* Text Colors - Enhanced Readability */
  --card-title-color: #2c3e50;
  --card-subtitle-color: #7f8c8d;
  --card-value-color: #1a252f;
  --card-meta-color: #95a5a6;
  
  /* Icon Colors with Personality */
  --icon-success: #27ae60;
  --icon-info: #3498db;
  --icon-warning: #f39c12;
  --icon-danger: #e74c3c;
  --icon-primary: #7cc820;
  
  /* Border & Shadow System */
  --card-border: 1px solid rgba(0, 0, 0, 0.06);
  --card-border-hover: 1px solid rgba(124, 200, 32, 0.3);
  --card-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  --card-shadow-hover: 0 8px 24px rgba(124, 200, 32, 0.12);
  
  /* Spacing System */
  --card-padding: 1.5rem;
  --card-padding-sm: 1rem;
  --card-gap: 1rem;
}

/* ============================================
   Enhanced Stat Card Base
   ============================================ */

.glass-stat-card {
  background: var(--card-bg-primary);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: var(--card-border);
  border-radius: 16px;
  padding: var(--card-padding);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  min-height: 140px;
  display: flex;
  align-items: center;
}

/* Remove problematic pseudo-elements that can cause layout issues */
.glass-stat-card::before {
  display: none;
}

.glass-stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow-hover);
  border: var(--card-border-hover);
}

/* ============================================
   Typography Improvements - NO MORE CUT TITLES!
   ============================================ */

.glass-stat-card .card-title,
.glass-stat-card h5 {
  color: var(--card-subtitle-color);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.75rem;
  line-height: 1.4;
  /* CRITICAL: Prevent title cutoff */
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  word-wrap: break-word;
  max-width: 100%;
}

.glass-stat-card .stat-value,
.glass-stat-card .h2 {
  color: var(--card-value-color);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.25rem;
  /* Ensure value doesn't wrap unnecessarily */
  display: block;
  word-break: break-word;
}

.glass-stat-card small {
  color: var(--card-meta-color);
  font-size: 0.75rem;
  font-weight: 500;
  display: block;
  margin-top: 0.25rem;
}

/* ============================================
   Enhanced Icon System - Better Visual Balance
   ============================================ */

.glass-stat-icon {
  background: linear-gradient(135deg, rgba(124, 200, 32, 0.1) 0%, rgba(148, 196, 60, 0.15) 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(124, 200, 32, 0.2);
  border-radius: 14px;
  width: 3.5rem;
  height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--icon-primary);
  font-size: 1.5rem;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.glass-stat-card:hover .glass-stat-icon {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 4px 12px rgba(124, 200, 32, 0.2);
}

/* Icon Color Variants - Better Visual Hierarchy */
.glass-stat-card:nth-child(1) .glass-stat-icon {
  background: linear-gradient(135deg, rgba(124, 200, 32, 0.12) 0%, rgba(148, 196, 60, 0.18) 100%);
  color: var(--icon-success);
  border-color: rgba(124, 200, 32, 0.25);
}

.glass-stat-card:nth-child(2) .glass-stat-icon {
  background: linear-gradient(135deg, rgba(52, 152, 219, 0.12) 0%, rgba(41, 128, 185, 0.18) 100%);
  color: var(--icon-info);
  border-color: rgba(52, 152, 219, 0.25);
}

.glass-stat-card:nth-child(3) .glass-stat-icon {
  background: linear-gradient(135deg, rgba(243, 156, 18, 0.12) 0%, rgba(241, 196, 15, 0.18) 100%);
  color: var(--icon-warning);
  border-color: rgba(243, 156, 18, 0.25);
}

.glass-stat-card:nth-child(4) .glass-stat-icon {
  background: linear-gradient(135deg, rgba(155, 89, 182, 0.12) 0%, rgba(142, 68, 173, 0.18) 100%);
  color: #8e44ad;
  border-color: rgba(155, 89, 182, 0.25);
}

/* ============================================
   Card Body Layout Fix - Proper Alignment
   ============================================ */

.glass-stat-card .card-body {
  padding: 0;
  width: 100%;
}

.glass-stat-card .row {
  align-items: center;
  margin: 0;
  width: 100%;
}

.glass-stat-card .col {
  padding-right: 1rem;
  flex: 1;
  min-width: 0; /* CRITICAL: Allows text to shrink properly */
}

.glass-stat-card .col-auto {
  padding-left: 0;
  flex-shrink: 0;
}

/* ============================================
   Animation Variants with Better Performance
   ============================================ */

.glass-float-ultra {
  animation: cardFloat 6s ease-in-out infinite;
}

.glass-pulse-ultra {
  animation: cardPulse 4s ease-in-out infinite;
}

.glass-glow-ultra {
  animation: cardGlow 5s ease-in-out infinite;
}

.glass-shimmer {
  position: relative;
  overflow: hidden;
}

.glass-shimmer::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 100%
  );
  animation: shimmer 3s infinite;
}

@keyframes cardFloat {
  0%, 100% { 
    transform: translateY(0px);
  }
  50% { 
    transform: translateY(-6px);
  }
}

@keyframes cardPulse {
  0%, 100% { 
    box-shadow: var(--card-shadow);
  }
  50% { 
    box-shadow: var(--card-shadow-hover);
  }
}

@keyframes cardGlow {
  0%, 100% { 
    filter: brightness(1);
  }
  50% { 
    filter: brightness(1.05);
  }
}

@keyframes shimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* ============================================
   Legacy Card Support - For Old Card Styles
   ============================================ */

.card-stats {
  background: var(--card-bg-primary);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: var(--card-border);
  border-radius: 16px;
  transition: all 0.3s ease;
  box-shadow: var(--card-shadow);
}

.card-stats:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow-hover);
}

.card-stats .card-title {
  color: var(--card-subtitle-color);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.75rem;
  line-height: 1.4;
  white-space: normal;
  word-wrap: break-word;
}

.card-stats .h2 {
  color: var(--card-value-color);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
}

/* ============================================
   Icon Shape Improvements
   ============================================ */

.icon-shape {
  width: 3.5rem;
  height: 3.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  font-size: 1.5rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.icon-shape::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
  border-radius: 14px;
}

.icon-shape i {
  position: relative;
  z-index: 1;
}

/* Enhanced Color Variants */
.bg-yellow {
  background: linear-gradient(135deg, #f39c12 0%, #f1c40f 100%);
  box-shadow: 0 4px 12px rgba(243, 156, 18, 0.2);
}

.bg-danger {
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.2);
}

.bg-warning {
  background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
  box-shadow: 0 4px 12px rgba(243, 156, 18, 0.2);
}

.bg-info {
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.2);
}

.bg-success {
  background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
  box-shadow: 0 4px 12px rgba(39, 174, 96, 0.2);
}

.bg-primary {
  background: linear-gradient(135deg, #7cc820 0%, #94c43c 100%);
  box-shadow: 0 4px 12px rgba(124, 200, 32, 0.2);
}

/* ============================================
   Chart Card Enhancements
   ============================================ */

.glass-card-ultra,
.glass-card-premium {
  background: var(--card-bg-primary);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: var(--card-border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: all 0.3s ease;
}

.glass-card-ultra:hover,
.glass-card-premium:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-2px);
}

.glass-section-header-ultra {
  background: linear-gradient(135deg, rgba(124, 200, 32, 0.95) 0%, rgba(94, 164, 26, 0.95) 100%);
  padding: 1.5rem;
  border-bottom: none;
}

.glass-section-header-ultra h6 {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.25rem;
}

.glass-section-header-ultra h2 {
  color: #ffffff;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0;
}

/* ============================================
   Responsive Design - Mobile Optimization
   ============================================ */

@media (max-width: 1199px) {
  .glass-stat-card {
    min-height: 130px;
    padding: 1.25rem;
  }
  
  .glass-stat-card .stat-value,
  .glass-stat-card .h2 {
    font-size: 1.75rem;
  }
  
  .glass-stat-icon {
    width: 3rem;
    height: 3rem;
    font-size: 1.25rem;
  }
}

@media (max-width: 991px) {
  .glass-stat-card {
    margin-bottom: 1.5rem !important;
  }
  
  .glass-stat-card .card-title,
  .glass-stat-card h5 {
    font-size: 0.7rem;
  }
}

@media (max-width: 767px) {
  .glass-stat-card {
    min-height: 120px;
    padding: 1rem;
  }
  
  .glass-stat-card .stat-value,
  .glass-stat-card .h2 {
    font-size: 1.5rem;
  }
  
  .glass-stat-icon {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1rem;
  }
  
  .glass-stat-card .col {
    padding-right: 0.75rem;
  }
}

@media (max-width: 575px) {
  .glass-stat-card {
    min-height: 110px;
  }
  
  .glass-stat-card .card-title,
  .glass-stat-card h5 {
    font-size: 0.65rem;
    letter-spacing: 0.3px;
  }
  
  .glass-stat-card .stat-value,
  .glass-stat-card .h2 {
    font-size: 1.25rem;
  }
}

/* ============================================
   Glass Card Variant Backgrounds
   ============================================ */

.glass-card:not(.glass-card-ultra):not(.glass-card-premium) {
  background: var(--card-bg-primary);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: var(--card-border);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
}

/* ============================================
   Print Styles - Ensure cards look good printed
   ============================================ */

@media print {
  .glass-stat-card,
  .card-stats {
    box-shadow: none;
    border: 1px solid #ddd;
    page-break-inside: avoid;
  }
  
  .glass-stat-card::after,
  .glass-shimmer::after {
    display: none;
  }
}

/* ============================================
   Accessibility Improvements
   ============================================ */

.glass-stat-card:focus-within {
  outline: 2px solid var(--icon-primary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .glass-stat-card,
  .glass-stat-icon,
  .card-stats {
    animation: none;
    transition: none;
  }
  
  .glass-float-ultra,
  .glass-pulse-ultra,
  .glass-glow-ultra,
  .glass-shimmer::after {
    animation: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .glass-stat-card,
  .card-stats {
    border: 2px solid currentColor;
  }
  
  .glass-stat-card .card-title,
  .glass-stat-card h5 {
    color: #000;
  }
  
  .glass-stat-card .stat-value,
  .glass-stat-card .h2 {
    color: #000;
  }
}
