/* styles.css */
html, body {
  height: 100%;
}

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

/* body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: #f5f5f5;
  height: 100vh;
  overflow: hidden;
} */

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: #f5f5f5;

  display: flex;
  flex-direction: column;
}
/* Layout */
/* .container {
  display: flex;
  height: 100vh;
} */

.container {
  display: flex;
  flex: 1;        /* fills available vertical space */
  min-height: 0; /* IMPORTANT for nested scrolling */
}

.sidebar {
  width: 250px;
  background: #2c3e50;
  color: white;
  padding: 20px;
  overflow-y: auto;
  transition: width 0.3s ease, margin-left 0.3s ease;
  position: relative;
}

.sidebar.collapsed {
  width: 70px;
  padding: 20px 10px;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 15px;
  border-bottom: 2px solid #34495e;
}

.sidebar h1 {
  font-size: 20px;
}

.sidebar.collapsed h1 {
  display: none;
}

.toggle-sidebar-btn {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  padding: 5px;
}

.nav-item {
  padding: 12px 15px;
  margin-bottom: 5px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

/* Icon always visible */
.nav-item .icon {
  font-size: 20px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

/* Label visibility control */
.nav-item .label {
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.sidebar.collapsed .nav-item {
  padding: 12px;
  justify-content: center;
}

.sidebar.collapsed .nav-item .label {
  opacity: 0;
  transform: translateX(-8px);
  pointer-events: none;
  display: none;
}


.sidebar.collapsed .btn-success .label {
  display: none;
}

.sidebar.collapsed .btn-success {
  justify-content: center;
}


.nav-item:hover {
  background: #34495e;
}

.nav-item.active {
  background: #3498db;
}

.sidebar-footer {
  margin-top: 30px;
  padding-top: 15px;
  border-top: 2px solid #34495e;
}

.btn-success {
  background: #27ae60;
  color: white;
  width: 100%;
}

.btn-success:hover {
  background: #229954;
}

.sidebar.collapsed .btn-success {
  padding: 10px 5px;
  font-size: 12px;
}

/* .main-content {
  flex: 1;
  padding: 30px;
  overflow-y: auto;
} */

.main-content {
  flex: 1;
  padding: 30px;
  overflow-y: auto;
  min-height: 0; /* VERY important */
}


/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  flex-wrap: wrap;
  gap: 15px;
}

.header h2 {
  font-size: 28px;
  color: #2c3e50;
}

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

/* Buttons */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: #3498db;
  color: white;
}

.btn-primary:hover {
  background: #2980b9;
}

.btn-secondary {
  background: #95a5a6;
  color: white;
}

.btn-secondary:hover {
  background: #7f8c8d;
}

.btn-danger {
  background: #e74c3c;
  color: white;
}

.btn-danger:hover {
  background: #c0392b;
}

/* Calendar Controls */
.calendar-controls {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
  align-items: center;
}

.calendar-controls select {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 14px;
}

/* Schedule Container */
.schedule-container {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  overflow-x: auto;
  margin-bottom: 20px;
}

.calendar-grid {
  display: grid;
  gap: 1px;
  min-width: max-content;
}

.calendar-header {
  display: grid;
  grid-auto-flow: column;
  gap: 1px;
  margin-bottom: 1px;
}

.date-cell {
  min-width: 35px;
  padding: 4px 2px;
  background: #34495e;
  color: white;
  text-align: center;
  border-radius: 3px;
  font-weight: 500;
  font-size: 11px;
}

.date-cell.weekend {
  background: #95a5a6;
}

.user-row {
  display: grid;
  grid-auto-flow: column;
  gap: 1px;
  margin-bottom: 1px;
}

.user-label {
  min-width: 100px;
  padding: 8px;
  background: #ecf0f1;
  font-weight: 500;
  display: flex;
  align-items: center;
  border-radius: 3px;
  font-size: 12px;
  cursor: pointer;
}

.user-label input {
  width: 100%;
  border: none;
  background: white;
  padding: 4px;
  border-radius: 3px;
  font-weight: 500;
}

.user-label input.hidden {
  display: none;
}

.day-cell {
  min-width: 35px;
  padding: 2px 1px;
  background: white;
  border: 1px solid #ecf0f1;
  border-radius: 3px;
  font-size: 10px;
}

.day-cell.weekend {
  background: #f8f9fa;
}

/* Shift Badges */
.shift-badge {
  padding: 2px 1px;
  margin: 1px 0;
  border-radius: 2px;
  font-size: 9px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  color: white;
}

.shift-badge:hover:not(.on-leave) {
  opacity: 0.8;
}

.shift-badge.on-leave {
  background: #bdc3c7 !important;
  color: #7f8c8d;
  cursor: not-allowed;
  opacity: 0.5;
}

/* Legend */
.legend {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

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

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 2px;
}

/* Fairness Summary */
.fairness-summary {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  margin-top: 20px;
}

.fairness-summary h3 {
  margin-bottom: 15px;
  color: #2c3e50;
}

#fairness-table {
  overflow-x: auto;
}

