* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
  padding: 20px 0;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
.header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 30px;
  margin-bottom: 25px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

.header h1 {
  font-size: 32px;
  font-weight: 700;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-actions {
  display: flex;
  gap: 12px;
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-success {
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  color: white;
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(56, 239, 125, 0.4);
}

/* Filters */
.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 18px;
}

.filter-item label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin-bottom: 8px;
}

.filter-item input[type="date"],
.filter-item select {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #e8e8e8;
  border-radius: 10px;
  font-size: 14px;
  background: white;
  transition: all 0.3s ease;
}

.filter-item input[type="date"]:focus,
.filter-item select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filter-item input[type="checkbox"] {
  margin-right: 8px;
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #667eea;
}

/* Color Palette Legend */
.color-palette {
  margin-top: 25px;
  padding-top: 25px;
  border-top: 2px solid #e8e8e8;
}

.palette-header {
  margin-bottom: 15px;
}

.palette-title {
  font-size: 14px;
  font-weight: 700;
  color: #667eea;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

.palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: rgba(102, 126, 234, 0.05);
  border-radius: 10px;
  transition: all 0.3s ease;
  cursor: pointer;
  border: 2px solid transparent;
}

.palette-item:hover {
  background: rgba(102, 126, 234, 0.1);
  border-color: #667eea;
  transform: translateY(-2px);
}

.palette-item.palette-selected {
  background: rgba(102, 126, 234, 0.15);
  border-color: #667eea;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.palette-color {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.palette-label {
  font-size: 12px;
  font-weight: 600;
  color: #555;
  white-space: nowrap;
}

/* Statistics */
.statistics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 25px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 25px;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.stat-label {
  font-size: 13px;
  font-weight: 600;
  color: #666;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 36px;
  font-weight: 800;
  color: #1a1a1a;
  line-height: 1;
}

.stat-occupied::before {
  background: linear-gradient(90deg, #ff6b6b 0%, #ee5a6f 100%);
}

.stat-occupied .stat-value {
  color: #ff6b6b;
}

.stat-available::before {
  background: linear-gradient(90deg, #11998e 0%, #38ef7d 100%);
}

.stat-available .stat-value {
  color: #11998e;
}

.stat-rate::before {
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

.stat-rate .stat-value {
  color: #667eea;
}

/* Gantt Chart */
.gantt-container {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  overflow: hidden;
}

.gantt-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 70vh;
  position: relative;
  
}

.gantt-wrapper::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}

.gantt-wrapper::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.gantt-wrapper::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 10px;
}

.gantt-wrapper::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.gantt-header {
  display: flex;
  border: 1px solid #0f0f0f;
  background: linear-gradient(135deg, #f8f9ff 0%, #f5f3ff 100%);
  position: sticky;
  top: 0;
  z-index: 100;
}

.gantt-room-header {
  width: 220px;
  padding: 20px;
  font-weight: 700;
  font-size: 14px;
  color: #667eea;
  border-right: 2px solid #e8e8e8;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #f8f9ff 0%, #f5f3ff 100%);
  position: sticky;
  left: 0;
  z-index: 101;
}

.gantt-timeline-header {
  flex: 1;
  display: flex;
  min-width: 1000px;
  
}

.gantt-hour {
  flex: 1;
  padding: 20px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  border-left: 1px solid #070707;
  color: #667eea;
}

.gantt-row {
  display: flex;
  
  transition: all 0.3s ease;
}

.gantt-row:hover {
  background: linear-gradient(90deg, rgba(102, 126, 234, 0.03) 0%, rgba(118, 75, 162, 0.03) 100%);
}

.gantt-room-info {
  width: 220px;
  padding: 20px;
  border: 0.5px solid #b5a7a7;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.95);
  position: sticky;
  left: 0;
  z-index: 10;
}

.gantt-room-name {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 6px;
  color: #1a1a1a;
}

.gantt-room-detail {
  font-size: 12px;
  color: #666;
  margin-bottom: 2px;
}

.gantt-timeline {
  flex: 1;
  position: relative;
  height: 110px;
  min-width: 1000px;
}

.gantt-grid {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100%;
  display: flex;
}

.gantt-grid-line {
  flex: 1;
 border: 0.5px solid #b5a7a7;
}

.gantt-schedule {
  position: absolute;
  top: 10px;
  bottom: 10px;
  /* Background color set dynamically via inline style based on school_id */
  color: white;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 11px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.gantt-schedule:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35);
  z-index: 10;
  border-color: rgba(255, 255, 255, 0.5);
}

.schedule-title {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.schedule-info {
  font-size: 10px;
  opacity: 0.95;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.schedule-time {
  font-size: 10px;
  opacity: 0.95;
  font-weight: 700;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: rgba(255, 255, 255, 0.2);
  padding: 3px 6px;
  border-radius: 4px;
  display: inline-block;
}

.gantt-available {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #11998e;
  font-weight: 700;
  font-size: 14px;
}

/* Loading */
.loading {
  text-align: center;
  padding: 80px;
}

.spinner {
  border: 5px solid rgba(255, 255, 255, 0.3);
  border-top: 5px solid #667eea;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

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

.loading p {
  color: white;
  font-weight: 600;
  font-size: 16px;
}

/* No Data */
.no-data {
  text-align: center;
  padding: 100px;
  color: #999;
}

.no-data-icon {
  font-size: 80px;
  margin-bottom: 20px;
  opacity: 0.5;
}

.no-data p {
  font-size: 16px;
  font-weight: 600;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stat-card,
.header,
.gantt-container {
  animation: fadeIn 0.5s ease;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

/* Responsive */
@media (max-width: 1024px) {
  .statistics {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 10px 0;
  }

  .container {
    padding: 10px;
  }

  .header {
    padding: 20px;
    border-radius: 15px;
  }

  .header h1 {
    font-size: 24px;
  }

  .header-content {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
  }

  .header-actions {
    flex-direction: column;
  }

  .btn {
    justify-content: center;
  }

  .statistics {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .filters {
    grid-template-columns: 1fr;
  }
  
  .palette-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .gantt-wrapper {
    max-height: 100vh;
    border: 1px solid rgb(8, 8, 8);
  }
  
  .gantt-room-header,
  .gantt-room-info {
    width: 150px;
    padding: 15px;
  }

  .gantt-timeline {
    height: 120px;
  }

  .stat-value {
    font-size: 32px;
  }
}

@media (max-width: 480px) {
  .header h1 {
    font-size: 20px;
  }

  .stat-value {
    font-size: 28px;
  }

  .gantt-room-header,
  .gantt-room-info {
    width: 120px;
    padding: 12px;
  }
  
  .gantt-room-name {
    font-size: 13px;
  }
  
  .gantt-room-detail {
    font-size: 11px;
  }
}