/**
 * Kinky Circle - Dark Mode Core CSS
 * Version: 1.0.0
 * Date: 2026-01-28
 *
 * ERZWINGT Dark Mode für alle User - Konsistentes Design auf allen Geräten
 * Enthält iOS/Safari Optimierungen für bessere Sichtbarkeit
 *
 * WICHTIG: Dieses CSS ändert NICHT die Farben!
 * - Erzwingt nur Dark Mode Rendering
 * - Verbessert Schrift-Darstellung auf iOS
 * - Optimiert scroll-Verhalten
 *
 * IN ALLEN NEUEN HTML-DATEIEN EINBINDEN:
 * <link rel="stylesheet" href="/css/core/dark-mode.css">
 */

/* =====================================================
* DARK MODE ERZWINGEN
* =====================================================*/

/* Erzwingt Dark Mode für alle Browser/Geräte */
:root {
    color-scheme: dark;
}

/* Verhindert, dass Browser eigene Hell/Dunkel-Anpassungen machen */
html {
    color-scheme: dark;
}

/* =====================================================
* IOS/SAFARI OPTIMIERUNGEN
* Verbessert rendering ohne Farben zu ändern
* =====================================================*/

/* Smooth font rendering auf allen Geräten */
html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Verhindert automatische Text-Vergrößerung bei Drehung auf iOS */
html {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Sanfteres Scrollen auf iOS-Geräten */
* {
    -webkit-overflow-scrolling: touch;
}

/* Bessere Touch-Target Größe auf mobilen Geräten */
button, a, input, select, textarea {
    min-height: 44px;
    min-width: 44px;
}

/* Verhindert Tap-Highlight auf iOS */
* {
    -webkit-tap-highlight-color: transparent;
}

/* =====================================================
* SCROLLBAR OPTIMIERUNGEN
* =====================================================*/

/* Custom Scrollbar - Chrome, Safari, Edge */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color, #DC143C);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-hover, #a40000);
}

/* Firefox Scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color, #DC143C) #1a1a1a;
}

/* =====================================================
* FOCUS ZUSTÄNDE
* Bessere Sichtbarkeit für Keyboard-Navigation
* =====================================================*/

/* Focus sichtbar machen für Accessibility */
:focus-visible {
    outline: 2px solid var(--primary-color, #DC143C);
    outline-offset: 2px;
}

/* Button Focus */
button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--primary-color, #DC143C);
    outline-offset: 2px;
}

/* =====================================================
* FORMULAR-ELEMENTE OPTIMIERUNGEN
* =====================================================*/

/* Bessere Darstellung von Formular-Elementen */
input, select, textarea {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* iOS Select Dropdown optimieren */
select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
}

/* =====================================================
* GESTENSOPTIMIERUNGEN
* =====================================================*/

/* Verhindert Zoom auf iOS bei Input-Fokus */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
textarea {
    font-size: 16px;
}

/* =====================================================
* PERFORMANCE OPTIMIERUNGEN
* =====================================================*/

/* Hardware-Beschleunigung nur für animierte Elemente */
/* ACHTUNG: Nicht auf alle Elemente anwenden (Memory-Probleme auf Mobile) */
@media (prefers-reduced-motion: no-preference) {
    .animated, .slider, .modal, .toast, .dropdown-menu,
    [class*="transition"], [class*="animate"] {
        backface-visibility: hidden;
        transform: translateZ(0);
    }
}

/* Reduced Motion für User-Präferenz */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* =====================================================
* DASHBOARD BUTTON STYLES
* =====================================================*/

/* Feedback and action buttons in registration list */
.feedback-btn,
.open-details-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.feedback-btn {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #1a1a1a;
}

.feedback-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

.feedback-btn.no-show-feedback {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    color: white;
}

.open-details-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.open-details-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.open-details-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
    border-color: rgba(76, 175, 80, 0.3);
}

/* =====================================================
* PLATZHALTER FÜR SEITENSPEZIFISCHES CSS
* =====================================================*/

/*
HINWEIS: Neue Seiten müssen ihre Farben und Styles selbst definieren!

Dieses CSS enthält:
✅ Dark Mode erzwingen
✅ iOS/Safari Rendering-Verbesserungen
✅ Scrollbar-Optimierungen
✅ Accessibility-Verbesserungen
✅ Loading States (F2)
✅ Error Boundaries (F3)
✅ Responsive Design Utilities (F4)
✅ Accessibility Utilities (F5)

Dieses CSS enthält NICHT:
❌ Farbschemata (jede Seite definiert eigene Farben)
❌ Layout-spezifisches CSS
*/

/* =====================================================
 * F2: LOADING STATES
 * =====================================================*/

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    color: var(--text-secondary, #9ca3af);
}

.loading-state .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(220, 20, 60, 0.2);
    border-top-color: #dc143c;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.loading-state .loading-message {
    font-size: 0.95rem;
    margin: 0;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state .empty-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary, #fff);
    margin: 0 0 0.5rem 0;
}

.empty-state .empty-description {
    font-size: 0.9rem;
    color: var(--text-secondary, #9ca3af);
    margin: 0;
}

/* =====================================================
 * F3: ERROR BOUNDARIES
 * =====================================================*/

.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    text-align: center;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    margin: 1rem 0;
}

.error-state .error-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.error-state .error-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #ef4444;
    margin: 0 0 0.5rem 0;
}

.error-state .error-message {
    font-size: 0.9rem;
    color: var(--text-secondary, #9ca3af);
    margin: 0 0 1rem 0;
}

.error-state .btn-retry {
    padding: 0.625rem 1.25rem;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: #ef4444;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.error-state .btn-retry:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

.toast {
    padding: 0.875rem 1.25rem;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
    transition: all 0.3s ease;
    max-width: 350px;
}

.toast-success {
    background: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.toast-error {
    background: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.toast-warning {
    background: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.toast-info {
    background: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* =====================================================
 * F4: RESPONSIVE DESIGN UTILITIES
 * =====================================================*/

/* Hide on mobile */
.hide-mobile {
    display: none !important;
}

@media (min-width: 768px) {
    .hide-mobile {
        display: block !important;
    }
    
    .show-mobile {
        display: none !important;
    }
}

/* Responsive grid */
.responsive-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 640px) {
    .responsive-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .responsive-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Responsive flex wrap */
.flex-wrap-responsive {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* Container padding */
.container-responsive {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 768px) {
    .container-responsive {
        padding: 0 1.5rem;
    }
}

@media (min-width: 1024px) {
    .container-responsive {
        padding: 0 2rem;
    }
}

/* =====================================================
 * F5: ACCESSIBILITY UTILITIES
 * =====================================================*/

/* Screen reader only */
.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 styles */
*:focus-visible {
    outline: 2px solid #dc143c;
    outline-offset: 2px;
}

/* Skip to main content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #dc143c;
    color: #fff;
    padding: 0.5rem 1rem;
    z-index: 10000;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .toast {
        border-width: 2px;
    }
    
    *:focus-visible {
        outline-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .spinner {
        animation: none;
        border: 3px dashed rgba(220, 20, 60, 0.5);
    }
}
