/* GeoToolbox Main Stylesheet */
/* Built with Tailwind CSS and custom components */

/* Base styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* Custom CSS variables - Design System Colors */
:root {
  /* Brand Colors */
  --color-brand-black: #000000;
  --color-brand-white: #FFFFFF;
  --color-brand-red: #E11D48;
  --color-brand-deep-gray: #1A1A1A;
  --color-brand-muted-red: #F87171;
  --color-brand-light-gray: #F3F4F6;
  --color-brand-medium-gray: #9CA3AF;
  --color-brand-border-gray: #E5E7EB;
  
  /* Primary (Action Red) */
  --color-primary: #E11D48;
  --color-primary-dark: #BE123C;
  --color-primary-light: #F87171;
  
  /* Semantic Colors */
  --color-success: #10B981;
  --color-warning: #F59E0B;
  --color-error: #EF4444;
  --color-info: #3B82F6;
  
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  
  /* Spacing & Layout */
  --border-radius: 0.5rem;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

/* Custom utility classes */
.text-balance {
  text-wrap: balance;
}

.text-pretty {
  text-wrap: pretty;
}

/* HTMX loading states */
.htmx-request {
  cursor: wait;
}

.htmx-loading {
  opacity: 0.6;
  transition: opacity 0.2s ease-in-out;
}

.htmx-settling {
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
}

.htmx-swapping {
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
}

/* Custom loading spinner */
.spinner {
  @apply inline-block w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin;
}

.spinner-lg {
  @apply w-8 h-8 border-4;
}

/* Custom button styles */
.btn {
  @apply inline-flex items-center justify-center px-4 py-2 text-sm font-medium rounded-md border transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2;
}

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

.btn-secondary {
  @apply bg-white border-gray-300 text-gray-700 hover:bg-gray-50 focus:ring-primary-500;
}

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

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

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

.btn-sm {
  @apply px-3 py-1.5 text-xs;
}

.btn-lg {
  @apply px-6 py-3 text-base;
}

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

/* Custom form styles */
.form-input {
  @apply block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-primary-500 focus:border-primary-500;
}

.form-select {
  @apply block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-primary-500 focus:border-primary-500;
}

.form-textarea {
  @apply block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-primary-500 focus:border-primary-500;
}

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

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

.form-label {
  @apply block text-sm font-medium text-gray-700 mb-1;
}

.form-help {
  @apply text-sm text-gray-500 mt-1;
}

.form-error {
  @apply text-sm text-error-600 mt-1;
}

/* Custom card styles */
.card {
  @apply bg-white rounded-lg shadow-sm border border-gray-200;
}

.card-header {
  @apply px-6 py-4 border-b border-gray-200;
}

.card-title {
  @apply text-lg font-semibold text-gray-900;
}

.card-body {
  @apply px-6 py-4;
}

.card-footer {
  @apply px-6 py-4 border-t border-gray-200 bg-gray-50;
}

/* Custom badge styles */
.badge {
  @apply inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium;
}

.badge-primary {
  @apply bg-primary-100 text-primary-800;
}

.badge-secondary {
  @apply bg-gray-100 text-gray-800;
}

.badge-success {
  @apply bg-success-100 text-success-800;
}

.badge-warning {
  @apply bg-warning-100 text-warning-800;
}

.badge-danger {
  @apply bg-error-100 text-error-800;
}

/* Custom alert styles */
.alert {
  @apply p-4 rounded-md border;
}

.alert-primary {
  @apply bg-primary-50 border-primary-200 text-primary-800;
}

.alert-secondary {
  @apply bg-gray-50 border-gray-200 text-gray-800;
}

.alert-success {
  @apply bg-success-50 border-success-200 text-success-800;
}

.alert-warning {
  @apply bg-warning-50 border-warning-200 text-warning-800;
}

.alert-danger {
  @apply bg-error-50 border-error-200 text-error-800;
}

/* Custom table styles */
.table {
  @apply min-w-full divide-y divide-gray-200;
}

.table-header {
  @apply bg-gray-50;
}

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

.table-body {
  @apply bg-white divide-y divide-gray-200;
}

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

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

.table-hover .table-body tr:hover {
  @apply bg-gray-50;
}

/* Custom modal styles */
.modal-backdrop {
  @apply fixed inset-0 bg-black bg-opacity-50 transition-opacity z-40;
}

.modal-container {
  @apply fixed inset-0 z-50 overflow-y-auto;
}

.modal-wrapper {
  @apply flex min-h-full items-center justify-center p-4;
}

.modal-content {
  @apply bg-white rounded-lg shadow-xl transform transition-all max-w-lg w-full;
}

.modal-header {
  @apply px-6 py-4 border-b border-gray-200;
}

.modal-title {
  @apply text-lg font-semibold text-gray-900;
}

.modal-body {
  @apply px-6 py-4;
}

.modal-footer {
  @apply px-6 py-4 border-t border-gray-200 flex justify-end space-x-3;
}

/* Custom dropdown styles */
.dropdown {
  @apply relative inline-block text-left;
}

.dropdown-menu {
  @apply origin-top-right absolute right-0 mt-2 w-56 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none z-50;
}

.dropdown-item {
  @apply block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 cursor-pointer;
}

.dropdown-divider {
  @apply border-t border-gray-100 my-1;
}

/* Custom tooltip styles */
.tooltip {
  @apply absolute z-50 px-2 py-1 text-xs text-white bg-gray-900 rounded shadow-lg;
}

.tooltip::before {
  content: '';
  @apply absolute w-0 h-0 border-l-4 border-r-4 border-t-4 border-transparent border-t-gray-900;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
}

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

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

.progress-bar-success {
  @apply bg-success-600;
}

.progress-bar-warning {
  @apply bg-warning-600;
}

.progress-bar-danger {
  @apply bg-error-600;
}

/* Custom tabs styles */
.tabs {
  @apply border-b border-gray-200;
}

.tab-list {
  @apply flex space-x-8;
}

.tab {
  @apply py-2 px-1 border-b-2 border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 font-medium text-sm cursor-pointer;
}

.tab-active {
  @apply border-primary-500 text-primary-600;
}

.tab-content {
  @apply py-4;
}

/* Custom breadcrumb styles */
.breadcrumb {
  @apply flex items-center space-x-2 text-sm text-gray-500;
}

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

.breadcrumb-separator {
  @apply mx-2 text-gray-400;
}

/* Custom pagination styles */
.pagination {
  @apply flex items-center justify-between border-t border-gray-200 bg-white px-4 py-3 sm:px-6;
}

.pagination-info {
  @apply text-sm text-gray-700;
}

.pagination-nav {
  @apply flex space-x-2;
}

.pagination-btn {
  @apply relative inline-flex items-center px-3 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-1 focus:ring-primary-500 focus:border-primary-500;
}

.pagination-btn-active {
  @apply bg-primary-50 border-primary-500 text-primary-600;
}

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

/* Custom file upload styles */
.file-upload {
  @apply relative border-2 border-dashed border-gray-300 rounded-lg p-6 hover:border-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent;
}

.file-upload-dragover {
  @apply border-primary-400 bg-primary-50;
}

.file-upload-input {
  @apply absolute inset-0 w-full h-full opacity-0 cursor-pointer;
}

.file-upload-content {
  @apply text-center;
}

.file-upload-icon {
  @apply mx-auto h-12 w-12 text-gray-400;
}

.file-upload-text {
  @apply mt-2 block text-sm font-medium text-gray-900;
}

.file-upload-hint {
  @apply block text-sm text-gray-500;
}

/* Custom code block styles */
.code-block {
  @apply bg-gray-900 text-gray-100 p-4 rounded-lg overflow-x-auto font-mono text-sm;
}

.code-inline {
  @apply bg-gray-100 text-gray-800 px-1.5 py-0.5 rounded font-mono text-sm;
}

/* Custom syntax highlighting */
.highlight .k { color: #d73a49; } /* Keyword */
.highlight .s { color: #032f62; } /* String */
.highlight .c { color: #6a737d; } /* Comment */
.highlight .n { color: #6f42c1; } /* Name */
.highlight .o { color: #d73a49; } /* Operator */

/* GeoToolbox specific components */
.tool-card {
  @apply card hover:shadow-md transition-shadow duration-200 cursor-pointer;
}

.tool-card:hover {
  @apply shadow-lg;
}

.tool-icon {
  @apply w-8 h-8 text-primary-600;
}

.coordinate-input {
  @apply font-mono text-sm;
}

.map-container {
  @apply w-full h-96 rounded-lg border border-gray-300 bg-gray-50;
}

.data-table {
  @apply table table-striped table-hover;
}

.status-indicator {
  @apply inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium;
}

.status-success {
  @apply bg-success-100 text-success-800;
}

.status-warning {
  @apply bg-warning-100 text-warning-800;
}

.status-error {
  @apply bg-error-100 text-error-800;
}

.status-processing {
  @apply bg-primary-100 text-primary-800;
}

/* Animation utilities */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

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

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

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

.animate-fade-out {
  animation: fadeOut 0.3s ease-in-out;
}

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

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

.animate-pulse-slow {
  animation: pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Print styles */
@media print {
  .no-print {
    display: none !important;
  }
  
  .print-only {
    display: block !important;
  }
  
  body {
    @apply text-black bg-white;
  }
  
  .card {
    @apply border border-gray-400;
  }
}

/* Dark mode support (future enhancement) */
@media (prefers-color-scheme: dark) {
  .dark-mode-auto {
    /* Dark mode styles will be added here */
  }
}

/* Responsive utilities */
@media (max-width: 640px) {
  .table {
    @apply text-xs;
  }
  
  .card-body {
    @apply px-4 py-3;
  }
  
  .btn {
    @apply text-xs px-3 py-1.5;
  }
}

/* Accessibility improvements */
.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;
}

.focus-visible:focus {
  @apply outline-none ring-2 ring-primary-500 ring-offset-2;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .btn {
    @apply border-2;
  }
  
  .card {
    @apply border-2;
  }
  
  .form-input, .form-select, .form-textarea {
    @apply border-2;
  }
}