/* Disable smooth scroll to prevent scroll position conflicts */
html, body {
  scroll-behavior: auto !important;
}

/* Drag and Drop Styles */
.dragging {
  opacity: 0.5;
  transform: rotate(5deg);
  z-index: 1000;
}

.drag-over {
  border-color: #6366f1 !important;
  background-color: #eef2ff !important;
  transform: scale(1.02);
}

.drag-handle {
  cursor: grab;
}

.drag-handle:active {
  cursor: grabbing;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
  /* Mobile Dashboard Cards */
  .dashboard-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    border: 1px solid #f1f5f9;
  }
  
  /* Mobile Event Cards */
  .mobile-event-card {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-left: 4px solid #6366f1;
    box-shadow: 0 1px 6px rgba(0,0,0,0.1);
  }
  
  /* Mobile Task Cards */
  .mobile-task-card {
    background: white;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 0.5rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    min-height: 44px;
    cursor: pointer;
    transition: all 0.2s ease;
  }
  
  .mobile-task-card:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  }
  
  /* Mobile Chat Interface */
  .mobile-chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
    background: #f8fafc;
  }
  
  .mobile-message-bubble {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.4;
    word-wrap: break-word;
  }
  
  .mobile-message-bubble.sent {
    align-self: flex-end;
    background: #6366f1;
    color: white;
    border-bottom-right-radius: 6px;
  }
  
  .mobile-message-bubble.received {
    align-self: flex-start;
    background: white;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 6px;
  }
  
  /* Mobile Kanban Board */
  .mobile-kanban-container {
    display: flex;
    overflow-x: auto;
    gap: 1rem;
    padding: 1rem;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
  }
  
  .mobile-kanban-column {
    min-width: 280px;
    background: #f8fafc;
    border-radius: 12px;
    padding: 1rem;
    scroll-snap-align: start;
  }
  
  /* Mobile Section Tabs */
  .mobile-section-tabs {
    display: flex;
    background: white;
    border-radius: 12px;
    padding: 0.25rem;
    margin: 1rem 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .mobile-section-tab {
    flex: 1;
    text-align: center;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-width: 80px;
  }
  
  .mobile-section-tab.active {
    background: #6366f1;
    color: white;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
  }
  
  /* Mobile Bottom Navigation */
  .mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e2e8f0;
    padding: 0.75rem 0 calc(0.75rem + env(safe-area-inset-bottom));
    z-index: 50;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
  }
  
  .mobile-nav-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
  }
  
  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    color: #64748b;
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.5rem;
    border-radius: 8px;
    min-width: 60px;
    transition: all 0.2s ease;
  }
  
  .mobile-nav-item.active {
    color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
  }
  
  .mobile-nav-item:active {
    transform: scale(0.95);
  }
  
  /* Mobile Safe Areas */
  .mobile-content-with-nav {
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
  }
  
  /* Touch-friendly inputs */
  input, textarea, select {
    font-size: 16px !important;
    min-height: 44px;
    padding: 0.75rem 1rem;
    border-radius: 8px;
  }
  
  /* Touch-friendly buttons */
  button, .btn {
    min-height: 44px;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
  }
}

/* Mobile viewport optimization */
@viewport {
  width: device-width;
  zoom: 1.0;
}

/* Mobile-first responsive design */
* {
  box-sizing: border-box;
}

/* Touch-friendly minimum sizes */
button, .btn, a.btn, input[type="submit"], input[type="button"] {
  min-height: 44px;
  min-width: 44px;
}

/* Mobile typography scaling */
@media (max-width: 768px) {
  html {
    font-size: 16px; /* Prevent zoom on input focus */
  }
  
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }
  
  /* Better mobile form inputs */
  input, textarea, select {
    font-size: 16px; /* Prevent zoom on focus */
    padding: 12px;
    border-radius: 8px;
  }
  
  /* Mobile-friendly buttons */
  button, .btn {
    padding: 12px 16px;
    font-size: 16px;
    border-radius: 8px;
  }
  
  /* Better mobile spacing */
  .container, .mx-auto {
    padding-left: 16px;
    padding-right: 16px;
  }
}

/* Mobile navigation improvements */
@media (max-width: 768px) {
  nav .hidden.md\\:flex {
    display: none !important;
  }
  
  /* Mobile menu overlay */
  .mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 50;
  }
  
  .mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 280px;
    background: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 51;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
  }
  
  .mobile-menu.open {
    transform: translateX(0);
  }
}

/* Mobile-friendly tables */
@media (max-width: 768px) {
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  table {
    min-width: 600px;
  }
  
  th, td {
    padding: 8px 4px;
    font-size: 14px;
  }
}

/* Mobile card layouts */
@media (max-width: 768px) {
  .grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }
  
  .lg\\:grid-cols-2, 
  .lg\\:grid-cols-3, 
  .md\\:grid-cols-2 {
    grid-template-columns: 1fr !important;
  }
}

/* Mobile modal improvements */
@media (max-width: 768px) {
  .modal-content {
    margin: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
  }
  
  .modal {
    padding: 0;
  }
}

