/* Klostergut Development CSS */

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

/* Custom Styles */
.btn-klostergut {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.btn-klostergut:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(217, 119, 6, 0.3);
}

.card-klostergut {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    border: 2px solid #fbbf24;
}

/* Animations */
@keyframes bounce-subtle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.horse-icon {
    animation: bounce-subtle 3s ease-in-out infinite;
}

/* Table Container Styles - Admin-like responsive table */
.table-container {
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.table-container table {
    border-collapse: separate;
    border-spacing: 0;
}

.table-container thead tr th:first-child {
    border-top-left-radius: 0.5rem;
}

.table-container thead tr th:last-child {
    border-top-right-radius: 0.5rem;
}

.table-container tbody tr:last-child td:first-child {
    border-bottom-left-radius: 0.5rem;
}

.table-container tbody tr:last-child td:last-child {
    border-bottom-right-radius: 0.5rem;
}

/* Zebra stripes for better readability */
.table-container tbody tr:nth-child(even) {
    background-color: #f9fafb;
}

.table-container tbody tr:nth-child(odd) {
    background-color: #ffffff;
}

/* Improved hover effects */
.table-container tbody tr:hover {
    background-color: #f3f4f6 !important;
    transform: scale(1.001);
    transition: all 0.15s ease-in-out;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .btn-mobile {
        font-size: 1.125rem;
        padding: 1rem 1.5rem;
        min-height: 3rem;
    }
}

/* Focus states for better accessibility */
input:focus,
select:focus,
textarea:focus,
button:focus {
    outline: 3px solid #fbbf24;
    outline-offset: 2px;
}

/* Success/Error states */
.success {
    background-color: #dcfce7;
    border-color: #16a34a;
    color: #15803d;
}

.error {
    background-color: #fef2f2;
    border-color: #dc2626;
    color: #dc2626;
}

/* === MOBILE OPTIMIERUNGEN === */

/* Touch-friendly Buttons */
@media (max-width: 768px) {
  .btn-mobile {
    min-height: 48px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    touch-action: manipulation;
  }
  
  /* Größere Click-Areas */
  .nav-link {
    min-height: 44px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
  }
  
  /* Input Fields */
  input[type="text"],
  input[type="password"],
  input[type="email"],
  input[type="date"],
  select,
  textarea {
    font-size: 16px !important; /* Verhindert Zoom auf iOS */
    min-height: 48px;
    padding: 0.75rem;
  }
  
  /* Container Padding */
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  /* Modal für Mobile */
  .modal-mobile {
    margin: 0.5rem;
    max-height: calc(100vh - 1rem);
    overflow-y: auto;
  }
  
  /* Table Scroll */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  table {
    min-width: 600px;
  }
  
  /* Card Stacking */
  .card-stack {
    margin-bottom: 1rem;
  }
  
  /* Hide Decorative Elements on Small Screens */
  .hide-mobile {
    display: none !important;
  }
  
  /* Larger Tap Targets */
  .tap-target {
    min-width: 44px;
    min-height: 44px;
  }
  
  /* Calendar Mobile */
  .calendar-day {
    min-height: 80px;
    font-size: 0.75rem;
  }
  
  .plus-button-mobile {
    width: 2.5rem;
    height: 2.5rem;
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
  }
  
  /* Service Cards Mobile */
  .service-card-mobile {
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    border-radius: 0.5rem;
  }
  
  /* Form Layout Mobile */
  .form-mobile {
    space-y: 1rem;
  }
  
  .form-mobile label {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
  }
  
  /* Navbar Mobile */
  .navbar-mobile {
    padding: 0.75rem 1rem;
  }
  
  .navbar-mobile .logo {
    font-size: 1.5rem;
  }
  
  /* Footer Mobile */
  .footer-mobile {
    padding: 1rem;
    text-align: center;
  }
  
  /* Sticky Footer für Mobile */
  .sticky-mobile-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e5e7eb;
    padding: 0.75rem 1rem;
    z-index: 40;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  }
  
  /* Safe Area für iPhone */
  .safe-area-bottom {
    padding-bottom: env(safe-area-inset-bottom);
  }
  
  /* Horizontal Scroll */
  .scroll-x {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  
  .scroll-x::-webkit-scrollbar {
    display: none;
  }
}

/* Touch Optimierungen */
@media (hover: none) and (pointer: coarse) {
  /* Touch-Geräte */
  .hover\:scale-105:hover {
    transform: none;
  }
  
  .user-card:active {
    transform: scale(0.98);
    transition: transform 0.1s;
  }
  
  button:active {
    transform: scale(0.98);
  }
  
  .tap-feedback:active {
    background-color: rgba(0, 0, 0, 0.1);
  }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .landscape-adjust {
    height: 100vh;
    overflow-y: auto;
  }
  
  .modal-landscape {
    max-height: 90vh;
    overflow-y: auto;
  }
}

/* Very Small Screens */
@media (max-width: 375px) {
  .text-xs-mobile {
    font-size: 0.75rem;
  }
  
  .p-xs-mobile {
    padding: 0.5rem;
  }
  
  .container-xs {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .crisp-text {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

/* === MOBILE TOUCH SCROLLING OPTIMIERUNGEN === */

/* Table Container f\u00fcr Touch-Scrolling */
.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE 11+ */
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.table-container::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

/* Smooth Scrolling f\u00fcr Touch-Ger\u00e4te */
.table-container table {
  min-width: 600px;
  scroll-behavior: smooth;
}

/* Touch-freundliche Scrollbalken auf Mobile */
@media (max-width: 768px) {
  .table-container {
    scrollbar-width: thin;
    scrollbar-color: rgba(156, 163, 175, 0.5) transparent;
  }
  
  .table-container::-webkit-scrollbar {
    display: block;
    height: 4px;
  }
  
  .table-container::-webkit-scrollbar-track {
    background: transparent;
  }
  
  .table-container::-webkit-scrollbar-thumb {
    background: rgba(156, 163, 175, 0.5);
    border-radius: 2px;
  }
  
  .table-container::-webkit-scrollbar-thumb:hover {
    background: rgba(156, 163, 175, 0.8);
  }
}

/* Modal Optimierungen f\u00fcr kleine Bildschirme */
@media (max-height: 600px) {
  .modal-content {
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1rem;
  }
  
  .modal-content .space-y-4 > * {
    margin-bottom: 1rem;
  }
  
  /* Kompaktere Form-Elemente f\u00fcr kleine H\u00f6he */
  .modal-content textarea {
    rows: 3;
    max-height: 120px;
  }
  
  .modal-content .p-3 {
    padding: 0.5rem;
  }
}

/* Modal Touch-Scrolling f\u00fcr alle Bildschirmgr\u00f6\u00dfen */
.modal-content {
  overscroll-behavior: contain;
}

@media (max-width: 640px) {
  /* Service Modal vollst\u00e4ndig f\u00fcr Mobile anpassen */
  #serviceModal .relative {
    margin: 0.5rem;
    width: calc(100% - 1rem);
    max-width: none;
    top: 0;
    transform: none;
  }
  
  #serviceModal .modal-content,
  #serviceModal .relative > div {
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Horizontale Touch-Scroll-Indikatoren */
.table-container::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 20px;
  height: 100%;
  background: linear-gradient(to left, rgba(255,255,255,0.8), transparent);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.table-container.scrollable::before {
  opacity: 1;
}

/* JavaScript wird benötigt um scrollable Klasse hinzuzufügen */

/* Touch-Scroll Helper für Textareas */
.touch-scroll {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Responsive Modal-Anpassungen */
@media (max-width: 480px) {
  #serviceModal .relative {
    margin: 0.25rem;
    width: calc(100% - 0.5rem);
  }
  
  #serviceModal .modal-content {
    padding: 1rem;
  }
  
  /* Kompaktere Buttons auf sehr kleinen Bildschirmen */
  #serviceModal button {
    font-size: 0.875rem;
    padding: 0.625rem 1rem;
  }
  
  /* Kleinere Input-Felder */
  #serviceModal input,
  #serviceModal select,
  #serviceModal textarea {
    font-size: 16px; /* Verhindert Zoom auf iOS */
    padding: 0.625rem;
  }
}

/* Landscape Optimierung für Tablets im Querformat */
@media (max-height: 500px) and (min-width: 640px) {
  #serviceModal .relative {
    top: 1rem;
    max-height: calc(100vh - 2rem);
  }
  
  #serviceModal .modal-content {
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
  }
}

