/* Modern Employee Shift Viewer Styles */

:root {
  --primary-color: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --secondary-color: #8b5cf6;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --info-color: #3b82f6;
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --bg-gradient-light: linear-gradient(135deg, #fbc2eb 0%, #a6c1ee 100%);
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text-primary);
  background: var(--bg-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Top Header */
.top-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.header-brand i {
  font-size: 1.75rem;
  vertical-align: middle;
}

.header-meta {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.875rem;
}

/* Main Content */
.shift-viewer-container {
  min-height: 100vh;
}

.main-content {
  padding: 2rem 0;
}

.shift-viewer-app {
  max-width: 1400px;
  margin: 0 auto;
}

/* Card Styles */
.card {
  border: none;
  border-radius: var(--radius-md);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--bg-secondary);
  overflow: hidden;
}

.card:hover {
  box-shadow: 0 8px 16px rgba(102, 126, 234, 0.15);
  transform: translateY(-2px);
}

.card-body {
  padding: 1.5rem;
}

.card-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

/* Header Controls */
.shift-header {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
}

.shift-header .card-body {
  padding: 1.75rem;
}

/* Buttons */
.btn {
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:active::before {
  width: 300px;
  height: 300px;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
  background: linear-gradient(135deg, #5a67d8 0%, #6b3fa0 100%);
}

.btn-outline-primary {
  border: 2px solid transparent;
  background: linear-gradient(white, white) padding-box,
              linear-gradient(135deg, #667eea 0%, #764ba2 100%) border-box;
  color: var(--primary-color);
}

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

.btn-outline-secondary {
  border: 2px solid var(--border-color);
  color: var(--text-secondary);
  background: white;
}

.btn-outline-secondary:hover {
  background: linear-gradient(135deg, #f8fafc 0%, #e0e7ff 100%);
  border-color: var(--primary-light);
  color: var(--primary-color);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
}

.btn-group {
  gap: 0;
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

/* Form Controls */
.form-select {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Legend */
.shift-legend {
  background: linear-gradient(135deg, #faf5ff 0%, #f0f9ff 100%);
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.shift-legend .badge {
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.shift-type-item {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
}

.shift-type-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #667eea, #764ba2);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
}

.shift-type-item:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.8) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.shift-type-item.active {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%) !important;
  border-color: #6366f1;
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2);
  transform: scale(1.02);
}

.shift-type-item.active::before {
  transform: translateX(0);
}

.shift-type-item:active {
  transform: scale(0.98);
}

/* Calendar View */
.shift-calendar {
  overflow: hidden;
}

.shift-calendar table {
  font-size: 0.9rem;
  margin: 0;
}

.shift-calendar th {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  padding: 1rem 0.5rem;
  border: none;
}

.shift-calendar td {
  min-height: 90px;
  vertical-align: top;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  background: white;
  transition: all 0.2s ease;
}

.shift-calendar td:hover {
  background: var(--bg-primary);
}

.shift-calendar .fw-bold {
  background: linear-gradient(135deg, var(--bg-primary) 0%, #e0e7ff 100%);
  font-weight: 600;
  color: var(--text-primary);
}

.shift-badge {
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
}

.shift-badge:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* List View */
.shift-list table {
  font-size: 0.9rem;
}

.shift-list thead {
  background: var(--bg-primary);
}

.shift-list th {
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  padding: 1rem;
  border: none;
}

.shift-list td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.shift-list tbody tr {
  transition: all 0.2s ease;
}

.shift-list tbody tr:hover {
  background: var(--bg-primary);
  transform: scale(1.001);
}

.shift-list .badge {
  padding: 0.5em 1em;
  font-weight: 600;
  border-radius: 6px;
  box-shadow: var(--shadow-sm);
}

/* Badges */
.badge {
  font-weight: 500;
  padding: 0.35em 0.75em;
  border-radius: 6px;
}

.bg-gradient-primary {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white !important;
}

.bg-success { background-color: var(--success-color) !important; }
.bg-info { background-color: var(--info-color) !important; }
.bg-warning { background-color: var(--warning-color) !important; }
.bg-danger { background-color: var(--danger-color) !important; }
.bg-secondary { background-color: var(--text-secondary) !important; }

/* Loading Spinner */
.spinner-border {
  width: 3rem;
  height: 3rem;
  color: var(--primary-color);
}

/* Responsive Design */
@media (max-width: 992px) {
  .shift-calendar th,
  .shift-calendar td {
    font-size: 0.8rem;
    padding: 0.5rem;
  }

  .shift-calendar .fw-semibold {
    font-size: 0.85rem;
  }
}

@media (max-width: 768px) {
  /* Header Adjustments */
  .top-header {
    padding: 0;
  }

  .header-brand {
    font-size: 1.1rem;
  }

  .header-brand .brand-text {
    display: none;
  }

  .header-brand i {
    font-size: 1.5rem;
  }

  .header-meta {
    font-size: 0.75rem;
  }

  /* Main Content */
  .main-content {
    padding: 1rem 0;
  }

  .container-fluid {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  /* Card Adjustments */
  .card {
    border-radius: var(--radius-sm);
    margin-bottom: 1rem !important;
  }

  .card-body {
    padding: 1rem;
  }

  .card-title {
    font-size: 1rem;
  }

  /* Control Panel */
  .shift-header .row {
    gap: 0.75rem;
  }

  .form-label {
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
  }

  .btn {
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
  }

  .btn i {
    font-size: 0.875rem;
  }

  /* Legend - Mobile Grid */
  .shift-legend .row {
    gap: 0.5rem;
  }

  .shift-type-item {
    font-size: 0.85rem;
    padding: 0.5rem !important;
  }

  .shift-type-badge {
    width: 20px !important;
    height: 20px !important;
  }

  /* Calendar Mobile View */
  .shift-calendar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .shift-calendar table {
    font-size: 0.7rem;
    min-width: 700px;
  }

  .shift-calendar th {
    padding: 0.5rem 0.25rem;
    font-size: 0.65rem;
  }

  .shift-calendar td {
    padding: 0.35rem;
    min-height: 65px;
  }

  .shift-calendar .fw-semibold {
    font-size: 0.75rem;
  }

  .shift-calendar .rounded-circle {
    width: 28px !important;
    height: 28px !important;
    font-size: 0.75rem !important;
  }

  .shift-badge {
    padding: 0.35rem !important;
    font-size: 0.65rem !important;
    border-radius: 4px;
  }

  .shift-badge .fw-bold {
    font-size: 0.65rem;
    margin-bottom: 0.25rem;
  }

  .shift-badge .small {
    font-size: 0.6rem;
  }

  .shift-badge i {
    display: none;
  }

  /* List View Mobile */
  .shift-list {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .shift-list table {
    font-size: 0.8rem;
    min-width: 650px;
  }

  .shift-list th {
    font-size: 0.7rem;
    padding: 0.75rem 0.5rem;
  }

  .shift-list td {
    padding: 0.75rem 0.5rem;
  }

  .shift-list .rounded-circle {
    width: 28px !important;
    height: 28px !important;
    font-size: 0.75rem !important;
  }

  .shift-list .badge {
    font-size: 0.7rem;
    padding: 0.35em 0.65em;
  }

  .shift-list .text-nowrap {
    font-size: 0.75rem;
  }

  /* Mobile Scroll Hint */
  .table-responsive::after {
    content: '← Scroll →';
    position: absolute;
    bottom: 0;
    right: 0;
    background: rgba(99, 102, 241, 0.9);
    color: white;
    padding: 0.25rem 0.75rem;
    font-size: 0.7rem;
    border-radius: 4px 0 0 0;
    animation: fadeInOut 3s ease-in-out infinite;
  }

  @keyframes fadeInOut {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
  }
}

@media (max-width: 576px) {
  /* Extra Small Devices */
  .header-meta small {
    display: none;
  }

  .shift-header .col-lg-3,
  .shift-header .col-lg-6,
  .shift-header .col-md-6,
  .shift-header .col-md-12 {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  .card-body {
    padding: 0.75rem;
  }

  .shift-legend .col-lg-3,
  .shift-legend .col-md-4,
  .shift-legend .col-sm-6 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .shift-calendar table {
    min-width: 600px;
  }

  .shift-calendar th,
  .shift-calendar td {
    padding: 0.25rem;
    min-height: 55px;
  }

  .shift-badge {
    padding: 0.25rem !important;
    font-size: 0.6rem !important;
  }

  .shift-list table {
    min-width: 550px;
  }

  /* Touch Friendly */
  .btn {
    min-height: 44px;
    min-width: 44px;
  }

  .form-select {
    font-size: 0.875rem;
    padding: 0.5rem;
    min-height: 44px;
  }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .top-header .py-3 {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
  }

  .main-content {
    padding: 0.75rem 0;
  }

  .shift-calendar td {
    min-height: 50px;
  }
}

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

.shift-viewer-app > * {
  animation: fadeIn 0.5s ease;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Mobile Scrollbar - Thinner */
@media (max-width: 768px) {
  ::-webkit-scrollbar {
    width: 4px;
    height: 4px;
  }
}

/* Touch Optimization */
@media (hover: none) and (pointer: coarse) {
  /* For touch devices */
  .btn {
    min-height: 44px;
    min-width: 44px;
  }

  .shift-badge {
    cursor: default;
  }

  .shift-badge:active {
    transform: scale(0.95);
  }

  .table-hover tbody tr:hover {
    background-color: transparent;
  }

  .table-hover tbody tr:active {
    background-color: var(--bg-primary);
  }
}

/* Pull to Refresh Indicator */
.pull-to-refresh {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem 1rem;
  background: white;
  border-radius: 0 0 8px 8px;
  box-shadow: var(--shadow-md);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.pull-to-refresh.active {
  opacity: 1;
}

/* Empty State Adjustments */
@media (max-width: 768px) {
  .card-body i[style*="font-size: 3rem"] {
    font-size: 2rem !important;
  }

  .card-body h5 {
    font-size: 1rem;
  }

  .card-body .text-muted {
    font-size: 0.875rem;
  }
}

/* Loading State */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

/* Mobile Navigation Helper */
.mobile-nav-hint {
  display: none;
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  background: var(--primary-color);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 0.8rem;
  z-index: 100;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 768px) {
  .mobile-nav-hint {
    display: block;
  }
}

/* Improve tap targets on mobile */
@media (max-width: 768px) {
  .btn-group .btn {
    padding: 0.6rem 0.8rem;
  }

  select.form-select {
    background-size: 16px 12px;
    background-position: right 0.5rem center;
  }
}

/* Better contrast for mobile */
@media (max-width: 768px) {
  .text-muted {
    color: #64748b !important;
  }

  .small {
    font-size: 0.8rem;
  }
}

/* Sticky header on mobile */
@media (max-width: 768px) {
  .shift-calendar th[style*="position: sticky"] {
    background: linear-gradient(135deg, var(--bg-primary) 0%, #e0e7ff 100%) !important;
  }
}

/* Mobile Calendar View */
.shift-calendar-mobile {
  width: 100%;
}

.employee-shifts-mobile {
  background: white;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}

.employee-shifts-mobile:hover {
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.employee-header-mobile {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.employee-avatar-mobile {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  color: white;
  border: 3px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.employee-name-mobile {
  font-size: 1.1rem;
  font-weight: 600;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.shifts-grid-mobile {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0.5rem;
  padding: 1rem;
  background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
}

.shift-day-mobile {
  background: white;
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  border: 2px solid transparent;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.shift-day-mobile::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, #e2e8f0, transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.shift-day-mobile.today {
  border-color: #6366f1;
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.shift-day-mobile.today::before {
  opacity: 1;
  background: linear-gradient(90deg, #667eea, #764ba2);
}

.shift-day-mobile.weekend {
  background: #fafafa;
}

.shift-day-mobile.has-shift {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.shift-day-mobile.has-shift:active {
  transform: scale(0.98);
}

.day-header-mobile {
  text-align: center;
  margin-bottom: 0.5rem;
}

.day-header-mobile .day-number {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.day-header-mobile .day-name {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 0.25rem;
}

.shift-card-mobile {
  border-radius: 6px;
  padding: 0.5rem;
  color: white;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.25rem;
}

.shift-card-mobile:active {
  transform: scale(0.95);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.shift-type-mobile {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1.2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.shift-time-mobile {
  font-size: 0.65rem;
  font-weight: 500;
  opacity: 0.95;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

.shift-time-mobile i {
  font-size: 0.6rem;
}

/* Mobile Responsive Improvements */
@media (max-width: 576px) {
  .shifts-grid-mobile {
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 0.4rem;
    padding: 0.75rem;
  }

  .shift-day-mobile {
    min-height: 70px;
    padding: 0.4rem;
  }

  .day-header-mobile .day-number {
    font-size: 1.1rem;
  }

  .day-header-mobile .day-name {
    font-size: 0.6rem;
  }

  .shift-type-mobile {
    font-size: 0.65rem;
  }

  .shift-time-mobile {
    font-size: 0.6rem;
  }

  .employee-avatar-mobile {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .employee-name-mobile {
    font-size: 1rem;
  }
}