.fairness-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.fairness-table th {
  background: #34495e;
  color: white;
  padding: 10px;
  text-align: left;
  font-weight: 600;
}

.fairness-table td {
  padding: 10px;
  border-bottom: 1px solid #ecf0f1;
}

.fairness-table tr:hover {
  background: #f8f9fa;
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: white;
  padding: 30px;
  border-radius: 8px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-header h3 {
  font-size: 22px;
  color: #2c3e50;
}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #95a5a6;
  padding: 0;
  width: 30px;
  height: 30px;
}

.close-btn:hover {
  color: #7f8c8d;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #2c3e50;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 14px;
  font-family: inherit;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-item input[type="checkbox"] {
  width: auto;
  cursor: pointer;
}

/* Settings */
.settings-section {
  background: white;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.settings-section h3 {
  margin-bottom: 15px;
  color: #2c3e50;
}

.section-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

/* User List */
.user-list {
  list-style: none;
}

.user-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: #f8f9fa;
  margin-bottom: 8px;
  border-radius: 5px;
}

/* Shift Colors Grid */
.shift-colors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
}

.shift-color-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 5px;
}

.shift-color-preview {
  width: 40px;
  height: 40px;
  border-radius: 5px;
  border: 2px solid #ddd;
}

.shift-color-input {
  flex: 1;
}

.shift-color-input label {
  display: block;
  font-size: 13px;
  margin-bottom: 5px;
  color: #2c3e50;
}

.shift-color-input input {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 3px;
}

/* Pay Rates Grid */
.pay-rates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
}

.pay-rate-item {
  padding: 15px;
  background: #f8f9fa;
  border-radius: 5px;
}

.pay-rate-item label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #2c3e50;
  font-size: 14px;
}

.pay-rate-item input {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 3px;
}

/* Leave List */
.leave-list {
  max-height: 400px;
  overflow-y: auto;
}

.leave-item {
  padding: 15px;
  background: #f8f9fa;
  margin-bottom: 10px;
  border-radius: 5px;
  border-left: 4px solid #e74c3c;
}

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

.leave-item-header strong {
  color: #2c3e50;
}

.leave-shifts {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.leave-shift-tag {
  padding: 3px 8px;
  background: #e74c3c;
  color: white;
  border-radius: 3px;
  font-size: 11px;
}

/* User Selector */
.user-selector {
  max-height: 300px;
  overflow-y: auto;
}

.user-option {
  padding: 12px;
  cursor: pointer;
  border-radius: 5px;
  margin-bottom: 5px;
  background: #f8f9fa;
  transition: background 0.2s;
}

.user-option:hover:not(.disabled) {
  background: #e8f4f8;
}

.user-option.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #ecf0f1;
}

/* Utility Classes */
.hidden {
  display: none;
}

/* Footer */
.app-footer {
  background: #2c3e50;
  color: white;
  border-top: 1px solid #34495e;
  font-size: 13px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 12px 20px;
}

.footer-left {
  white-space: nowrap;
  opacity: 0.9;
}

.footer-right {
  text-align: right;
  font-style: italic;
  opacity: 0.85;
  transition: opacity 0.5s ease;
}

.footer-timer {
  margin-left: 8px;
  font-size: 11px;
  opacity: 0.6;
  font-style: normal;
}

.footer-right.fade-out {
  opacity: 0;
}
