/**
 * Mobile Responsive CSS Framework
 * Employee Tracker - Phase 2: Mobile & PWA
 *
 * Mobile-first responsive design with touch-optimized UI
 * Breakpoints: 320px (mobile), 480px (mobile-L), 768px (tablet), 1024px (desktop)
 */

/* ============================================
   BASE MOBILE STYLES (Mobile First Approach)
   ============================================ */

:root {
  --touch-target-min: 44px;
  --mobile-padding: 16px;
  --mobile-spacing: 12px;
  --tablet-padding: 24px;
  --desktop-padding: 32px;
  --bottom-nav-height: 64px;
  --mobile-header-height: 56px;
}

/* Mobile-optimized base typography */
@media (max-width: 767px) {
  html {
    font-size: 14px;
  }

  body {
    padding: 0;
    margin: 0;
    overflow-x: hidden;
  }

  h1 {
    font-size: 1.75rem;
    line-height: 1.2;
  }
  h2 {
    font-size: 1.5rem;
    line-height: 1.3;
  }
  h3 {
    font-size: 1.25rem;
    line-height: 1.4;
  }
  h4 {
    font-size: 1.1rem;
    line-height: 1.4;
  }

  p,
  li {
    line-height: 1.6;
    margin-bottom: 1rem;
  }
}

/* ============================================
   TOUCH-OPTIMIZED ELEMENTS
   ============================================ */

/* Minimum 44px touch targets for accessibility */
@media (max-width: 767px) {
  button,
  .btn,
  a.button,
  input[type='button'],
  input[type='submit'],
  .touch-target {
    min-height: var(--touch-target-min);
    min-width: var(--touch-target-min);
    padding: 12px 20px;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
  }

  /* Larger tap area for important actions */
  .btn-primary,
  .btn-action {
    min-height: 50px;
    font-weight: 600;
  }

  /* Input fields touch-friendly */
  input[type='text'],
  input[type='email'],
  input[type='password'],
  input[type='tel'],
  input[type='date'],
  input[type='time'],
  select,
  textarea {
    min-height: var(--touch-target-min);
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 12px 16px;
    border-radius: 8px;
  }

  /* Remove iOS zoom on focus */
  input:focus,
  select:focus,
  textarea:focus {
    font-size: 16px;
  }
}

/* ============================================
   MOBILE HEADER FIX - Prevent layout breaking
   ============================================ */

@media (max-width: 1024px) {
  /* Ensure logo text stays on one line */
  .logo-text {
    white-space: nowrap;
    font-size: 1rem;
  }

  /* Prevent page title from appearing between logo words */
  .header {
    flex-wrap: nowrap;
  }

  .header-left {
    flex-shrink: 0;
  }

  .header-center {
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }

  .page-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 1rem;
  }
}

@media (max-width: 767px) {
  /* Hide page title on mobile - section title shown in content area */
  .header-center {
    display: none;
  }

  /* Smaller logo on mobile */
  .logo img {
    height: 32px;
  }

  .logo-text {
    font-size: 0.9rem;
  }

  /* Compact header layout */
  .header {
    padding: 0 var(--mobile-padding, 12px);
  }

  .header-right {
    gap: 8px;
    margin-left: auto;
  }

  /* Hide user details text on mobile, keep avatar */
  .user-details {
    display: none;
  }

  .user-avatar {
    width: 36px;
    height: 36px;
    font-size: 0.8rem;
  }

  /* Compact logout button - show power icon */
  .logout-btn span {
    display: none;
  }

  .logout-btn {
    padding: 8px 12px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .logout-btn::before {
    content: '⏻';
    font-size: 1.2rem;
    /* Reset base animation styles so icon is visible */
    position: static;
    transform: none;
    background: none;
  }
}

/* ============================================
   MOBILE LAYOUT STRUCTURE
   ============================================ */

@media (max-width: 767px) {
  /* Main container with bottom nav spacing */
  .mobile-container {
    padding-bottom: calc(var(--bottom-nav-height) + 16px);
  }

  /* Mobile header */
  .mobile-header {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    height: var(--mobile-header-height);
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--mobile-padding);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  }

  .mobile-header-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
  }

  /* Hide desktop sidebar on mobile - use transform instead of display:none so it can slide in */
  .sidebar {
    display: block !important;
    position: fixed;
    top: 0;
    left: 0;
    width: min(380px, 90vw); /* Wider to prevent text clipping in nav bubbles */
    height: 100vh;
    z-index: 1100;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    background: var(--sidebar-bg, #1f2937);
    overflow-y: auto;
    padding-top: 60px; /* Space for header */
  }

  /* Ensure nav-items have proper width and don't clip text */
  .sidebar .nav-item {
    width: calc(100% - 24px); /* Fill sidebar minus margins */
    margin-left: 12px;
    margin-right: 12px;
    box-sizing: border-box;
  }

  /* Show sidebar when active */
  .sidebar.active {
    transform: translateX(0) !important;
  }

  /* Sidebar overlay when open */
  .sidebar.active::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
  }

  /* Hide desktop-only nav */
  .desktop-nav {
    display: none !important;
  }

  /* Full width content on mobile */
  .main-content,
  .page-section {
    width: 100%;
    padding: var(--mobile-padding);
    margin: 0;
  }

  /* Card layouts */
  .card {
    margin-bottom: var(--mobile-spacing);
    border-radius: 12px;
    padding: 16px;
  }

  /* Stack all grids on mobile */
  .grid-2,
  .grid-3,
  .grid-4 {
    display: flex;
    flex-direction: column;
    gap: var(--mobile-spacing);
  }
}

/* ============================================
   BOTTOM NAVIGATION BAR (Mobile)
   ============================================ */

@media (max-width: 767px) {
  .bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--mobile-nav-bg, var(--card-bg));
    border-top: 1px solid var(--mobile-nav-border, var(--border-color));
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    box-shadow: var(--mobile-nav-shadow, 0 -12px 28px rgba(15, 31, 51, 0.08));
    backdrop-filter: blur(16px);
  }

  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: var(--touch-target-min);
    color: var(--mobile-nav-text, var(--text-secondary));
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    /* iOS Safari touch fix */
    touch-action: manipulation;
    -webkit-touch-callout: none;
    user-select: none;
    -webkit-user-select: none;
  }

  .bottom-nav-item:active {
    transform: scale(0.95);
  }

  .bottom-nav-item.active {
    color: var(--mobile-nav-active, var(--accent-primary));
  }

  .bottom-nav-item:hover,
  .bottom-nav-item:focus-visible {
    color: var(--mobile-nav-active, var(--accent-primary));
  }

  .bottom-nav-icon {
    font-size: 24px;
    margin-bottom: 4px;
  }

  .bottom-nav-label {
    font-size: 11px;
    font-weight: 500;
  }
}

/* Hide bottom nav on desktop */
@media (min-width: 768px) {
  .bottom-nav {
    display: none;
  }
}

/* ============================================
   RESPONSIVE TABLES
   ============================================ */

