/**
 * FinanzFix Assistent Styles
 * =========================
 * Custom styles and Tailwind overrides
 */

/* Basis-Styling */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #22c55e;
  --warning: #eab308;
  --error: #ef4444;
  --text-primary: #111827;
  --text-secondary: #4b5563;
}

/* Accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary);
  color: white;
  padding: 8px;
  z-index: 100;
  -webkit-transition: top 0.2s;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 0;
}

/* Animationen */
@-webkit-keyframes slideIn {
  from {
    -webkit-transform: translateY(100%);
            transform: translateY(100%);
    opacity: 0;
  }
  to {
    -webkit-transform: translateY(0);
            transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    -webkit-transform: translateY(100%);
            transform: translateY(100%);
    opacity: 0;
  }
  to {
    -webkit-transform: translateY(0);
            transform: translateY(0);
    opacity: 1;
  }
}

@-webkit-keyframes slideOut {
  from {
    -webkit-transform: translateY(0);
            transform: translateY(0);
    opacity: 1;
  }
  to {
    -webkit-transform: translateY(100%);
            transform: translateY(100%);
    opacity: 0;
  }
}

@keyframes slideOut {
  from {
    -webkit-transform: translateY(0);
            transform: translateY(0);
    opacity: 1;
  }
  to {
    -webkit-transform: translateY(100%);
            transform: translateY(100%);
    opacity: 0;
  }
}

/* Toast-Animationen */
.toast {
  -webkit-animation: slideIn 0.3s ease-out forwards;
          animation: slideIn 0.3s ease-out forwards;
}

.toast.hiding {
  -webkit-animation: slideOut 0.3s ease-in forwards;
          animation: slideOut 0.3s ease-in forwards;
}

/* Modal-Animationen */
.modal {
  -webkit-animation: fadeIn 0.2s ease-out;
          animation: fadeIn 0.2s ease-out;
}

.modal.hiding {
  -webkit-animation: fadeOut 0.2s ease-in;
          animation: fadeOut 0.2s ease-in;
}

@-webkit-keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@-webkit-keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* Form Controls */
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  -webkit-box-shadow: 0 0 0 2px var(--primary);
          box-shadow: 0 0 0 2px var(--primary);
  border-color: var(--primary);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}

/* Firefox Scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: #c1c1c1 #f1f1f1;
}

/* Loading States */
.loading {
  position: relative;
  pointer-events: none;
}

.loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.7);
  -webkit-backdrop-filter: blur(2px);
          backdrop-filter: blur(2px);
}

/* Responsive Design Helpers */
@media (max-width: 640px) {
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* Print Styles */
@media print {
  .no-print {
    display: none !important;
  }
  
  body {
    background: white;
  }
  
  main {
    margin: 0;
    padding: 1cm;
  }

  @page {
    margin: 0.5cm;
  }
}

/* Offline Mode */
body.offline .online-only {
  display: none;
}

/* Status Badges */
.badge {
  display: -webkit-inline-flex;
  display: inline-flex;
  -webkit-align-items: center;
          align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-success {
  background-color: #dcfce7;
  color: #166534;
}

.badge-warning {
  background-color: #fef9c3;
  color: #854d0e;
}

.badge-error {
  background-color: #fee2e2;
  color: #991b1b;
}

.badge-info {
  background-color: #dbeafe;
  color: #1e40af;
}

/* Help Tooltips */
.tooltip {
  position: relative;
}

.tooltip:hover::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  -webkit-transform: translateX(-50%);
          transform: translateX(-50%);
  padding: 0.5rem;
  background: #1f2937;
  color: white;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  white-space: nowrap;
  z-index: 50;
}

/* Focus Styles */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Mobile Navigation Fix */
.md\:hidden {
  padding-bottom: env(safe-area-inset-bottom);
}

/* iOS Specific Fixes */
@supports (-webkit-touch-callout: none) {
  .modal {
    padding-bottom: env(safe-area-inset-bottom);
  }

  input,
  textarea,
  select {
    font-size: 16px; /* Prevents zoom on focus */
  }
}

/* High Contrast Mode */
@media (forced-colors: active) {
  .badge {
    border: 1px solid currentColor;
  }
  
  .form-group input:focus,
  .form-group select:focus,
  .form-group textarea:focus {
    outline: 2px solid currentColor;
  }
}
