/* mr_style.css - Math Remedial Dashboard Styles */
:root {
  --mr-bg: #f8f9fa;
  --mr-card: #ffffff;
  --mr-text-main: #2d3748;
  --mr-text-light: #718096;
  --mr-border: #e2e8f0;
  --mr-crimson: #e03050;
  --mr-crimson-light: #fff0f2;
  --mr-green: #38a169;
  --mr-yellow: #d69e2e;
  --mr-red: #e53e3e;
}

body {
  background-color: var(--mr-bg);
  color: var(--mr-text-main);
  font-family: 'Sarabun', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  padding: 0;
}

/* Layout */
.mr-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.mr-sidebar {
  width: 250px;
  background-color: var(--mr-card);
  border-right: 1px solid var(--mr-border);
  display: flex;
  flex-direction: column;
}
.mr-sidebar-logo {
  padding: 2rem;
  text-align: center;
  border-bottom: 1px solid var(--mr-border);
}
.mr-sidebar-logo img {
  width: 60px;
  margin-bottom: 1rem;
}
.mr-sidebar-logo h3 {
  margin: 0;
  color: var(--mr-crimson);
  font-size: 1.1rem;
}
.mr-menu {
  list-style: none;
  padding: 1rem 0;
  margin: 0;
}
.mr-menu li a {
  display: flex;
  align-items: center;
  padding: 1rem 2rem;
  color: var(--mr-text-light);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s;
  border-left: 4px solid transparent;
}
.mr-menu li a:hover, .mr-menu li a.active {
  background-color: var(--mr-crimson-light);
  color: var(--mr-crimson);
  border-left-color: var(--mr-crimson);
}
.mr-menu-icon { margin-right: 12px; font-size: 1.2rem; }