@media (max-width: 767px) {
  /* Convert tables to cards on mobile */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Option 1: Horizontal scroll */
  .table-scroll table {
    min-width: 600px;
  }

  /* Option 2: Card-style layout */
  .table-card {
    display: none;
  }

  .table-card tbody {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .table-card tr {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  }

  .table-card td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
  }

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

  .table-card td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #6b7280;
    margin-right: 16px;
  }
}

/* ============================================
   MOBILE FORMS
   ============================================ */

@media (max-width: 767px) {
  .form-group {
    margin-bottom: 20px;
  }

  .form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
  }

  .form-row {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  /* Full width inputs on mobile */
  .form-control {
    width: 100%;
    box-sizing: border-box;
  }

  /* Button groups stack vertically */
  .button-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .button-group button {
    width: 100%;
  }

  /* Inline button groups stay inline but wrap */
  .button-group-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .button-group-inline button {
    flex: 1;
    min-width: calc(50% - 4px);
  }
}

/* ============================================
   MOBILE MODALS & DIALOGS
   ============================================ */

@media (max-width: 767px) {
  .modal {
    padding: var(--mobile-padding);
  }

  .modal-content {
    width: 100%;
    max-width: none;
    margin: 0;
    border-radius: 16px 16px 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 90vh;
    overflow-y: auto;
  }

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

  .modal-body {
    padding: var(--mobile-padding);
  }

  .modal-footer {
    padding: var(--mobile-padding);
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 12px;
  }

  .modal-footer button {
    flex: 1;
  }
}

/* ============================================
   SWIPE GESTURES
   ============================================ */

@media (max-width: 767px) {
  .swipeable {
    touch-action: pan-y;
    user-select: none;
  }

  .swipe-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
  }

  /* Pull to refresh indicator */
  .pull-to-refresh {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(-60px);
    transition: transform 0.3s ease;
    z-index: 999;
  }

  .pull-to-refresh.visible {
    transform: translateX(-50%) translateY(10px);
  }
}

/* ============================================
   MOBILE DASHBOARD SECTIONS
   ============================================ */

@media (max-width: 767px) {
  /* Dashboard cards */
  .dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--mobile-spacing);
    padding: var(--mobile-padding);
  }

  .dashboard-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  }

  /* Stat cards */
  .stat-card {
    display: flex;
    flex-direction: column;
    padding: 20px;
  }

  .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #111827;
  }

  .stat-label {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 4px;
  }

  /* Quick actions */
  .quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
  }

  .quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #f9fafb;
    border-radius: 12px;
    min-height: 100px;
    border: 1px solid #e5e7eb;
  }

  .quick-action-icon {
    font-size: 32px;
    margin-bottom: 8px;
  }

  .quick-action-label {
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
  }
}

/* ============================================
   MOBILE-SPECIFIC UTILITIES
   ============================================ */

@media (max-width: 767px) {
  /* Spacing utilities */
  .mobile-only {
    display: block !important;
  }
  .desktop-only {
    display: none !important;
  }
  .mobile-hide {
    display: none !important;
  }

  .m-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .m-row {
    display: flex;
    flex-direction: row;
    gap: 12px;
  }
  .m-center {
    text-align: center;
  }
  .m-full {
    width: 100%;
  }

  /* Padding utilities */
  .m-p-0 {
    padding: 0;
  }
  .m-p-1 {
    padding: 8px;
  }
  .m-p-2 {
    padding: 16px;
  }
  .m-p-3 {
    padding: 24px;
  }

  /* Margin utilities */
  .m-mb-0 {
    margin-bottom: 0;
  }
  .m-mb-1 {
    margin-bottom: 8px;
  }
  .m-mb-2 {
    margin-bottom: 16px;
  }
  .m-mb-3 {
    margin-bottom: 24px;
  }
}

/* ============================================
   TABLET BREAKPOINT (768px - 1023px)
   ============================================ */

@media (min-width: 768px) and (max-width: 1023px) {
  :root {
    font-size: 15px;
  }

  .main-content {
    padding: var(--tablet-padding);
  }

  /* 2-column grid for tablets */
  .tablet-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .quick-actions {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Show sidebar on tablet */
  .sidebar {
    display: block !important;
    width: 240px;
  }
}

/* ============================================
   DESKTOP BREAKPOINT (1024px+)
   ============================================ */

@media (min-width: 1024px) {
  .main-content {
    padding: var(--desktop-padding);
  }

  /* Multi-column layouts */
  .grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }

  .grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
  }

  .grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
  }

  .quick-actions {
    grid-template-columns: repeat(4, 1fr);
  }

  .mobile-only {
    display: none !important;
  }
  .desktop-only {
    display: block !important;
  }
}

/* ============================================
   LANDSCAPE ORIENTATION
   ============================================ */

@media (max-width: 767px) and (orientation: landscape) {
  .mobile-header {
    height: 48px;
  }

  .bottom-nav {
    height: 56px;
  }

  :root {
    --mobile-header-height: 48px;
    --bottom-nav-height: 56px;
  }
}

/* ============================================
   HIGH DPI SCREENS (Retina)
   ============================================ */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* Sharper borders */
  .card,
  .button,
  .input {
    border-width: 0.5px;
  }
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */

@media (prefers-color-scheme: dark) {
  @media (max-width: 767px) {
    .mobile-header,
    .bottom-nav {
      background: #1f2937;
      border-color: #374151;
    }

    .mobile-header-title {
      color: #f9fafb;
    }

    .bottom-nav-item {
      color: #9ca3af;
    }

    .bottom-nav-item.active {
      color: #60a5fa;
    }

    .dashboard-card,
    .card {
      background: #1f2937;
      color: #f9fafb;
    }
  }
}

/* ============================================
   ACCESSIBILITY ENHANCEMENTS
   ============================================ */

