/* Mobile Theme - PWA Parceiros */

/* Touch optimizations */
* {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

input, textarea, select {
  -webkit-user-select: text;
  -khtml-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

/* Mobile-first layout */
@media (max-width: 767px) {
  .container {
    padding: 0 16px;
  }
  
  .card {
    margin-bottom: 12px;
    border-radius: 12px;
  }
  
  .card-header {
    padding: 16px;
    font-size: 1rem;
  }
  
  .card-body {
    padding: 16px;
  }
  
  .stats-card {
    padding: 16px;
    margin-bottom: 12px;
  }
  
  .stats-icon {
    width: 50px;
    height: 50px;
    font-size: 1.25rem;
    margin-bottom: 12px;
  }
  
  .stats-number {
    font-size: 1.75rem;
  }
  
  .stats-label {
    font-size: 0.8rem;
  }
}

/* Pull to refresh */
.pull-to-refresh {
  position: relative;
  overflow: hidden;
}

.pull-to-refresh-indicator {
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 100;
}

.pull-to-refresh-indicator.visible {
  top: 20px;
}

.pull-to-refresh-indicator.loading {
  animation: spin 1s linear infinite;
}

/* Swipe gestures */
.swipe-item {
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease;
}

.swipe-actions {
  position: absolute;
  top: 0;
  right: -200px;
  height: 100%;
  width: 200px;
  display: flex;
  transition: right 0.3s ease;
}

.swipe-item.swiped .swipe-actions {
  right: 0;
}

.swipe-action {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.25rem;
  cursor: pointer;
  transition: background-color 0.3s;
}

.swipe-action.delete {
  background-color: var(--danger);
}

.swipe-action.edit {
  background-color: var(--warning);
}

.swipe-action.archive {
  background-color: var(--info);
}

/* Floating Action Button */
.fab {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 999;
}

.fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 123, 255, 0.5);
}

.fab:active {
  transform: scale(0.95);
}

/* Modal mobile optimizations */
.modal-dialog {
  margin: 0;
  height: 100vh;
  max-width: 100%;
}

.modal-content {
  height: 100vh;
  border-radius: 0;
  border: none;
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid #e9ecef;
}

.modal-body {
  padding: 20px;
  flex: 1;
  overflow-y: auto;
}

.modal-footer {
  padding: 20px;
  border-top: 1px solid #e9ecef;
}

/* Toast notifications */
.toast-container {
  position: fixed;
  top: 70px;
  right: 20px;
  z-index: 2000;
}

.toast {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 16px;
  margin-bottom: 12px;
  min-width: 280px;
  max-width: 350px;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.toast.show {
  transform: translateX(0);
}

.toast-success {
  border-left: 4px solid var(--success);
}

.toast-error {
  border-left: 4px solid var(--danger);
}

.toast-warning {
  border-left: 4px solid var(--warning);
}

.toast-info {
  border-left: 4px solid var(--info);
}

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

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton-text {
  height: 16px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.skeleton-title {
  height: 24px;
  border-radius: 4px;
  margin-bottom: 12px;
  width: 60%;
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

/* Safe area handling for iOS */
@supports (padding: max(0px)) {
  .app-header {
    padding-top: max(12px, env(safe-area-inset-top));
  }
  
  .bottom-nav {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
  
  .app-content {
    padding-bottom: max(70px, calc(70px + env(safe-area-inset-bottom)));
  }
}

/* Haptic feedback simulation */
.haptic-light {
  animation: haptic-light 0.1s ease;
}

.haptic-medium {
  animation: haptic-medium 0.15s ease;
}

.haptic-heavy {
  animation: haptic-heavy 0.2s ease;
}

@keyframes haptic-light {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(0.98); }
}

@keyframes haptic-medium {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(0.95); }
}

@keyframes haptic-heavy {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(0.92); }
  75% { transform: scale(1.02); }
}

/* Dark mode optimizations */
@media (prefers-color-scheme: dark) {
  .skeleton {
    background: linear-gradient(90deg, #2c2c2c 25%, #3c3c3c 50%, #2c2c2c 75%);
  }
  
  .toast {
    background: #2c2c2c;
    color: #f5f5f5;
  }
  
  .modal-content {
    background: #1e1e1e;
    color: #f5f5f5;
  }
}

/* Accessibility improvements */
@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) {
  .card {
    border: 2px solid var(--primary);
  }
  
  .btn {
    border: 2px solid currentColor;
  }
  
  .form-control {
    border: 2px solid var(--dark);
  }
}

/* Large text support */
@media (prefers-font-size: large) {
  body {
    font-size: 1.125rem;
  }
  
  .btn {
    padding: 16px 28px;
    font-size: 1.125rem;
  }
  
  .form-control {
    padding: 16px 20px;
    font-size: 1.125rem;
  }
}
