html {
  overflow-x: hidden;
}

* {
  box-sizing: border-box;
}

body { 
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; 
  margin: 0; 
  color: #1f2937; 
  background-color: #f9fafb;
  line-height: 1.5;
  overflow-x: hidden;
}

header { 
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%); 
  color: white; 
  padding: 16px 20px; 
  display: flex; 
  align-items: center; 
  justify-content: space-between;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

header h1 { 
  margin: 0; 
  font-size: 24px; 
  font-weight: 600;
}

.system-status {
  font-size: 14px;
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  font-weight: 500;
  min-width: 120px;
  text-align: center;
}

.system-status.loading {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.8);
}

.system-status.success {
  background: rgba(16,185,129,0.2);
  border-color: rgba(16,185,129,0.3);
  color: #ffffff;
}

.system-status.error {
  background: rgba(239,68,68,0.2);
  border-color: rgba(239,68,68,0.3);
  color: #ffffff;
}

nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Hamburger toggle */
.nav-toggle {
  display: none;
  background: rgba(255,255,255,0.2);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 18px;
  cursor: pointer;
}

nav button { 
  padding: 8px 16px; 
  border: none; 
  background: rgba(255,255,255,0.2); 
  color: white; 
  border-radius: 6px; 
  cursor: pointer; 
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1px solid rgba(255,255,255,0.3);
}

nav button:hover {
  background: rgba(255,255,255,0.3);
  transform: translateY(-1px);
}

nav button.active {
  background: white;
  color: #0ea5e9;
}

main { 
  padding: 24px; 
  max-width: 1200px;
  margin: 0 auto;
}