@media (max-width: 767px) {
  /* Focus indicators */
  button:focus,
  a:focus,
  input:focus,
  select:focus,
  textarea:focus {
    outline: 3px solid #3b82f6;
    outline-offset: 2px;
  }

  /* Reduce motion for accessibility */
  @media (prefers-reduced-motion: reduce) {
    * {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }

  /* High contrast mode */
  @media (prefers-contrast: high) {
    button,
    .btn {
      border: 2px solid currentColor;
    }
  }
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

@media (max-width: 767px) {
  /* GPU acceleration for animations */
  .bottom-nav,
  .mobile-header,
  .modal-content {
    will-change: transform;
    transform: translateZ(0);
  }

  /* Smooth scrolling */
  html {
    scroll-behavior: smooth;
  }

  /* Prevent overscroll bounce */
  body {
    overscroll-behavior-y: contain;
  }
}

/* ============================================
   PWA UI COMPONENTS
   ============================================ */

/* Install Banner */
.pwa-install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #ffffff;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
  z-index: 2000;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.pwa-install-banner.visible {
  transform: translateY(0);
}

.pwa-install-content {
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.pwa-install-text {
  flex: 1;
}

.pwa-install-title {
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 4px;
}

.pwa-install-description {
  font-size: 0.875rem;
  color: #6b7280;
}

.pwa-install-actions {
  display: flex;
  gap: 8px;
}

.pwa-install-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pwa-install-btn:not(.pwa-install-dismiss) {
  background: #3b82f6;
  color: #ffffff;
}

.pwa-install-btn:not(.pwa-install-dismiss):hover {
  background: #2563eb;
}

.pwa-install-dismiss {
  background: #f3f4f6;
  color: #6b7280;
}

.pwa-install-dismiss:hover {
  background: #e5e7eb;
}

/* Update Banner */
.pwa-update-banner {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-120px);
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-radius: 12px;
  z-index: 2000;
  transition: transform 0.3s ease;
  min-width: 320px;
  max-width: 90vw;
}

.pwa-update-banner.visible {
  transform: translateX(-50%) translateY(0);
}

.pwa-update-content {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.pwa-update-text {
  flex: 1;
}

.pwa-update-title {
  font-size: 0.938rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 2px;
}

.pwa-update-description {
  font-size: 0.813rem;
  color: #6b7280;
}

.pwa-update-actions {
  display: flex;
  gap: 8px;
}

.pwa-update-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 0.813rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.pwa-update-btn:not(.pwa-update-dismiss) {
  background: #10b981;
  color: #ffffff;
}

.pwa-update-btn:not(.pwa-update-dismiss):hover {
  background: #059669;
}

.pwa-update-dismiss {
  background: #f3f4f6;
  color: #6b7280;
}

.pwa-update-dismiss:hover {
  background: #e5e7eb;
}

/* Notification Toast */
.pwa-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-radius: 12px;
  padding: 16px 20px;
  z-index: 2000;
  min-width: 280px;
  max-width: 400px;
  transform: translateX(450px);
  transition: transform 0.3s ease;
}

.pwa-notification.visible {
  transform: translateX(0);
}

.pwa-notification-title {
  font-size: 0.938rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.pwa-notification-message {
  font-size: 0.813rem;
  color: #6b7280;
}

.pwa-notification-info {
  border-left: 4px solid #3b82f6;
}

.pwa-notification-info .pwa-notification-title {
  color: #1e40af;
}

.pwa-notification-success {
  border-left: 4px solid #10b981;
}

.pwa-notification-success .pwa-notification-title {
  color: #059669;
}

.pwa-notification-warning {
  border-left: 4px solid #f59e0b;
}

.pwa-notification-warning .pwa-notification-title {
  color: #d97706;
}

.pwa-notification-error {
  border-left: 4px solid #ef4444;
}

.pwa-notification-error .pwa-notification-title {
  color: #dc2626;
}

/* Status Indicator */
.pwa-status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #f3f4f6;
  border-radius: 20px;
  font-size: 0.813rem;
  font-weight: 500;
  color: #6b7280;
  transition: all 0.2s ease;
}

.pwa-status-indicator.online {
  background: #d1fae5;
  color: #059669;
}

.pwa-status-indicator.offline {
  background: #fee2e2;
  color: #dc2626;
}

.pwa-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ca3af;
}

.pwa-status-dot.online {
  background: #10b981;
  animation: pulse-online 2s ease-in-out infinite;
}

.pwa-status-dot.offline {
  background: #ef4444;
}

@keyframes pulse-online {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.1);
  }
}

/* Mobile PWA Adjustments */
@media (max-width: 767px) {
  .pwa-install-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .pwa-install-actions {
    width: 100%;
  }

  .pwa-install-btn {
    flex: 1;
  }

  .pwa-notification {
    right: 16px;
    left: 16px;
    min-width: auto;
    max-width: none;
  }

  .pwa-update-banner {
    min-width: auto;
    max-width: calc(100vw - 32px);
  }

  .pwa-update-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .pwa-update-actions {
    width: 100%;
  }

  .pwa-update-btn {
    flex: 1;
  }
}

/* ============================================
   AVAILABILITY MANAGEMENT UI (Phase 3)
   ============================================ */

.availability-manager {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.availability-header {
  margin-bottom: 30px;
  text-align: center;
}

.availability-header h2 {
  font-size: 2rem;
  color: #111827;
  margin-bottom: 8px;
}

.employee-name {
  font-size: 1.125rem;
  color: #6b7280;
  font-weight: 500;
}

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

.availability-section h3 {
  font-size: 1.25rem;
  color: #111827;
  margin-bottom: 20px;
  font-weight: 600;
}

/* Weekly Schedule Grid */
.weekly-schedule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.schedule-day-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  transition: all 0.2s ease;
}

.schedule-day-card:hover {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.day-header {
  margin-bottom: 12px;
}

.day-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.day-checkbox input[type='checkbox'] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.day-checkbox strong {
  font-size: 1rem;
  color: #374151;
}

.day-times {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.time-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.time-input-group label {
  min-width: 50px;
  font-size: 0.875rem;
  color: #6b7280;
  font-weight: 500;
}

.time-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.875rem;
  color: #111827;
}

.time-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Preferences Form */
.preferences-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

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

.form-group label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
}

.form-control {
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.875rem;
  color: #111827;
  transition: all 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group input[type='checkbox'] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

textarea.form-control {
  resize: vertical;
  font-family: inherit;
}

/* Time Off Requests */
.time-off-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.time-off-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  transition: all 0.2s ease;
}

.time-off-card.status-pending {
  border-left: 4px solid #f59e0b;
}

.time-off-card.status-approved {
  border-left: 4px solid #10b981;
}

.time-off-card.status-denied {
  border-left: 4px solid #ef4444;
}

.time-off-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.time-off-header strong {
  font-size: 1rem;
  color: #111827;
}

.status-badge {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.status-badge.status-approved {
  background: #d1fae5;
  color: #065f46;
}

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

.time-off-body p {
  margin: 8px 0;
  font-size: 0.875rem;
  color: #374151;
}

.time-off-meta {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 12px;
}

.no-data {
  text-align: center;
  color: #9ca3af;
  padding: 40px 20px;
  font-style: italic;
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 0.938rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: #3b82f6;
  color: #ffffff;
}

.btn-primary:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(59, 130, 246, 0.2);
}

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

.btn-secondary:hover {
  background: #4b5563;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(107, 114, 128, 0.2);
}

.btn:active {
  transform: translateY(0);
}

/* Mobile Responsive Availability UI */
@media (max-width: 767px) {
  .availability-manager {
    padding: 16px;
  }

  .availability-header h2 {
    font-size: 1.5rem;
  }

  .availability-section {
    padding: 16px;
  }

  .weekly-schedule-grid {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .time-off-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .btn {
    width: 100%;
  }

  /* Templates Manager Mobile */
  .templates-grid {
    grid-template-columns: 1fr;
  }

  .template-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .template-actions {
    flex-direction: column;
  }

  .template-actions .btn {
    width: 100%;
  }
}

/* ========================================
   SHIFT TEMPLATES STYLES
   ======================================== */

.templates-manager {
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

.templates-header {
  margin-bottom: 32px;
}

.templates-header h2 {
  font-size: 2rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 8px;
}

.templates-header .text-muted {
  color: #64748b;
  font-size: 1rem;
}

.templates-actions {
  margin-bottom: 24px;
  display: flex;
  justify-content: flex-end;
}

.templates-filters {
  margin-bottom: 24px;
  display: flex;
  gap: 16px;
  align-items: center;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-group label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #475569;
}

.filter-group select {
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.875rem;
  color: #1e293b;
  background: white;
  cursor: pointer;
  transition: border-color 0.2s;
}

.filter-group select:hover {
  border-color: #3b82f6;
}

.filter-group select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.template-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  transition: all 0.2s;
  cursor: pointer;
}

.template-card:hover {
  border-color: #3b82f6;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  transform: translateY(-2px);
}

.template-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.template-category-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  background: #dbeafe;
  color: #1e40af;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.shared-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  background: #dcfce7;
  color: #166534;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.template-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 8px 0;
}

