/* Enhanced AssetShield App Styles */

/* Global Styles */
* {
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Form Styling */
.form-input, .form-select, .form-textarea {
  @apply w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all;
  font-size: 16px; /* Prevent zoom on iOS */
}

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

.form-radio, .form-checkbox {
  @apply w-4 h-4 text-blue-600 focus:ring-blue-500 border-gray-300;
}

/* Button Styling */
.btn {
  @apply px-6 py-3 font-semibold rounded-lg transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2;
  min-height: 44px; /* Touch-friendly minimum */
}

.btn-primary {
  @apply bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500;
}

.btn-secondary {
  @apply bg-gray-200 text-gray-800 hover:bg-gray-300 focus:ring-gray-500;
}

.btn-success {
  @apply bg-green-600 text-white hover:bg-green-700 focus:ring-green-500;
}

.btn-danger {
  @apply bg-red-600 text-white hover:bg-red-700 focus:ring-red-500;
}

.btn:disabled {
  @apply opacity-50 cursor-not-allowed;
}

/* Mobile-First Responsive Design */
@media (max-width: 768px) {
  .container {
    @apply px-4;
  }
  
  .hero-title {
    font-size: 2rem;
    line-height: 1.2;
  }
  
  .hero-subtitle {
    font-size: 1.1rem;
  }
  
  .section-padding {
    @apply py-12;
  }
  
  .card {
    @apply mx-4;
  }
}

/* Touch-Friendly Elements */
@media (hover: none) and (pointer: coarse) {
  .hover\:scale-105 {
    transform: none;
  }
  
  .hover\:scale-105:active {
    transform: scale(0.98);
  }
  
  button, .btn, [onclick] {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Loading Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

@keyframes pulse-slow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.animate-fade-in {
  animation: fadeIn 0.5s ease-in-out;
}

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

.animate-slide-down {
  animation: slideDown 0.3s ease-out;
}

.animate-pulse-slow {
  animation: pulse-slow 3s infinite;
}

/* PWA Specific Styles */
.pwa-install-prompt {
  @apply fixed bottom-6 right-6 bg-blue-600 text-white p-4 rounded-lg shadow-lg z-50 max-w-sm;
}

.offline-indicator {
  @apply fixed bottom-4 left-4 bg-red-600 text-white px-4 py-2 rounded-lg shadow-lg z-50;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .dark-mode-auto {
    background-color: theme('colors.gray.900');
    color: theme('colors.gray.100');
  }
  
  .dark-mode-auto .bg-white {
    background-color: theme('colors.gray.800');
    color: theme('colors.gray.100');
  }
  
  .dark-mode-auto .text-gray-800 {
    color: theme('colors.gray.200');
  }
  
  .dark-mode-auto .border-gray-300 {
    border-color: theme('colors.gray.600');
  }
}

/* Accessibility Improvements */
.focus-visible:focus {
  @apply ring-2 ring-blue-500 ring-offset-2;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .form-input, .form-select, .form-textarea {
    border-width: 2px;
    border-color: #000;
  }
  
  .btn {
    border: 2px solid;
  }
  
  .btn-primary {
    border-color: #000;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Print Styles */
@media print {
  .no-print {
    display: none !important;
  }
  
  .print-only {
    display: block !important;
  }
  
  * {
    background: transparent !important;
    color: black !important;
    box-shadow: none !important;
  }
}

/* Custom Components */
.assessment-card {
  @apply bg-white rounded-xl shadow-lg p-6 mb-6 transition-all hover:shadow-xl;
}

.assessment-step {
  @apply space-y-6;
}

.step-indicator {
  @apply flex justify-between mb-8;
}

.step-item {
  @apply flex items-center;
}

.step-number {
  @apply w-8 h-8 rounded-full flex items-center justify-center font-semibold text-sm;
}

.step-number.active {
  @apply bg-blue-600 text-white;
}

.step-number.inactive {
  @apply bg-gray-300 text-gray-500;
}

.step-number.completed {
  @apply bg-green-600 text-white;
}

.progress-bar {
  @apply w-full bg-gray-200 rounded-full h-2;
}

.progress-fill {
  @apply bg-blue-600 h-2 rounded-full transition-all duration-300;
}

/* Modal Styles */
.modal-overlay {
  @apply fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4;
}

.modal-content {
  @apply bg-white rounded-lg shadow-xl max-w-md w-full max-h-screen overflow-y-auto;
}

.modal-header {
  @apply p-6 border-b;
}

.modal-body {
  @apply p-6;
}

.modal-footer {
  @apply p-6 border-t flex justify-end space-x-3;
}

/* Notification Styles */
.notification {
  @apply fixed top-4 right-4 bg-white border border-gray-200 rounded-lg shadow-lg p-4 z-50 max-w-sm;
}

.notification.success {
  @apply border-green-500 bg-green-50;
}

.notification.error {
  @apply border-red-500 bg-red-50;
}

.notification.warning {
  @apply border-yellow-500 bg-yellow-50;
}

.notification.info {
  @apply border-blue-500 bg-blue-50;
}

/* Table Styles */
.data-table {
  @apply min-w-full divide-y divide-gray-200;
}

.data-table th {
  @apply px-6 py-3 bg-gray-50 text-left text-xs font-medium text-gray-500 uppercase tracking-wider;
}

.data-table td {
  @apply px-6 py-4 whitespace-nowrap text-sm text-gray-900;
}

.data-table tbody tr:nth-child(even) {
  @apply bg-gray-50;
}

/* Mobile Table Responsiveness */
@media (max-width: 640px) {
  .data-table,
  .data-table thead,
  .data-table tbody,
  .data-table th,
  .data-table td,
  .data-table tr {
    display: block;
  }
  
  .data-table thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }
  
  .data-table tr {
    @apply border border-gray-200 mb-4 rounded-lg p-4;
  }
  
  .data-table td {
    @apply px-0 py-2 border-0 relative pl-16;
  }
  
  .data-table td:before {
    content: attr(data-label);
    @apply absolute left-0 top-2 font-semibold text-gray-600 text-xs uppercase;
  }
}

/* Loading States */
.skeleton {
  @apply animate-pulse bg-gray-200 rounded;
}

.skeleton-text {
  @apply h-4 bg-gray-200 rounded w-3/4 mb-2;
}

.skeleton-avatar {
  @apply h-12 w-12 bg-gray-200 rounded-full;
}

.loading-spinner {
  @apply inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600;
}

/* Utility Classes */
.touch-action-none {
  touch-action: none;
}

.user-select-none {
  user-select: none;
}

.backdrop-blur-sm {
  backdrop-filter: blur(4px);
}

.backdrop-blur-md {
  backdrop-filter: blur(12px);
}

/* Safe Areas for iOS */
@supports (padding: max(0px)) {
  .safe-area-inset-top {
    padding-top: max(1rem, env(safe-area-inset-top));
  }
  
  .safe-area-inset-bottom {
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }
  
  .safe-area-inset-left {
    padding-left: max(1rem, env(safe-area-inset-left));
  }
  
  .safe-area-inset-right {
    padding-right: max(1rem, env(safe-area-inset-right));
  }
}

/* Landscape Mode Adjustments */
@media screen and (orientation: landscape) and (max-height: 500px) {
  .hero-section {
    @apply py-8;
  }
  
  .modal-content {
    @apply max-h-full;
  }
}