:root {
  --bg-color: #0f172a;
  --text-color: #e2e8f0;
  --accent-color: #38bdf8;
  --card-bg: rgba(30, 41, 59, 0.7);
  --input-bg: rgba(51, 65, 85, 0.5);
  --border-color: rgba(148, 163, 184, 0.1);
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-color);
  background-image:
    radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.1) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.1) 0px, transparent 50%);
  color: var(--text-color);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.container {
  width: 100%;
  max-width: 1200px;
  /* Increased width */
  padding: 2rem;
}

.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 1.5rem;
  padding: 2.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.content-wrapper {
  display: flex;
  gap: 3rem;
  align-items: flex-start;
}

.left-panel {
  flex: 1;
  min-width: 300px;
}

.right-panel {
  flex: 2;
  min-width: 0;
  /* Flexbox overflow fix */
}

@media (max-width: 800px) {
  .content-wrapper {
    flex-direction: column;
  }

  .left-panel,
  .right-panel {
    width: 100%;
  }
}

h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 2rem;
  background: linear-gradient(to right, #38bdf8, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-align: center;
}

.form-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: #94a3b8;
}

input[type="number"],
input[type="date"] {
  width: 100%;
  padding: 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
  background: var(--input-bg);
  color: white;
  font-size: 1rem;
  transition: all 0.2s;
  box-sizing: border-box;
}

input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

button {
  width: 100%;
  padding: 1rem;
  border-radius: 0.75rem;
  border: none;
  background: linear-gradient(135deg, #38bdf8, #6366f1);
  color: white;
  font-weight: 600;
  font-size: 1.1rem;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.2s;
  margin-top: 1rem;
}

button:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

button:active {
  transform: translateY(1px);
}

.result-area {
  display: none;
  /* Removed top margin/border as it's side-by-side now */
}

.result-area.show {
  display: block;
  animation: fadeIn 0.5s ease-out;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  padding: 1.5rem;
  border-radius: 1rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
}

.result-date {
  font-size: 2.5rem;
  /* Slightly smaller for side panel */
  font-weight: 800;
  color: white;
  margin: 0.5rem 0;
}

.result-days {
  color: #94a3b8;
  font-size: 1.1rem;
}

.settinput {
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-color);
  color: white;
  padding: 0.8rem;
  border-radius: 0.5rem;
  font-size: 1rem;
}

.w-input {
  width: 50px !important;
  padding: 4px !important;
  text-align: center;
}

.weight-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.weight-group label {
  font-size: 0.8rem;
  color: #94a3b8;
}

.settings-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: #94a3b8;
  font-size: 0.9rem;
  padding: 0.75rem;
  margin-top: 2rem;
}

.settings-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.calc-trigger-btn {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  font-size: 0.85rem;
  padding: 0.4rem 0.8rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
  width: auto;
  margin: 0;
}

.calc-trigger-btn:hover {
  background: rgba(56, 189, 248, 0.2);
  transform: translateY(-1px);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  justify-content: center;
  align-items: center;
}

.modal.open {
  display: flex;
}