.template-description {
  color: #64748b;
  font-size: 0.875rem;
  line-height: 1.5;
  margin-bottom: 16px;
}

.template-stats {
  display: flex;
  gap: 24px;
  margin-bottom: 16px;
  padding: 12px 0;
  border-top: 1px solid #f1f5f9;
  border-bottom: 1px solid #f1f5f9;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
}

.template-meta {
  margin-bottom: 16px;
  color: #94a3b8;
  font-size: 0.75rem;
}

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

.template-actions .btn {
  flex: 1;
  min-width: 80px;
  padding: 8px 12px;
  font-size: 0.875rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.template-actions .btn-primary {
  background: #3b82f6;
  color: white;
}

.template-actions .btn-primary:hover {
  background: #2563eb;
}

.template-actions .btn-secondary {
  background: #f1f5f9;
  color: #475569;
}

.template-actions .btn-secondary:hover {
  background: #e2e8f0;
}

.template-actions .btn-danger {
  background: #fef2f2;
  color: #dc2626;
}

.template-actions .btn-danger:hover {
  background: #fee2e2;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 64px 32px;
  color: #94a3b8;
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #475569;
  margin: 0 0 8px 0;
}

.empty-state p {
  font-size: 1rem;
  color: #94a3b8;
}

/* Modal Styles for Templates */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: white;
  border-radius: 12px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow:
    0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

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

.modal-header h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #94a3b8;
  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: #f1f5f9;
  color: #475569;
}

.modal-body {
  padding: 24px;
}

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

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 8px;
}

.form-group input[type='text'],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.875rem;
  color: #1e293b;
  transition: border-color 0.2s;
}

.form-group input[type='text']:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

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

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