/* Main Content */
.mr-main {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

/* Hero Banner WOW */
.mr-hero {
  position: relative;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-radius: 24px;
  padding: 3rem 4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.2);
  margin-bottom: 3rem;
  overflow: hidden;
  color: white;
}
.mr-hero::before {
  content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
  background: radial-gradient(circle, rgba(225, 29, 72, 0.15) 0%, transparent 60%);
  animation: rotateBlob 15s linear infinite;
  pointer-events: none;
}
.mr-hero h1 {
  margin: 0 0 0.5rem 0;
  background: linear-gradient(135deg, #f87171 0%, #f43f5e 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 2.2rem;
  font-weight: 800;
  position: relative; z-index: 2;
}
.mr-hero p { margin: 0; color: #cbd5e1; font-size: 1.1rem; position: relative; z-index: 2; }
.mr-hero-icon { font-size: 5rem; opacity: 0.9; position: relative; z-index: 2; animation: floatIcon 6s ease-in-out infinite alternate; }
@keyframes floatIcon {
  0% { transform: translateY(0) rotate(0deg); }
  100% { transform: translateY(-15px) rotate(10deg); }
}

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

/* Dashboard Responsive Grid */
.mr-dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}
@media (min-width: 900px) {
  .mr-dashboard-grid { grid-template-columns: 1fr 2fr; }
}

.mr-card {
  background: var(--mr-card);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.04);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border: 1px solid rgba(0,0,0,0.03);
  position: relative;
  overflow: hidden;
}
.mr-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(225, 29, 72, 0.08);
}
.mr-card-info h4 { margin: 0 0 0.8rem 0; color: var(--mr-text-light); font-weight: 600; font-size: 1.1rem; }
.mr-card-info .mr-value { margin: 0; font-size: 2.2rem; font-weight: 800; color: var(--mr-text-main); }
.mr-card-icon {
  width: 60px; height: 60px; border-radius: 20px;
  display: flex; justify-content: center; align-items: center; font-size: 2rem;
  box-shadow: inset 0 4px 6px rgba(255,255,255,0.5), 0 8px 15px rgba(0,0,0,0.05);
  transition: transform 0.4s;
}
.mr-card:hover .mr-card-icon {
  transform: scale(1.1) rotate(5deg);
}
.icon-m1 { background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%); color: #0284c7; }
.icon-m2 { background: linear-gradient(135deg, #f3e8ff 0%, #d8b4fe 100%); color: #9333ea; }
.icon-m3 { background: linear-gradient(135deg, #d1fae5 0%, #6ee7b7 100%); color: #059669; }

/* Charts & Tables Container WOW */
.mr-panel {
  background: var(--mr-card);
  border-radius: 24px;
  padding: 2rem;
  box-shadow: 0 15px 35px rgba(0,0,0,0.03);
  margin-bottom: 2rem;
  border: 1px solid rgba(0,0,0,0.02);
  transition: transform 0.3s ease;
}
.mr-panel:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 45px rgba(0,0,0,0.06);
}
.mr-panel-header {
  border-bottom: 1px solid var(--mr-border);
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.mr-panel-header h3 { margin: 0; font-size: 1.2rem; }

/* Data Table WOW */
.mr-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.mr-table th {
  background-color: #f1f5f9;
  padding: 1.2rem 1rem;
  text-align: left;
  font-weight: 700;
  font-size: 0.85rem;
  color: #475569;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}
.mr-table th:first-child { border-top-left-radius: 12px; }
.mr-table th:last-child { border-top-right-radius: 12px; }

.mr-table td {
  padding: 1.2rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  font-size: 0.95rem;
  color: #334155;
  transition: background-color 0.2s;
}
.mr-table tbody tr:hover td { background-color: #f8fafc; }
.mr-table tbody tr:last-child td { border-bottom: none; }

.status-badge {
  padding: 4px 8px; border-radius: 12px; font-size: 0.8rem; font-weight: bold;
}
.status-active { background: #def7ec; color: #03543f; }
.status-inactive { background: #fde8e8; color: #9b1c1c; }

/* Inputs WOW */
.score-input {
  width: 65px;
  padding: 0.5rem;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  background: #f8fafc;
  transition: all 0.3s ease;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}
.score-input:focus {
  outline: none;
  border-color: var(--mr-crimson);
  background: white;
  box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.15);
}
.score-input:disabled {
  opacity: 0.5;
  background: #f1f5f9;
  cursor: not-allowed;
}

.btn {
  padding: 0.6rem 1.2rem;
  border-radius: 50px;
  border: none;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px;
}
.btn-primary { background: linear-gradient(135deg, var(--mr-crimson), #f43f5e); color: white; box-shadow: 0 4px 15px rgba(225,29,72,0.2); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(225,29,72,0.3); }
.btn-outline { background: white; border: 2px solid #e2e8f0; color: #475569; }
.btn-outline:hover { border-color: var(--mr-crimson); color: var(--mr-crimson); background: #fff0f2; transform: translateY(-2px); }

/* Alert List WOW */
.alert-list { list-style: none; padding: 0; margin: 0; }
.alert-list li {
  padding: 1rem 1.2rem; background: #fff;
  margin-bottom: 0.8rem; border-radius: 12px;
  display: flex; justify-content: space-between; align-items: center;
  border: 1px solid rgba(229, 62, 62, 0.1);
  box-shadow: 0 4px 10px rgba(229, 62, 62, 0.05);
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
}
.alert-list li:hover {
  transform: translateX(5px);
  border-color: rgba(229, 62, 62, 0.3);
  box-shadow: 0 8px 15px rgba(229, 62, 62, 0.1);
}
.alert-list li::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--mr-red);
}

.pulse-dot {
  display: inline-block;
  width: 10px; height: 10px;
  background: var(--mr-red);
  border-radius: 50%;
  margin-right: 8px;
  box-shadow: 0 0 0 0 rgba(229, 62, 62, 0.7);
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(229, 62, 62, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(229, 62, 62, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(229, 62, 62, 0); }
}

/* =====================================================
   INTERACTIVE DASHBOARD v2 — Classroom Comparison
   ===================================================== */

/* Section wrapper */
.db-section {
  margin-bottom: 2.5rem;
}
.db-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.db-section-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--mr-text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Filter / Dropdown controls */
.db-filter {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.db-filter-btn {
  padding: 0.5rem 1.2rem;
  border-radius: 50px;
  border: 2px solid #e2e8f0;
  background: white;
  font-size: 0.85rem;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}
.db-filter-btn:hover {
  border-color: var(--mr-crimson);
  color: var(--mr-crimson);
  background: #fff0f2;
}
.db-filter-btn.active {
  background: linear-gradient(135deg, var(--mr-crimson), #f43f5e);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.25);
}

/* Chart container */
.db-chart-wrap {
  background: var(--mr-card);
  border-radius: 24px;
  padding: 2rem;
  box-shadow: 0 15px 35px rgba(0,0,0,0.03);
  border: 1px solid rgba(0,0,0,0.02);
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.db-chart-wrap:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 45px rgba(0,0,0,0.06);
}
.db-chart-inner {
  position: relative;
  height: 350px;
  width: 100%;
}

/* Classroom cards grid */
.db-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
.db-room-card {
  background: var(--mr-card);
  border-radius: 20px;
  padding: 1.5rem 1.2rem;
  text-align: center;
  box-shadow: 0 8px 25px rgba(0,0,0,0.04);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
}
.db-room-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  border-radius: 20px 20px 0 0;
  transition: height 0.3s ease;
}
.db-room-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 15px 35px rgba(0,0,0,0.08);
}
.db-room-card:hover::before {
  height: 6px;
}
.db-room-card .room-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  display: block;
  filter: drop-shadow(0 3px 5px rgba(0,0,0,0.1));
}
.db-room-card .room-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--mr-text-light);
  margin-bottom: 0.3rem;
}
.db-room-card .room-avg {
  font-size: 2rem;
  font-weight: 900;
  line-height: 1.2;
}
.db-room-card .room-count {
  font-size: 0.75rem;
  color: var(--mr-text-light);
  margin-top: 0.3rem;
}
.db-room-card .room-nodata {
  font-size: 0.85rem;
  color: #cbd5e1;
  font-weight: 600;
}

/* Card color levels */
.db-room-card.level-green { border-color: #dcfce7; }
.db-room-card.level-green::before { background: linear-gradient(90deg, #22c55e, #4ade80); }
.db-room-card.level-green .room-avg { color: #16a34a; }

.db-room-card.level-yellow { border-color: #fef9c3; }
.db-room-card.level-yellow::before { background: linear-gradient(90deg, #eab308, #facc15); }
.db-room-card.level-yellow .room-avg { color: #ca8a04; }

.db-room-card.level-red { border-color: #fee2e2; }
.db-room-card.level-red::before { background: linear-gradient(90deg, #ef4444, #f87171); }
.db-room-card.level-red .room-avg { color: #dc2626; }

.db-room-card.level-none { border-color: #f1f5f9; }
.db-room-card.level-none::before { background: #e2e8f0; }

/* Summary table */
.db-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.04);
}
.db-summary-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: white;
  min-width: 700px;
}
.db-summary-table thead th {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  padding: 1rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
  text-align: center;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}
.db-summary-table thead th:first-child {
  text-align: left;
  padding-left: 1.5rem;
  position: sticky;
  left: 0;
  z-index: 3;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}
.db-summary-table tbody td {
  padding: 0.9rem 0.8rem;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 700;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.2s;
}
.db-summary-table tbody td:first-child {
  text-align: left;
  padding-left: 1.5rem;
  font-weight: 800;
  color: var(--mr-text-main);
  white-space: nowrap;
  position: sticky;
  left: 0;
  background: white;
  z-index: 1;
}
.db-summary-table tbody tr:hover td {
  background: #f8fafc;
}
.db-summary-table tbody tr:hover td:first-child {
  background: #f0f4f8;
}
.db-summary-table .cell-green { color: #16a34a; background: #f0fdf4; }
.db-summary-table .cell-yellow { color: #ca8a04; background: #fefce8; }
.db-summary-table .cell-red { color: #dc2626; background: #fef2f2; }
.db-summary-table .cell-nodata { color: #cbd5e1; font-weight: 500; }

/* Donut section grid */
.db-donut-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 2rem;
}

/* Legend pills */
.db-legend {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}
.db-legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--mr-text-light);
}
.db-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

/* Fade in animation */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.db-animate {
  animation: fadeInUp 0.6s ease-out forwards;
  opacity: 0;
}
.db-animate-delay-1 { animation-delay: 0.1s; }
.db-animate-delay-2 { animation-delay: 0.2s; }
.db-animate-delay-3 { animation-delay: 0.3s; }
.db-animate-delay-4 { animation-delay: 0.4s; }

@keyframes rotateBlob {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* =====================================================
   RESPONSIVE — Mobile & Tablet
   ===================================================== */
@media (max-width: 1024px) {
  .db-cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .db-donut-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .mr-hero {
    padding: 2rem 1.5rem;
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }
  .mr-hero h1 {
    font-size: 1.5rem;
  }
  .mr-hero p {
    font-size: 0.95rem;
  }
  .mr-hero-icon {
    font-size: 3rem;
  }
  .mr-grid-3 {
    grid-template-columns: 1fr;
  }
  .db-cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
  }
  .db-room-card {
    padding: 1.2rem 0.8rem;
  }
  .db-room-card .room-avg {
    font-size: 1.6rem;
  }
  .db-room-card .room-icon {
    font-size: 1.5rem;
  }
  .db-chart-wrap {
    padding: 1.2rem;
  }
  .db-chart-inner {
    height: 280px;
  }
  .db-section-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .db-donut-grid {
    grid-template-columns: 1fr;
  }
  .mr-main {
    padding: 1rem;
  }
  .mr-card {
    padding: 1.2rem;
  }
  .mr-card-info h4 {
    font-size: 0.9rem;
  }
  .mr-card-info .mr-value {
    font-size: 1.6rem;
  }
}

@media (max-width: 480px) {
  .db-cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
  }
  .db-room-card {
    padding: 1rem 0.6rem;
    border-radius: 14px;
  }
  .db-room-card .room-avg {
    font-size: 1.4rem;
  }
  .db-room-card .room-icon {
    font-size: 1.3rem;
    margin-bottom: 0.3rem;
  }
  .db-room-card .room-name {
    font-size: 0.8rem;
  }
  .db-filter-btn {
    padding: 0.4rem 0.9rem;
    font-size: 0.78rem;
  }
  .db-section-title {
    font-size: 1.1rem;
  }
  .db-chart-inner {
    height: 240px;
  }
  .mr-hero {
    padding: 1.5rem 1rem;
    border-radius: 16px;
    margin-bottom: 2rem;
  }
  .mr-hero h1 {
    font-size: 1.25rem;
  }
}