.modal-content {
  background: #1e293b;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  border-radius: 1rem;
  padding: 2rem;
  border: 1px solid var(--border-color);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.close-btn {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  margin: 0;
  width: auto;
}

.rule-group {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
  align-items: center;
}

.rule-group label {
  margin: 0;
  width: 60px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.holiday-list {
  margin-top: 1rem;
  max-height: 200px;
  overflow-y: auto;
}

.holiday-item {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  margin-bottom: 0.5rem;
  border-radius: 0.5rem;
}

/* Schedule Table */
.schedule-table-container {
  /* max-height removed to show full list */
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  margin-bottom: 0;
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  /* Slightly larger text */
}

.schedule-table th,
.schedule-table td {
  padding: 0.75rem 1rem;
  /* Compact padding */
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.schedule-table th {
  background: rgba(30, 41, 59, 0.9);
  position: sticky;
  top: 0;
  color: #38bdf8;
  backdrop-filter: blur(4px);
  z-index: 10;
}

.schedule-table tr:last-child td {
  border-bottom: none;
}

/* Month Overflow Highlight (Alarm Style) */
.row-month-overflow {
  background: rgba(251, 146, 60, 0.15) !important;
  /* Orange-ish */
  color: #fb923c;
  border-left: 3px solid #f97316;
}

.row-month-overflow td {
  color: #fb923c !important;
  font-weight: bold;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 100;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  transition: all 0.3s ease;
}

.modal-content {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.95));
  margin: 5% auto;
  padding: 2.5rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  width: 90%;
  max-width: 650px;
  border-radius: 1.5rem;
  animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.close-btn {
  color: #94a3b8;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s;
}

.close-btn:hover {
  color: #f87171;
}

.settings-section {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.settings-section h3 {
  font-size: 1.25rem;
  color: #38bdf8;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Rule List */
.rule-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.rule-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.8rem 1.2rem;
  border-radius: 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.rule-item label {
  font-weight: 500;
}

/* Checkbox Style */
.rule-item input[type="checkbox"] {
  width: 1.2rem;
  height: 1.2rem;
  accent-color: #f472b6;
  cursor: pointer;
}

/* Holiday Manager */
.add-holiday-form {
  display: flex;
  gap: 0.8rem;
  margin-bottom: 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 1rem;
  border-radius: 1rem;
}

.add-holiday-form input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  /* Fix invisible text */
  padding: 0.5rem;
  border-radius: 0.5rem;
}

.add-holiday-form button {
  width: auto;
  white-space: nowrap;
  background: #38bdf8;
  color: #0f172a;
  font-weight: bold;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  padding: 0 1.2rem;
}

.add-holiday-form button:hover {
  background: #7dd3fc;
}

.holiday-list {
  list-style: none;
  padding: 2px;
  /* Prevent outline clipping */
  padding-bottom: 2rem;
  /* Ensure last row is visible */
  max-height: 300px;
  /* Increased height */
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.holiday-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.5rem;
  transition: transform 0.2s, background 0.2s;
}

.holiday-item:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.08);
}

.holiday-info {
  font-size: 0.9rem;
  color: #e2e8f0;
}

.holiday-date {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-bottom: 0.2rem;
}

.delete-holiday-btn {
  align-self: flex-end;
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #f87171;
  font-size: 0.8rem;
  padding: 0.3rem 0.8rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}

.delete-holiday-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.empty-holidays {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem;
  color: #64748b;
  font-style: italic;
}

.row-holiday {
  background: rgba(220, 38, 38, 0.1);
  /* Red tint */
  color: #fca5a5;
}

/* Ensure text color is applied to inputs too if transparent */
.edit-hours {
  color: inherit;
}

.row-weekend {
  background: rgba(148, 163, 184, 0.1);
  /* Gray tint */
  color: #cbd5e1;
}

.row-custom {
  background: rgba(56, 189, 248, 0.1);
  /* Blue tint */
  color: #7dd3fc;
}

/* --- View Toggle (New) --- */
.view-toggle {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.toggle-btn {
  width: auto !important;
  /* Override global button */
  margin-top: 0 !important;
  /* Override global button */
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.2s;
}

.toggle-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  opacity: 1;
  transform: none;
}

.toggle-btn.active {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  font-weight: bold;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.3);
}

/* --- Calendar View --- */
.calendar-month-section {
  margin-bottom: 2rem;
  animation: fadeIn 0.5s ease-out;
}

.calendar-month-title {
  font-size: 1.1rem;
  color: #e2e8f0;
  margin-bottom: 1rem;
  padding-left: 8px;
  border-left: 3px solid #38bdf8;
  line-height: 1.2;
  font-weight: bold;
}

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

.cal-day-header {
  text-align: center;
  color: #64748b;
  font-size: 0.8rem;
  padding-bottom: 8px;
  font-weight: 600;
}

.calendar-cell {
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  min-height: 70px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s;
}

.calendar-cell:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-1px);
}

.calendar-cell.is-holiday {
  background: rgba(220, 38, 38, 0.1);
  border-color: rgba(239, 68, 68, 0.2);
}

.calendar-cell.is-weekend {
  background: rgba(15, 23, 42, 0.3);
  border: none;
}

.calendar-cell.is-overflow {
  background: rgba(251, 146, 60, 0.08);
  border-top: 2px solid rgba(251, 146, 60, 0.3);
}

.cal-date {
  font-size: 0.85rem;
  font-weight: 600;
  color: #94a3b8;
}

.cal-content {
  font-size: 0.8rem;
  text-align: right;
  margin-top: auto;
}

.cal-hours {
  color: #38bdf8;
  font-weight: 700;
}

.cal-note {
  font-size: 0.65rem;
  color: #94a3b8;
}

.cal-holiday-label {
  color: #fca5a5;
  font-size: 0.75rem;
}

/* Responsive */
@media (max-width: 600px) {
  .calendar-grid {
    gap: 4px;
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  .calendar-cell {
    min-height: 50px;
    padding: 4px;
  }

  .cal-date {
    font-size: 0.75rem;
  }

  .cal-hours {
    font-size: 0.7rem;
  }

  .nav-toggle-text {
    display: none;
  }

  /* If we had text */
}