/* === HORSE TABLE SORTING STYLES === */

/* Sortierbare Table Headers */
th[data-sort-type] {
  transition: background-color 0.2s ease, color 0.2s ease;
  position: relative;
}

th[data-sort-type]:hover {
  background-color: #f9fafb !important;
}

th[data-sort-type]:focus {
  background-color: #f3f4f6 !important;
  outline: 2px solid #fbbf24;
  outline-offset: -2px;
}

/* Sort-Indikatoren Animation */
.sort-indicators svg {
  transition: all 0.3s ease;
}

.sort-indicators .sort-up.text-amber-600,
.sort-indicators .sort-down.text-amber-600 {
  transform: scale(1.2);
  filter: drop-shadow(0 1px 2px rgba(251, 191, 36, 0.3));
}

/* Aktive Sortier-Spalte */
th.bg-amber-50 {
  background-color: #fffbeb !important;
  border-bottom: 2px solid #fbbf24;
}

/* Mobile Sort Dropdown */
#mobile-sort-select {
  min-width: 140px;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: 2.5rem;
}

#mobile-sort-select:focus {
  ring-color: #fbbf24;
  border-color: #fbbf24;
}

/* Table Row Hover Effects */
tbody tr {
  transition: background-color 0.2s ease;
}

tbody tr:hover {
  background-color: #fefce8 !important;
}

/* Sortier-Animation für Tabellenzeilen */
tbody[style*="opacity"] {
  transition: opacity 0.3s ease;
}

/* Responsive Table Improvements */
@media (max-width: 768px) {
  .table-container {
    border-radius: 0.75rem;
  }
  
  /* Mobile Sort Header Spacing */
  #mobile-sort-select {
    font-size: 0.875rem;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
  }
}