section { 
  border: 1px solid #e5e7eb; 
  border-radius: 12px; 
  padding: 24px; 
  background: white;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

section h2 {
  margin-top: 0;
  margin-bottom: 20px;
  color: #1f2937;
  font-size: 20px;
  font-weight: 600;
}

.form-container {
  background: #f8fafc;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  margin-bottom: 20px;
}

.filter-container {
  background: #f0f9ff;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #bae6fd;
  margin-bottom: 20px;
}

.filter-container h3 {
  margin-top: 0;
  margin-bottom: 16px;
  color: #0369a1;
  font-size: 16px;
  font-weight: 600;
}

.filter-controls {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.employee-filter {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 250px;
}

.employee-filter label {
  font-weight: 500;
  color: #374151;
  font-size: 14px;
}

.employee-filter select {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 8px;
  font-size: 14px;
  background: white;
  min-height: 100px;
}

.employee-filter select:focus {
  outline: none;
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.filter-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-weight: 500;
  color: #374151;
  margin-bottom: 4px;
  font-size: 14px;
}

.form-group input, 
.form-group select, 
.form-group textarea {
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s ease;
}

.form-group input:focus, 
.form-group select:focus, 
.form-group textarea:focus {
  outline: none;
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-start;
}

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

.btn-primary {
  background: #0ea5e9;
  color: white;
}

.btn-primary:hover {
  background: #0284c7;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.btn-secondary {
  background: #6b7280;
  color: white;
}

.btn-secondary:hover {
  background: #4b5563;
}

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

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

/* Disabled button appearance */
.btn:disabled,
.btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  filter: grayscale(20%);
  pointer-events: none;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
}

.data-table th,
.data-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

.list-compact {
  margin: 0;
  padding-left: 18px;
}

.list-compact li {
  margin: 2px 0;
}

/* Reports table column widths */
.reports-table .col-hours {
  width: 22%;
}

.reports-table .col-emps {
  width: 22%;
}

.data-table th {
  background: #f8fafc;
  font-weight: 600;
  color: #374151;
  font-size: 14px;
}

.data-table tr:hover {
  background: #f9fafb;
}

.data-table .actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.btn-small {
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 4px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.badge-success {
  background: #dcfce7;
  color: #166534;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

.hidden { 
  display: none; 
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: #6b7280;
}

.error {
  background: #fee2e2;
  color: #991b1b;
  padding: 12px;
  border-radius: 6px;
  margin: 12px 0;
}

.success {
  background: #dcfce7;
  color: #166534;
  padding: 12px;
  border-radius: 6px;
  margin: 12px 0;
}

.info {
  color: #0369a1;
  background-color: #f0f9ff;
  border: 1px solid #bae6fd;
  padding: 12px;
  border-radius: 6px;
  margin: 12px 0;
}

/* Scheduler */
.scheduler-container {
  margin-top: 20px;
}

.scheduler-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  gap: 12px;
  flex-wrap: wrap;
}
.scheduler-toolbar .action-controls {
  display: flex;
  gap: 8px;
  width: 100%;
  border-top: 1px dashed #e5e7eb;
  padding-top: 8px;
}

.scheduler-toolbar .left-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.scheduler-toolbar .right-controls {
  display: inline-flex;
  gap: 8px;
  margin-left: auto;
  align-items: center;
}


.scheduler-toolbar label {
  font-size: 13px;
  color: #374151;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.scheduler-toolbar select,
.scheduler-toolbar input[type="date"] {
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: white;
}

.scheduler-grid {
  margin-top: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.employees-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  margin-top: 12px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
}

.employee-chip {
  padding: 6px 10px;
  border-radius: 9999px;
  background: #e2e8f0;
  cursor: grab;
  user-select: none;
  font-size: 12px;
}

.employee-chip[draggable="false"] {
  cursor: default;
  opacity: 0.7;
  background: #f1f5f9;
}

.shift-pill.unassigned {
  color: #991b1b;
  background: #fee2e2;
  border: 1px solid #fecaca;
}

.shift-pill.droppable {
  outline: 2px dashed #0ea5e9;
}

.sched-table {
  width: 100%;
  border-collapse: collapse;
}

.scheduler-statusbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.status-meta {
  color: #6b7280;
  font-size: 12px;
}

.report-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

.sched-table th,
.sched-table td {
  border-bottom: 1px solid #e5e7eb;
  border-right: 1px solid #f3f4f6;
  padding: 8px;
  vertical-align: top;
}

.sched-table th:last-child,
.sched-table td:last-child {
  border-right: none;
}

.sched-header {
  background: #f1f5f9;
  font-weight: 600;
}

.sched-row-header {
  background: #f8fafc;
  font-weight: 600;
  width: 220px;
}

.shift-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  margin: 4px 0;
  border-radius: 8px;
  color: #0f172a;
  font-size: 12px;
  background: #e2e8f0;
}

.shift-pill[draggable="true"] {
  cursor: grab;
}

.shift-pill[draggable="false"] {
  cursor: default;
}

.shift-pill .role-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.total-cell {
  background: #fafafa;
  font-weight: 600;
}

.overlaps-row .overlaps-label {
  background: #fff7ed; /* light orange */
  color: #9a3412;
  font-weight: 600;
}

.overlap-cell {
  background: #fff7ed; /* light orange */
}

.overlaps-total {
  background: #fff7ed;
  color: #9a3412;
}

.overlap-chip {
  display: inline-block;
  padding: 2px 6px;
  margin: 2px 4px 2px 0;
  border-radius: 4px; /* not elliptical */
  background: #fed7aa; /* orange-200 */
  border: 1px solid #fdba74; /* orange-300 */
  color: #7c2d12; /* orange-900 */
  font-size: 11px;
}

.employee-drop-zone {
  min-height: 34px;
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.employee-drop-zone.active {
  border-color: #0ea5e9;
  background: #eff6ff;
  color: #0c4a6e;
}

@media (max-width: 960px) {
  .sched-row-header { width: 160px; }
}

@media (max-width: 640px) {
  .sched-row-header { width: 120px; }
}

/* Responsive design */
@media (max-width: 768px) {
  header {
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
  }
  
  .nav-toggle { display: inline-flex; align-self: flex-end; }
  nav { width: 100%; }
  nav.collapsed { display: none; }
  nav.expanded { display: flex; }
  
  main {
    padding: 16px;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
  
  section {
    padding: 16px;
  }

  .scheduler-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .scheduler-toolbar .left-controls,
  .scheduler-toolbar .right-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
  }

  .filter-controls {
    flex-wrap: wrap;
  }
}

/* Custom Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal-overlay.hidden {
  display: none;
}

.modal-container {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow: hidden;
  animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #111827;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #6b7280;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s;
}

.modal-close:hover {
  background: #f3f4f6;
  color: #374151;
}

.modal-body {
  padding: 20px 24px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.modal-icon {
  flex-shrink: 0;
  color: #f59e0b;
  background: #fef3c7;
  padding: 12px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  flex: 1;
}

.modal-content p {
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 500;
  color: #111827;
  line-height: 1.5;
}

.modal-details {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  margin-top: 12px;
}

.modal-details h4 {
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}

.modal-details ul {
  margin: 0;
  padding-left: 16px;
  color: #6b7280;
  font-size: 14px;
  line-height: 1.6;
}

.modal-details ul li {
  margin-bottom: 4px;
}

.modal-details .schedule-info {
  background: #dbeafe;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 12px;
  font-weight: 500;
  color: #1e40af;
  font-size: 14px;
}

.modal-footer {
  padding: 16px 24px 20px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.modal-footer .btn {
  min-width: 80px;
}

/* Custom Date Input Styles */
.date-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: white;
  overflow: hidden;
}

.date-input-wrapper input[type="text"] {
  flex: 0 0 140px;
  border: none;
  padding: 8px 12px;
  font-size: 14px;
  background: transparent;
  cursor: pointer;
}

.date-input-wrapper input[type="text"]:focus {
  outline: none;
}

.date-input-wrapper:focus-within {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.date-picker-btn {
  background: none;
  border: none;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  color: #6b7280;
  border-left: 1px solid #e5e7eb;
  transition: all 0.2s;
}

.date-picker-btn:hover {
  background: #f3f4f6;
  color: #374151;
}

/* Modal responsive styles */
@media (max-width: 640px) {
  .modal-container {
    margin: 20px;
    width: calc(100% - 40px);
  }
  
  .modal-body {
    flex-direction: column;
    text-align: center;
  }
  
  .modal-footer {
    flex-direction: column-reverse;
  }
  
  .modal-footer .btn {
    width: 100%;
  }
}

/* Responsive tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-responsive table {
  width: 100%;
  border-collapse: collapse;
}

/* Ensure schedule table can scroll on narrow screens */
.sched-table {
  min-width: 900px;
}