.modal-actions .btn {
  padding: 10px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-actions .btn-secondary {
  background: #f1f5f9;
  color: #475569;
}

.modal-actions .btn-secondary:hover {
  background: #e2e8f0;
}

.modal-actions .btn-primary {
  background: #3b82f6;
  color: white;
}

.modal-actions .btn-primary:hover {
  background: #2563eb;
}

/* ========================================
   AUTO SCHEDULER STYLES (Phase 3)
   ======================================== */

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

.scheduler-header {
  text-align: center;
  margin-bottom: 40px;
}

.scheduler-header h2 {
  font-size: 2rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 8px;
}

.scheduler-form {
  background: white;
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 32px;
}

.form-section {
  margin-bottom: 32px;
}

.form-section h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 16px;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.option-checkbox {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.option-checkbox:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.option-checkbox input[type='checkbox'] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.option-checkbox span {
  font-size: 0.938rem;
  color: #475569;
  font-weight: 500;
}

.scheduler-actions {
  display: flex;
  justify-content: center;
  margin-top: 32px;
}

.btn-large {
  padding: 16px 48px;
  font-size: 1.125rem;
}

.schedule-results {
  background: white;
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 2px solid #e2e8f0;
}

.results-header h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
}

.results-actions {
  display: flex;
  gap: 12px;
}

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

.stat-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.stat-label {
  font-size: 0.875rem;
  opacity: 0.9;
  margin-bottom: 8px;
  font-weight: 500;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
}

.stat-warning {
  color: #fbbf24 !important;
}

.date-group {
  margin-bottom: 24px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
}

.date-header {
  background: #f8fafc;
  padding: 12px 20px;
  font-weight: 600;
  color: #1e293b;
  border-bottom: 1px solid #e2e8f0;
}

.shifts-list {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.shift-item {
  display: grid;
  grid-template-columns: 120px 1fr 150px 100px;
  gap: 16px;
  align-items: center;
  padding: 12px 16px;
  background: #f8fafc;
  border-radius: 6px;
  border-left: 4px solid #3b82f6;
}

.shift-time {
  font-weight: 600;
  color: #1e293b;
  font-size: 0.938rem;
}

.shift-employee {
  color: #475569;
  font-weight: 500;
}

.shift-position {
  color: #64748b;
  font-size: 0.875rem;
}

.shift-score {
  font-size: 0.75rem;
  color: #94a3b8;
  text-align: right;
}

.conflicts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.conflict-item {
  display: grid;
  grid-template-columns: 150px 1fr 200px;
  gap: 16px;
  padding: 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-left: 4px solid #ef4444;
  border-radius: 6px;
}

.conflict-date {
  font-weight: 600;
  color: #991b1b;
}

.conflict-details {
  color: #7f1d1d;
  font-weight: 500;
}

.conflict-reason {
  color: #dc2626;
  font-size: 0.875rem;
  text-align: right;
}

.loading {
  text-align: center;
  padding: 60px 20px;
  font-size: 1.25rem;
  color: #64748b;
}

/* Mobile Auto-Scheduler */
@media (max-width: 767px) {
  .auto-scheduler {
    padding: 16px;
  }

  .scheduler-form {
    padding: 20px;
  }

  .options-grid {
    grid-template-columns: 1fr;
  }

  .results-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .results-actions {
    width: 100%;
  }

  .results-actions .btn {
    flex: 1;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .shift-item {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .shift-score {
    text-align: left;
  }

  .conflict-item {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .conflict-reason {
    text-align: left;
  }
}

/* ============================================
   🔥 PHASE 4: TIME CLOCK SYSTEM
   ============================================ */

.time-clock-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px;
}

.time-clock-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.time-clock-header h2 {
  font-size: 28px;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
}

.current-time {
  font-size: 24px;
  font-weight: 600;
  color: #3b82f6;
  font-family: 'Courier New', monospace;
  padding: 12px 24px;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-radius: 12px;
  border: 2px solid #3b82f6;
}

/* Clock Status Card */
.clock-status-card {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 32px;
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  gap: 24px;
  transition: all 0.3s;
}

.clock-status-card.clocked-in {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  border-color: #10b981;
}

.clock-status-card.clocked-out {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  border-color: #ef4444;
}

.status-icon {
  font-size: 64px;
  line-height: 1;
}

.status-text h3 {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 8px 0;
  color: #1e293b;
}

.status-text p {
  margin: 4px 0;
  color: #64748b;
  font-size: 16px;
}

.clock-time {
  font-weight: 600;
  color: #1e293b;
  font-size: 18px !important;
}

.elapsed-time {
  font-size: 20px !important;
  font-weight: 700;
  color: #3b82f6;
  font-family: 'Courier New', monospace;
}

/* Clock Actions */
.clock-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.clock-btn {
  padding: 24px 32px !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  border-radius: 12px !important;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: all 0.2s;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.clock-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow:
    0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.clock-btn:active:not(:disabled) {
  transform: translateY(0);
}

.clock-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Today's Summary */
.today-summary {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 32px;
}

.today-summary h3 {
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 20px 0;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.summary-item {
  background: #f8fafc;
  padding: 16px;
  border-radius: 8px;
  border-left: 4px solid #3b82f6;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-label {
  font-size: 14px;
  color: #64748b;
  font-weight: 500;
}

.summary-value {
  font-size: 24px;
  font-weight: 700;
  color: #1e293b;
  font-family: 'Courier New', monospace;
}

/* Recent Activity */
.recent-activity {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 24px;
}

.recent-activity h3 {
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 20px 0;
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-item {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: #f8fafc;
  border-radius: 8px;
  transition: all 0.2s;
}

.activity-item:hover {
  background: #eff6ff;
  transform: translateX(4px);
}

.activity-icon {
  font-size: 24px;
  line-height: 1;
}

.activity-label {
  font-weight: 600;
  color: #1e293b;
}

.activity-time {
  font-family: 'Courier New', monospace;
  color: #64748b;
  font-weight: 600;
}

.no-activity {
  text-align: center;
  color: #94a3b8;
  padding: 40px;
  font-style: italic;
}

/* Mobile Time Clock */
@media (max-width: 767px) {
  .time-clock-container {
    padding: 16px;
  }

  .time-clock-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .current-time {
    font-size: 20px;
    padding: 8px 16px;
  }

  .clock-status-card {
    flex-direction: column;
    text-align: center;
    padding: 24px;
  }

  .status-icon {
    font-size: 48px;
  }

  .status-text h3 {
    font-size: 20px;
  }

  .clock-actions {
    grid-template-columns: 1fr;
  }

  .clock-btn {
    padding: 20px 24px !important;
    font-size: 16px !important;
  }

  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .summary-value {
    font-size: 18px;
  }

  .activity-item {
    grid-template-columns: 32px 1fr auto;
    gap: 12px;
    padding: 10px 12px;
  }

  .activity-icon {
    font-size: 20px;
  }

  .activity-label {
    font-size: 14px;
  }

  .activity-time {
    font-size: 13px;
  }
}

/* ============================================
   🔥 PHASE 4: SHIFT SWAP REQUEST SYSTEM
   ============================================ */

.shift-swap-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px;
}

.shift-swap-header {
  margin-bottom: 32px;
}

.shift-swap-header h2 {
  font-size: 28px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 8px 0;
}

.shift-swap-header .text-muted {
  color: #64748b;
  font-size: 16px;
}

/* Swap Actions */
.swap-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 32px;
}

.swap-actions .btn {
  padding: 12px 24px;
  font-weight: 600;
}

/* Tabs */
.swap-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 32px;
  overflow-x: auto;
}

.swap-tab {
  padding: 12px 24px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: #64748b;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.swap-tab:hover {
  color: #3b82f6;
}

.swap-tab.active {
  color: #3b82f6;
  border-bottom-color: #3b82f6;
}

/* Tab Content */
.swap-tab-content {
  min-height: 400px;
}

.swap-tab-pane {
  display: none;
}

.swap-tab-pane.active {
  display: block;
}

/* Swap Cards */
.swap-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
  transition: all 0.2s;
}

.swap-card:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.swap-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.swap-type-badge {
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
}

.swap-type-badge.swap {
  background: #dbeafe;
  color: #1e40af;
}

.swap-type-badge.coverage {
  background: #fef3c7;
  color: #92400e;
}

.swap-type-badge.give-away {
  background: #dcfce7;
  color: #166534;
}

.swap-status-badge {
  padding: 4px 12px;
  border-radius: 12px;
  color: white;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
}

.swap-card-body {
  margin-bottom: 16px;
}

.swap-shift-info {
  background: #f8fafc;
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.swap-shift {
  margin-bottom: 8px;
}

.swap-shift:last-child {
  margin-bottom: 0;
}

.shift-label {
  font-weight: 600;
  color: #475569;
  display: block;
  margin-bottom: 4px;
}

.shift-details {
  color: #1e293b;
  font-size: 14px;
}

.swap-arrow {
  text-align: center;
  font-size: 24px;
  margin: 8px 0;
  color: #3b82f6;
}

.swap-reason {
  background: #eff6ff;
  padding: 12px;
  border-radius: 8px;
  border-left: 4px solid #3b82f6;
  margin-bottom: 12px;
  font-size: 14px;
}

.swap-meta {
  display: flex;
  gap: 16px;
  color: #94a3b8;
  font-size: 13px;
}

.swap-card-actions {
  display: flex;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}

.swap-card-actions .btn {
  padding: 8px 16px;
  font-size: 14px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #94a3b8;
  font-style: italic;
}

/* Mobile Shift Swap */
@media (max-width: 767px) {
  .shift-swap-container {
    padding: 16px;
  }

  .swap-actions {
    flex-direction: column;
  }

  .swap-actions .btn {
    width: 100%;
  }

  .swap-tabs {
    gap: 4px;
  }

  .swap-tab {
    padding: 10px 16px;
    font-size: 14px;
  }

  .swap-card {
    padding: 16px;
  }

  .swap-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .swap-shift-info {
    padding: 12px;
  }

  .shift-details {
    font-size: 13px;
  }

  .swap-card-actions {
    flex-direction: column;
  }

  .swap-card-actions .btn {
    width: 100%;
  }
}

/* ============================================
   PHASE 4: COMMUNICATIONS HUB STYLES
   ============================================ */

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

.communications-header {
  margin-bottom: 32px;
}

.communications-header h1 {
  font-size: 32px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.communications-header .subtitle {
  font-size: 16px;
  color: #64748b;
}

/* Communications Tabs */
.communications-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 32px;
  overflow-x: auto;
}

.comm-tab {
  padding: 12px 24px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: #64748b;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.comm-tab:hover {
  color: #3b82f6;
  background: #f1f5f9;
}

.comm-tab.active {
  color: #3b82f6;
  border-bottom-color: #3b82f6;
  background: #eff6ff;
}

/* Tab Content */
.comm-tab-content {
  display: none;
}

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

/* Notifications Section */
.notifications-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.notifications-filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-badge {
  padding: 8px 16px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-badge:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

.filter-badge.active {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

.unread-badge {
  background: #ef4444;
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  margin-left: 8px;
}

/* Notification Cards */
.notification-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  transition: all 0.2s;
  cursor: pointer;
}

.notification-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: #cbd5e1;
}

.notification-card.unread {
  background: #f0f9ff;
  border-left: 4px solid #3b82f6;
}

.notification-card.priority-urgent {
  border-left: 4px solid #ef4444;
}

.notification-card.priority-high {
  border-left: 4px solid #f59e0b;
}

.notification-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 16px;
}

.notification-title {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.notification-priority {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}

.notification-priority.urgent {
  background: #fee2e2;
  color: #dc2626;
}

.notification-priority.high {
  background: #fef3c7;
  color: #d97706;
}

.notification-priority.normal {
  background: #e0e7ff;
  color: #4f46e5;
}

.notification-priority.low {
  background: #f1f5f9;
  color: #64748b;
}

.notification-message {
  font-size: 14px;
  color: #475569;
  margin-bottom: 12px;
  line-height: 1.6;
}

.notification-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #94a3b8;
}

.notification-category {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: #f8fafc;
  border-radius: 6px;
  font-weight: 500;
}

/* Broadcast Section */
.broadcast-actions {
  margin-bottom: 24px;
}

.broadcast-form {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
}

.broadcast-form h3 {
  font-size: 18px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 20px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  color: #1e293b;
  transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
  font-family: inherit;
}

.recipient-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.recipient-option {
  padding: 12px;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.recipient-option:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.recipient-option.selected {
  background: #dbeafe;
  border-color: #3b82f6;
  color: #1e40af;
  font-weight: 600;
}

.recipient-option input[type='radio'] {
  display: none;
}

.broadcast-preview {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
  margin-top: 16px;
}

.broadcast-preview h4 {
  font-size: 14px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 12px;
}

.preview-content {
  background: white;
  padding: 16px;
  border-radius: 6px;
}

/* Message History */
.message-history {
  margin-top: 32px;
}

.message-history h3 {
  font-size: 18px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 16px;
}

.message-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.message-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 16px;
}

.message-subject {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
}

.message-recipients {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: #f1f5f9;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #475569;
}

.message-content {
  font-size: 14px;
  color: #475569;
  margin-bottom: 12px;
  line-height: 1.6;
}

.message-stats {
  display: flex;
  gap: 24px;
  font-size: 12px;
  color: #94a3b8;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
}

.message-stat {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Empty State */
.notifications-empty {
  text-align: center;
  padding: 64px 32px;
  color: #94a3b8;
}

.notifications-empty .empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.notifications-empty h3 {
  font-size: 18px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 8px;
}

.notifications-empty p {
  font-size: 14px;
}

/* Mobile Communications */
@media (max-width: 767px) {
  .communications-container {
    padding: 16px;
  }

  .communications-header h1 {
    font-size: 24px;
  }

  .communications-tabs {
    gap: 4px;
  }

  .comm-tab {
    padding: 10px 16px;
    font-size: 14px;
  }

  .notifications-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .notifications-filters {
    justify-content: center;
  }

  .notification-card {
    padding: 16px;
  }

  .notification-header {
    flex-direction: column;
    gap: 8px;
  }

  .notification-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .recipient-selector {
    grid-template-columns: 1fr;
  }

  .broadcast-form {
    padding: 16px;
  }

  .message-card {
    padding: 16px;
  }

  .message-card-header {
    flex-direction: column;
    gap: 8px;
  }

  .message-stats {
    flex-direction: column;
    gap: 8px;
  }
}

/* ============================================
   PHASE 5: ADVANCED REPORTS STYLES
   ============================================ */

.reports-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px;
}

.reports-header {
  margin-bottom: 40px;
}

.reports-header h1 {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.reports-header .subtitle {
  font-size: 16px;
  color: var(--text-secondary);
}

/* Report Type Cards */
.report-types-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.report-type-card {
  background: var(--card-bg);
  border: 2px solid var(--card-border);
  border-radius: 16px;
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.report-type-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-primary);
}

.report-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.report-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.report-description {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.6;
}

.report-type-card .btn {
  width: 100%;
}

/* Report Builder */
.report-builder {
  background: var(--card-bg);
  border: 2px solid var(--card-border);
  border-radius: 16px;
  padding: 32px;
  margin-bottom: 40px;
}

.report-builder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border-color);
}

.report-builder-header h2 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.report-builder-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.report-builder-form .form-group {
  margin-bottom: 16px;
}

.report-builder-form label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.report-builder-form input,
.report-builder-form select,
.report-builder-form textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-primary);
  background-color: var(--input-bg);
  transition: all 0.2s;
}

