:root {
  --primary-color: #4CAF50;
  --secondary-color: #2196F3;
  --light-bg: #f5f5f5;
  --border-color: #ddd;
  --workday-color: #e6f7ff;
  --holiday-color: #ffcccc;
  --leave-color: #ccffcc;
  --day-off-color: #ffebcc;
}

body {
  font-family: Arial, sans-serif;
  padding: 10px;
  background-color: var(--light-bg);
  margin: 0;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

header {
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
}

h1 {
  color: var(--primary-color);
  margin-bottom: 10px;
}

.app-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

@media (min-width: 768px) {
  .app-container {
    flex-direction: row;
  }

  .calendar-section, .planner-section {
    flex: 1;
  }
}

.section {
  background-color: white;
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.section-title {
  font-size: 1.2rem;
  margin-bottom: 15px;
  color: var(--primary-color);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

/* Calendar Styles */
table { 
  border-collapse: collapse; 
  width: 100%; 
}

th, td {
  border: 1px solid var(--border-color);
  padding: 8px;
  width: 14%;
  text-align: center;
  cursor: pointer;
}

th { 
  background-color: #f2f2f2; 
}

.unclickable {
  pointer-events: none;
  cursor: not-allowed; /* Visual feedback */
  opacity: 0.6;
}

.doy0, .doy1 { 
  background-color: lightyellow; 
}

.doy2 { 
  background-color: #aaffaa; 
}

.doy3 { 
  background-color: #aaaaff; 
}

.doy4 { 
  background-color: var(--leave-color); 
}

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

.year-btn {
  padding: 5px 10px; 
  margin: 0 5px; 
  cursor: pointer;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: white;
}

.year-btn.active {
  font-weight: bold;
  background-color: var(--primary-color);
  color: white;
}

.holiday-buttons {
  margin: 10px 0;
  text-align: center;
}

.holiday-btn {
  padding: 8px 15px;
  margin: 0 5px;
  cursor: pointer;
  background-color: #f0f0f0;
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

.holiday-btn:hover { 
  background-color: #e0e0e0; 
}

.holiday-result {
  margin: 10px 0;
  padding: 10px;
  background-color: #f9f9f9;
  color: #5555aa;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  text-align: center;
  min-height: 20px;
}

#selectedMonth {
  font-weight: bold;
  font-size: 24px;
  color: #55aaaa;
  margin: 15px 0;
  text-align: center;
}

.user-info {
  margin-bottom: 10px;
  padding: 10px;
  background-color: #f0f8ff;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  text-align: center;
  font-size: 14px;
  color: #555;
}

/* Planner Styles */
.planner-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  margin: 20px 0;
}

.day {
  border: 1px solid var(--border-color);
  padding: 8px;
  text-align: center;
  cursor: pointer;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.day.workday {
  background-color: var(--workday-color);
}

.day.day-off {
  background-color: var(--day-off-color);
}

.day.holiday {
  background-color: var(--holiday-color);
}

.day.leave {
  background-color: var(--leave-color);
}

.stats {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
  padding: 10px;
  background-color: #f9f9f9;
  border-radius: 4px;
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary-color);
}

.shift-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 15px 0;
}

#switch-shift {
  padding: 8px 15px;
  background-color: var(--secondary-color);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
}

#shift {
  font-weight: bold;
  color: var(--secondary-color);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 15px;
  justify-content: center;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend-color {
  width: 20px;
  height: 20px;
  border: 1px solid var(--border-color);
}

.tab-container {
  margin-bottom: 20px;
}

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
}

.tab {
  padding: 10px 20px;
  cursor: pointer;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  background-color: #f0f0f0;
}

.tab.active {
  background-color: white;
  border-color: var(--border-color);
  font-weight: bold;
}

.tab-content {
  display: none;
  padding: 15px 0;
}

.tab-content.active {
  display: block;
}

/* Combined Planner Styles */
.combined-planner {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.combined-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.month-navigation {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-btn {
  padding: 5px 10px;
  background-color: var(--secondary-color);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.combined-stats {
  display: flex;
  justify-content: space-around;
  margin: 15px 0;
}

.combined-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.combined-day {
  border: 1px solid var(--border-color);
  padding: 10px;
  text-align: center;
  cursor: pointer;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.day-number {
  font-weight: bold;
  margin-bottom: 5px;
}

.day-shift {
  font-size: 0.8rem;
  color: #666;
}

.combined-day.workday {
  background-color: var(--workday-color);
}

.combined-day.day-off {
  background-color: var(--day-off-color);
}

.combined-day.holiday {
  background-color: var(--holiday-color);
}

.combined-day.leave {
  background-color: var(--leave-color);
}

/* Optimization Controls */
.optimization-controls {
  margin: 15px 0;
  text-align: center;
}

.optimize-btn {
  padding: 10px 20px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  margin-bottom: 10px;
}

.optimize-btn:hover {
  background-color: #45a049;
}

.optimization-result {
  padding: 10px;
  border-radius: 4px;
  text-align: center;
  font-weight: bold;
  min-height: 20px;
}

.optimization-result.calculating {
  background-color: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}

.optimization-result.success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.optimization-result.error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}