/* Touch-friendly interactive elements */
.touch-target {
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Mobile form improvements */
@media (max-width: 768px) {
  .form-group {
    margin-bottom: 20px;
  }
  
  label {
    font-size: 16px;
    margin-bottom: 8px;
    display: block;
  }
  
  .form-row {
    flex-direction: column;
  }
  
  .form-row > * {
    width: 100% !important;
    margin-bottom: 16px;
  }
}

/* Feedback Widget Animations */
.pulse-animation {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

.animate-slide-up {
  animation: slideUp 0.3s ease-out;
}

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

/* Toast positioning fix */
.fixed.top-4.right-4 {
  z-index: 60; /* Higher than feedback widget */
}

/* Mobile toast positioning */
@media (max-width: 768px) {
  .fixed.top-4.right-4 {
    top: 1rem;
    right: 1rem;
    left: 1rem;
    right: 1rem;
  }
}

/* Messaging Accessibility Styles */
.messaging-container.font-size-small {
  font-size: 0.875rem;
}

.messaging-container.font-size-medium {
  font-size: 1rem;
}

.messaging-container.font-size-large {
  font-size: 1.125rem;
}

.messaging-container.high-contrast-mode {
  filter: contrast(1.5);
}

.messaging-container.high-contrast-mode .bg-white {
  background-color: #000000 !important;
  color: #ffffff !important;
}

.messaging-container.high-contrast-mode .text-gray-600,
.messaging-container.high-contrast-mode .text-gray-700,
.messaging-container.high-contrast-mode .text-gray-800,
.messaging-container.high-contrast-mode .text-gray-900 {
  color: #ffffff !important;
}

.messaging-container.high-contrast-mode .border-gray-200,
.messaging-container.high-contrast-mode .border-gray-300 {
  border-color: #ffffff !important;
}

.messaging-container.dyslexia-font-mode {
  font-family: 'Arial', 'Helvetica', sans-serif;
  letter-spacing: 0.05em;
  line-height: 1.6;
}

.messaging-container.dyslexia-font-mode * {
  font-family: inherit !important;
}

/* Mobile-specific improvements */
@media (max-width: 768px) {
  /* Better mobile scrolling */
  body {
    -webkit-overflow-scrolling: touch;
  }
  
  /* Prevent horizontal scrolling */
  html, body {
    overflow-x: hidden;
  }
  
  /* Mobile-friendly dropdowns */
  select {
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 4 5"><path fill="%23666" d="M2 0L0 2h4zm0 5L0 3h4z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 40px !important;
  }
  
  /* Mobile keyboard handling */
  input[type="email"],
  input[type="password"],
  input[type="text"],
  input[type="tel"],
  input[type="url"] {
    font-size: 16px !important; /* Prevent zoom on iOS */
  }
  
  /* Mobile-friendly focus states */
  input:focus,
  textarea:focus,
  select:focus {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
  }
  
  /* Better mobile button spacing */
  .space-x-2 > * + * {
    margin-left: 8px;
  }
  
  .space-x-4 > * + * {
    margin-left: 16px;
  }
  
  /* Mobile-friendly cards */
  .rounded-lg {
    border-radius: 12px;
  }
  
  /* Touch-friendly hover states (remove on touch devices) */
  @media (hover: none) {
    button:hover,
    .hover\\:bg-gray-50:hover,
    .hover\\:text-indigo-600:hover {
      background-color: inherit;
      color: inherit;
    }
  }
}

/* Landscape mobile orientation */
@media screen and (max-height: 500px) and (orientation: landscape) {
  .mobile-menu {
    width: 240px;
  }
  
  nav {
    height: 56px;
  }
}

/* Enhanced Mobile Optimizations */
@media (max-width: 768px) {
  /* Mobile navigation */
  .mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e5e7eb;
    padding: 0.5rem;
    z-index: 50;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  }
  
  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    min-height: 44px;
    text-align: center;
    font-size: 0.75rem;
    color: #6b7280;
    text-decoration: none;
    transition: color 0.2s;
  }
  
  .mobile-nav-item.active {
    color: #4f46e5;
  }
  
  .mobile-nav-item:hover {
    color: #4f46e5;
  }
  
  /* Add bottom padding to main content for mobile nav */
  .mobile-content-padding {
    padding-bottom: 5rem;
  }
  
  /* Mobile-optimized cards */
  .mobile-card {
    background: white;
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #f3f4f6;
  }
  
  /* Improve touch targets */
  .touch-target {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Mobile-friendly form elements */
  .mobile-input {
    min-height: 44px;
    padding: 0.75rem;
    font-size: 16px;
    border-radius: 0.5rem;
    border: 1px solid #d1d5db;
  }
  
  /* Mobile button improvements */
  .mobile-btn {
    min-height: 44px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
  }
  
  /* Responsive grid overrides */
  .mobile-grid-single {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }
  
  /* Mobile modal improvements */
  .mobile-modal {
    margin: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    border-radius: 1rem;
  }
  
  /* Mobile table improvements */
  .mobile-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .mobile-table-scroll table {
    min-width: 600px;
  }
  
  /* Improved spacing for mobile */
  .mobile-spacing {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  /* Hide desktop elements on mobile */
  .desktop-only {
    display: none !important;
  }
  
  /* Show mobile-only elements */
  .mobile-only {
    display: block !important;
  }
}

/* Tablet optimizations */
@media (min-width: 768px) and (max-width: 1024px) {
  .tablet-grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .tablet-spacing {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

/* Enhanced touch interactions */
@media (hover: none) and (pointer: coarse) {
  /* Remove hover effects on touch devices */
  .hover\:bg-gray-50:hover,
  .hover\:text-indigo-600:hover,
  .hover\:shadow-md:hover {
    background-color: inherit;
    color: inherit;
    box-shadow: inherit;
  }
  
  /* Add active states for touch feedback */
  .touch-feedback:active {
    background-color: rgba(0, 0, 0, 0.05);
    transform: scale(0.98);
  }
}

/* Prevent zoom on iOS when focusing inputs */
@supports (-webkit-touch-callout: none) {
  input[type="email"],
  input[type="password"],
  input[type="text"],
  input[type="tel"],
  input[type="url"],
  input[type="number"],
  textarea,
  select {
    font-size: 16px !important;
  }
}