.report-builder-form input:focus,
.report-builder-form select:focus {
  outline: none;
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

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

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
  cursor: pointer;
}

.checkbox-group input[type='checkbox'] {
  width: auto;
  margin: 0;
}

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

/* Report Output */
.report-output {
  background: var(--card-bg);
  border: 2px solid var(--card-border);
  border-radius: 16px;
  padding: 32px;
  margin-bottom: 40px;
}

.report-display-header {
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border-color);
}

.report-display-header h2 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.report-meta {
  display: flex;
  gap: 24px;
  font-size: 14px;
  color: var(--text-secondary);
}

/* Report Summary */
.report-summary {
  margin-bottom: 32px;
}

.report-summary h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.summary-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  transition: all 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Mobile: Clickable stat card styles */
.stat-card-clickable {
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(59, 130, 246, 0.1);
}

.stat-card-clickable:active {
  background: var(--bg-tertiary);
  transform: scale(0.98);
}

/* Always show action hint on mobile */
.stat-action-hint {
  font-size: 12px;
  color: var(--accent-primary);
  opacity: 0.7;
  margin-top: 8px;
  font-weight: 500;
}

/* Hide arrow on mobile, use full tap area */
.stat-card-clickable::after {
  display: none;
}

@media (max-width: 768px) {
  .stat-card-clickable:hover {
    transform: none;
  }

  .stat-card-clickable:active {
    transform: scale(0.98);
    background: var(--bg-tertiary);
  }
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: 8px;
}

.stat-label {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Report Section */
.report-section {
  margin-bottom: 32px;
}

.report-section h3,
.report-section h4 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.report-section h4 {
  font-size: 16px;
  margin-top: 24px;
}

/* Report Table */
.report-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 16px;
}

.report-table thead {
  background: var(--bg-tertiary);
}

.report-table thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 2px solid var(--border-color);
}

.report-table tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.2s;
}

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

.report-table tbody td {
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-primary);
}

.report-table tbody tr:last-child {
  border-bottom: none;
}

/* Print Styles */
@media print {
  .reports-container {
    padding: 0;
  }

  .report-builder,
  .report-actions,
  .report-types-grid,
  .reports-header .btn,
  .sidebar,
  header,
  .mobile-nav {
    display: none !important;
  }

  .report-output {
    border: none;
    padding: 0;
  }

  .report-table {
    page-break-inside: avoid;
  }

  .stat-card {
    page-break-inside: avoid;
  }
}

/* Mobile Reports */
@media (max-width: 767px) {
  .reports-container {
    padding: 16px;
  }

  .reports-header h1 {
    font-size: 24px;
  }

  .report-types-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .report-builder,
  .report-output {
    padding: 16px;
  }

  .report-builder-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .report-builder-form .form-row {
    grid-template-columns: 1fr;
  }

  .report-actions {
    flex-direction: column;
  }

  .report-actions .btn {
    width: 100%;
  }

  .report-meta {
    flex-direction: column;
    gap: 8px;
  }

  .summary-stats {
    grid-template-columns: 1fr;
  }

  .report-table {
    font-size: 12px;
  }

  .report-table thead th,
  .report-table tbody td {
    padding: 8px 12px;
  }
}

/* ============================================
   PHASE 5: ONBOARDING TUTORIAL STYLES
   ============================================ */

/* Tutorial Overlay */
.tutorial-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: transparent; /* Transparent - spotlight box-shadow provides the overlay effect */
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Tutorial Spotlight */
.tutorial-spotlight {
  position: absolute;
  border: 3px solid var(--accent-primary);
  border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7);
  z-index: 10001;
  pointer-events: none;
  transition: all 0.3s ease;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    box-shadow:
      0 0 0 9999px rgba(0, 0, 0, 0.7),
      0 0 20px var(--accent-primary);
  }
  50% {
    box-shadow:
      0 0 0 9999px rgba(0, 0, 0, 0.7),
      0 0 40px var(--accent-primary);
  }
}

/* Tutorial Card */
.tutorial-card {
  position: fixed;
  background: var(--card-bg);
  border: 2px solid var(--accent-primary);
  border-radius: 16px;
  padding: 24px;
  max-width: 400px;
  box-shadow: var(--shadow-xl);
  z-index: 10002;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tutorial-card-header {
  margin-bottom: 16px;
}

.tutorial-card-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.tutorial-step-indicator {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.tutorial-card-content {
  margin-bottom: 20px;
}

.tutorial-card-content p {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: 12px;
}

.tutorial-card-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.tutorial-card-actions .btn {
  padding: 8px 16px;
  font-size: 14px;
}

/* Tutorial Progress */
.tutorial-progress {
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  margin-bottom: 16px;
  overflow: hidden;
}

.tutorial-progress-bar {
  height: 100%;
  background: var(--accent-primary);
  transition: width 0.3s ease;
}

/* Tutorial Arrow */
.tutorial-arrow {
  position: absolute;
  width: 0;
  height: 0;
  border-style: solid;
  z-index: 10002;
}

.tutorial-arrow.arrow-top {
  border-width: 0 10px 12px 10px;
  border-color: transparent transparent var(--accent-primary) transparent;
  top: -12px;
}

.tutorial-arrow.arrow-bottom {
  border-width: 12px 10px 0 10px;
  border-color: var(--accent-primary) transparent transparent transparent;
  bottom: -12px;
}

.tutorial-arrow.arrow-left {
  border-width: 10px 12px 10px 0;
  border-color: transparent var(--accent-primary) transparent transparent;
  left: -12px;
}

.tutorial-arrow.arrow-right {
  border-width: 10px 0 10px 12px;
  border-color: transparent transparent transparent var(--accent-primary);
  right: -12px;
}

/* Tutorial Skip Button */
.tutorial-skip {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10003;
  background: var(--danger);
  border: 2px solid var(--danger);
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
  animation: tutorial-pulse 2s ease-in-out infinite;
}

.tutorial-skip:hover {
  background: #b91c1c;
  border-color: #b91c1c;
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.4);
}

@keyframes tutorial-pulse {
  0%,
  100% {
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
  }
  50% {
    box-shadow: 0 4px 20px rgba(220, 38, 38, 0.6);
  }
}

/* Mobile Tutorial */
@media (max-width: 767px) {
  .tutorial-card {
    max-width: calc(100% - 32px);
    margin: 16px;
  }

  .tutorial-skip {
    top: 10px;
    right: 10px;
    padding: 8px 16px;
    font-size: 12px;
  }
}

/* ============================================
   GM EVALUATIONS MOBILE FIX
   Fix for gray background box not encompassing content
   ============================================ */
@media (max-width: 767px) {
  /* Fix the main form section container */
  #gm-evaluations .form-section {
    padding: 1rem !important;
    margin: 0 !important;
    margin-bottom: 1.5rem !important;
    box-sizing: border-box !important;
    width: 100% !important;
    overflow: hidden !important;
  }

  /* Force grid to single column on mobile - override inline minmax(250px) */
  #gm-evaluations .form-section > form > div[style*='grid'] {
    display: block !important;
    grid-template-columns: none !important;
  }

  #gm-evaluations .form-section > form > div[style*='grid'] > .form-group {
    margin-bottom: 1rem;
  }

  /* Fix criteria evaluation grid to single column */
  #gm-evaluations .criteria-evaluation-grid {
    display: block !important;
    grid-template-columns: none !important;
  }

  /* Ensure criteria items fit within container */
  #gm-evaluations .criteria-eval-item {
    margin-bottom: 1rem !important;
    padding: 0.875rem !important;
    box-sizing: border-box !important;
    width: 100% !important;
  }

  /* Fix range slider display values */
  #gm-evaluations .criteria-eval-item > div[style*='flex'] {
    width: 100% !important;
  }

  /* Fix total score display */
  #gm-evaluations div[style*='background: #e7f3ff'] {
    margin: 1rem 0 !important;
    padding: 0.875rem !important;
    box-sizing: border-box !important;
  }

  /* Fix button container */
  #gm-evaluations div[style*='display: flex'][style*='gap: 1rem'] {
    flex-direction: column !important;
    gap: 0.75rem !important;
  }

  #gm-evaluations .btn {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Ensure card content doesn't overflow */
  #gm-evaluations .card-content {
    padding: 0.75rem !important;
    overflow-x: hidden !important;
  }

  /* Fix form labels for readability */
  #gm-evaluations .form-label {
    font-size: 0.875rem !important;
  }

  /* Fix range inputs for touch */
  #gm-evaluations input[type='range'] {
    width: 100% !important;
    height: 8px !important;
  }
}

/* Extra small screens (iPhone SE, etc.) */
@media (max-width: 375px) {
  #gm-evaluations .form-section {
    padding: 0.75rem !important;
  }

  #gm-evaluations .criteria-eval-item {
    padding: 0.75rem !important;
  }

  #gm-evaluations .criteria-eval-item label {
    font-size: 0.875rem !important;
  }
}

/* ============================================
   ASSIGN POINTS / EMPLOYEE SELECTION MOBILE FIX
   Fix for Select Employee label and Select All Filtered button alignment
   ============================================ */
@media (max-width: 767px) {
  /* Fix the Select Employee / Select All Filtered row */
  #assign-points
    .form-group
    > div[style*='display: flex'][style*='justify-content: space-between'] {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }

  /* Ensure Select All Filtered button doesn't wrap text */
  #selectAllFilteredEmployeesBtn {
    white-space: nowrap !important;
    min-width: auto !important;
    padding: 8px 16px !important;
    font-size: 14px !important;
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* Fix form-row to stack filters vertically on mobile */
  #assign-points .form-row {
    flex-direction: column !important;
    gap: 16px !important;
  }

  #assign-points .form-row > .form-group {
    width: 100% !important;
    margin-bottom: 0 !important;
  }

  /* Filter dropdowns full width */
  #assign-points .form-select {
    width: 100% !important;
  }

  /* Fix criteria toggle buttons */
  .criteria-toggle-btn,
  #selectAllPositiveBtn,
  #selectAllNegativeBtn {
    white-space: nowrap !important;
    min-height: 44px !important;
    padding: 8px 12px !important;
    font-size: 13px !important;
  }

  /* Fix criteria selection row alignment */
  #assign-points
    div[style*='display: flex'][style*='justify-content: space-between'][style*='gap'] {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  /* Employee selection container - ensure proper spacing */
  #employeeSelectionContainer,
  #employeeBubblesContainer {
    width: 100% !important;
    overflow-x: hidden !important;
  }

  /* Employee bubble cards - ensure they fit */
  #employeeSelectionContainer .employee-card,
  #employeeBubblesContainer .employee-card,
  #employeeSelectionContainer > div,
  #employeeBubblesContainer > div {
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Card content padding adjustment */
  #assign-points .card-content {
    padding: 12px !important;
  }
}

/* Extra small screens for Assign Points */
@media (max-width: 375px) {
  #selectAllFilteredEmployeesBtn {
    font-size: 13px !important;
    padding: 6px 12px !important;
  }

  .criteria-toggle-btn,
  #selectAllPositiveBtn,
  #selectAllNegativeBtn {
    font-size: 12px !important;
    padding: 6px 10px !important;
  }

  #assign-points .form-label {
    font-size: 14px !important;
  }
}

/* ============================================
   iPhone-specific fixes (390-430px viewport)
   iPhone 12-16 use 390px-430px depending on zoom
   ============================================ */
@media (max-width: 430px) {
  :root {
    --mobile-padding: 12px;
  }

  .header {
    padding: 0 8px;
    padding-top: env(safe-area-inset-top, 0px);
    justify-content: space-between;
  }

  /* Header left - logo and title get dedicated space */
  .header-left {
    flex: 1;
    gap: 8px;
    min-width: 0;
  }

  .logo {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
  }

  .logo img {
    height: 28px;
    width: auto;
  }

  .logo-text {
    font-size: 0.85rem;
    white-space: nowrap;
  }

  /* Header right - compact controls pushed to far right */
  .header-right {
    gap: 4px;
    flex-shrink: 0;
    margin-left: auto;
  }

  /* Smaller user avatar on iPhone */
  .user-avatar {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
  }

  /* Hide theme toggle text on small screens */
  .theme-toggle-text {
    display: none;
  }

  .theme-toggle {
    padding: 8px;
    min-width: 40px;
    justify-content: center;
  }

  /* Logout button - ensure icon is visible */
  .logout-btn {
    padding: 6px 10px;
    min-width: 40px;
  }

  .logout-btn::before {
    position: static;
    transform: none;
    background: none;
    color: var(--color-text-secondary);
  }

  /* Force single column grids */
  .evaluation-grid,
  .criteria-grid,
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* Cards use full width */
  .evaluation-card,
  .criteria-item,
  .stat-card {
    width: 100%;
    margin: 0;
  }

  /* Safe area padding for notched phones */
  .main-content {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }

  /* Performance summary grid - override inline styles */
  .performance-summary-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* Fix performer card text clipping */
  .performance-summary-grid > div {
    width: 100% !important;
    min-width: 0 !important;
  }

  /* ============================================
     Employee Bubble Cards - Assign Points Section
     Fix centering and content overflow on iPhone
     ============================================ */

  /* Force card-content to use column layout on mobile */
  #point-assignment .card-content,
  section#point-assignment .card-content {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    overflow: visible !important;
    gap: 16px !important;
  }

  /* Force ALL form-groups inside point-assignment to full width */
  #point-assignment .form-group,
  section#point-assignment .form-group,
  #point-assignment .card-content > .form-group {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    flex: 1 1 100% !important;
    flex-direction: column !important;
  }

  /* Employee selection container - force full width */
  #employeeBubblesContainer,
  #employeeSelectionContainer,
  #point-assignment #employeeSelectionContainer {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    padding: 0 4px !important;
    box-sizing: border-box !important;
    overflow: visible !important;
  }

  /* Grid container - force single column on mobile */
  .employee-cards-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Employee bubble cards - full width, properly centered */
  .employee-bubble-card,
  #employeeBubblesContainer .employee-card,
  #employeeSelectionContainer .employee-card {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 12px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  /* Employee info section - prevent overflow */
  .employee-bubble-card .employee-info,
  .employee-card .employee-info {
    min-width: 0 !important;
    flex: 1 !important;
    overflow: hidden !important;
  }

  /* Employee name badges - allow wrapping */
  .employee-bubble-card .employee-name-badges,
  .employee-card .employee-name {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 4px !important;
    white-space: normal !important;
    min-width: 0 !important;
  }

  /* Name badge styling - fit within card */
  .employee-bubble-card .employee-name-badges .badge,
  .employee-bubble-card .employee-name-badges span,
  .employee-card .employee-name .badge,
  .employee-card .employee-name span[style*="background"] {
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    flex-shrink: 1 !important;
  }

  /* Employee details (location, job title) - wrap properly */
  .employee-bubble-card .employee-details,
  .employee-card .employee-details {
    flex-wrap: wrap !important;
    gap: 4px !important;
    min-width: 0 !important;
  }

  /* Detail badges - truncate if needed */
  .employee-bubble-card .employee-details > span,
  .employee-bubble-card .employee-details .badge,
  .employee-card .employee-details > span,
  .employee-card .employee-details .badge {
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 11px !important;
  }

  /* Avatar circle - keep compact */
  .employee-bubble-card .employee-avatar,
  .employee-bubble-card > div:first-child[style*="border-radius"],
  .employee-card .employee-avatar,
  .employee-card > div:first-child[style*="border-radius: 50%"] {
    flex-shrink: 0 !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
  }

  /* Checkbox - keep compact */
  .employee-bubble-card .employee-checkbox,
  .employee-card .employee-checkbox {
    flex-shrink: 0 !important;
    width: 24px !important;
    height: 24px !important;
  }
}

/* =================================================================
   SHIFT ANALYTICS - Top Performers & Export Grid
   ================================================================= */

/* Desktop: Two-column grid (Top Performers 2fr, Export 1fr) */
.analytics-performers-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

/* Mobile: Stack vertically - Top Performers full width, Export below */
@media (max-width: 767px) {
  .analytics-performers-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
  }

  /* Ensure Top Performers table is readable */
  .analytics-performers-grid .card {
    width: 100% !important;
  }

  /* Top Performers table - allow horizontal scroll if needed */
  .analytics-performers-grid #topPerformersTable {
    width: 100% !important;
    font-size: 14px !important;
  }

  .analytics-performers-grid #topPerformersTable th,
  .analytics-performers-grid #topPerformersTable td {
    padding: 8px 6px !important;
  }
}

/* =================================================================
   ANNOUNCEMENTS - Header & Button Layout Fix
   ================================================================= */

/* Mobile: Stack header and Create button vertically */
@media (max-width: 430px) {
  #announcements-header {
    flex-direction: column !important;
    align-items: flex-start !important;
  }

  #announcements-header > div:first-child {
    width: 100% !important;
  }

  #show-create-announcement-btn {
    width: 100% !important;
    margin-top: 0.5rem !important;
  }
}
