/* Base Styles */
[x-cloak] {
    display: none !important;
}

.dark {
    color-scheme: dark;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Smooth Transitions */
* {
    transition: background-color 0.2s ease;
}

/* Dark Mode Adjustments */
body.dark {
    background-color: #111827;
    color: #f9fafb;
}

body.dark #sidebar {
    background-color: #1f2937;
    border-color: #374151;
}

/* Weiße Hintergründe werden dunkler */
body.dark .bg-white {
    background-color: #1f2937 !important;
}

/* Graue Text wird heller */
body.dark .text-gray-600 {
    color: #d1d5db !important;
}

body.dark .text-gray-700 {
    color: #e5e7eb !important;
}

body.dark .text-gray-500 {
    color: #9ca3af !important;
}

body.dark .text-gray-900 {
    color: #f9fafb !important;
}

/* Rahmen */
body.dark .border-gray-200 {
    border-color: #374151 !important;
}

body.dark .border-gray-300 {
    border-color: #4b5563 !important;
}

/* Hintergründe */
body.dark .bg-gray-50 {
    background-color: #374151 !important;
}

body.dark .bg-gray-100 {
    background-color: #4b5563 !important;
    color: #f9fafb !important;
}

body.dark .bg-gray-200 {
    background-color: #6b7280 !important;
    color: #f9fafb !important;
}

/* Eingabefelder */
body.dark input,
body.dark select,
body.dark textarea {
    background-color: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

body.dark input::placeholder,
body.dark textarea::placeholder {
    color: #9ca3af;
}

/* Artikel-Karten und ähnliche Elemente */
body.dark .article-card,
body.dark .household-card,
body.dark .recipe-card {
    background-color: #1f2937 !important;
    border-color: #374151 !important;
}

/* Buttons */
body.dark button:not(.bg-blue-500):not(.bg-green-500):not(.bg-red-500) {
    color: #f9fafb;
}

/* Modal Hintergründe */
body.dark .modal-content {
    background-color: #1f2937 !important;
}

/* Shopping Mode Kategorien */
body.dark .category-box {
    background-color: #1f2937 !important;
    border-color: #374151 !important;
}

/* Tags und Badges */
body.dark .bg-orange-100 {
    background-color: #7c2d12 !important;
    color: #fed7aa !important;
}

body.dark .bg-purple-100 {
    background-color: #581c87 !important;
    color: #e9d5ff !important;
}

body.dark .bg-blue-100 {
    background-color: #1e3a8a !important;
    color: #bfdbfe !important;
}

body.dark .bg-green-100 {
    background-color: #14532d !important;
    color: #bbf7d0 !important;
}

body.dark .bg-amber-50 {
    background-color: #78350f !important;
    color: #fef3c7 !important;
}

body.dark .bg-blue-50 {
    background-color: #1e3a8a !important;
    color: #dbeafe !important;
}
/* Shopping Mode Styling */
#shopping-mode-overlay {
    animation: slideUp 0.3s ease-out;
}

/* Backup-Boxen im Dark Mode */
body.dark .bg-blue-50 {
    background-color: #1e3a8a !important;
    color: #dbeafe !important;
}

body.dark .text-blue-800,
body.dark .text-blue-900 {
    color: #dbeafe !important;
}

body.dark .border-blue-200 {
    border-color: #1e40af !important;
}

body.dark .bg-amber-50 {
    background-color: #78350f !important;
    color: #fef3c7 !important;
}

body.dark .text-amber-800,
body.dark .text-amber-900 {
    color: #fef3c7 !important;
}

body.dark .border-amber-200 {
    border-color: #92400e !important;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.category-box {
    transition: all 0.3s ease;
}

.category-box:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Indeterminate Checkbox Styling */
input[type="checkbox"].indeterminate {
    background-color: #fb923c;
    border-color: #fb923c;
}

input[type="checkbox"].indeterminate::after {
    content: '−';
    display: block;
    text-align: center;
    color: white;
    font-weight: bold;
}

/* Responsive Grid für Kategorien */
@media (max-width: 768px) {
    .grid-cols-1.md\:grid-cols-2 {
        grid-template-columns: 1fr !important;
    }
}

/* Smooth Transitions */
.transition-all {
    transition: all 0.2s ease;
}

/* Progress Bar Animation */
#shopping-progress-bar {
    transition: width 0.5s ease-in-out;
}

/* ===================================
   MOBILE OPTIMIERUNGEN
   =================================== */

/* Modal Container - verhindert horizontales Scrollen */
#modal-container {
    max-width: 100vw;
    overflow-x: hidden;
}

.modal-overlay {
    overflow-x: hidden;
}

.modal-content {
    max-width: 95vw !important;
    margin: 0 auto;
}

/* Rezept-Modal speziell */
@media (max-width: 768px) {
    .modal-pane {
        max-width: 100vw !important;
        width: 100% !important;
        height: 100vh !important;
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
        display: flex;
        flex-direction: column;
        overflow-y: hidden; /* Scrollen erfolgt im Content-Bereich */
    }

    .modal-content {
        flex: 1;
        overflow-y: auto;
        margin-bottom: 1rem;
    }

    .modal-actions {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    .modal-actions button {
        width: 100% !important;
        flex: none !important;
        white-space: nowrap; /* Verhindert hässliche Zeilenumbrüche im Button */
    }

    /* Responsive Grid für Rezept-Schritte */
    .grid.grid-cols-2,
    .grid.grid-cols-3,
    .grid.md\:grid-cols-2,
    .grid.md\:grid-cols-3 {
        grid-template-columns: 1fr !important;
    }

    /* Inputs und Selects auf volle Breite */
    .modal-content input,
    .modal-content select,
    .modal-content textarea {
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Buttons nebeneinander wenn Platz */
    .flex.gap-2 {
        flex-wrap: wrap;
    }
}

/* Artikel-Karten kompakter */
.article-card {
    min-height: auto;
}

.article-card h3 {
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Touch-Optimierung */
@media (hover: none) and (pointer: coarse) {
    button,
    .clickable {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Responsive Padding für Main Content */
@media (max-width: 640px) {
    #main-content {
        padding: 1rem !important;
        padding-top: 5rem !important;
    }
}

/* Rezept-Modal Mobile Optimierungen */
@media (max-width: 768px) {
    /* Größere Schrift und Padding */
    .modal-content {
        font-size: 16px !important; /* Verhindert Auto-Zoom auf iOS */
    }

    .modal-content input,
    .modal-content select,
    .modal-content textarea {
        font-size: 16px !important;
        padding: 12px !important;
        min-height: 44px; /* Touch-freundlich */
    }

    .modal-content button {
        padding: 12px 16px !important;
        min-height: 44px;
        font-size: 16px !important;
    }

    /* Labels größer und besser sichtbar */
    .modal-content label {
        font-size: 14px !important;
        font-weight: 600;
        margin-bottom: 8px !important;
    }

    /* Zutaten-Rows: Volle Breite auf Mobile */
    #ingredients-container > div {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    #ingredients-container input,
    #ingredients-container select {
        width: 100% !important;
    }

    /* Rezept-Schritte größer */
    #steps-container textarea {
        min-height: 100px !important;
    }

    /* Mehr Abstand zwischen Elementen */
    .modal-content .space-y-4 > * {
        margin-bottom: 24px !important;
    }
}
/* ===================================
   DRAG & DROP STYLING - VERBESSERT
   =================================== */

.category-order-item {
    transition: all 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    touch-action: none; /* Wichtig für Touch */
}

.category-order-item:hover {
    transform: translateX(4px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.category-order-item[draggable="true"] {
    cursor: move;
    cursor: grab;
}

.category-order-item:active {
    cursor: grabbing;
    cursor: -webkit-grabbing;
}

/* Drag-Feedback */
.category-order-item.dragging {
    opacity: 0.4;
    transform: scale(1.02);
}

.category-order-item.drag-over {
    border-color: #3b82f6 !important;
    background-color: #dbeafe !important;
}

/* Dark Mode für Drag & Drop */
body.dark .category-order-item {
    background-color: #374151 !important;
    border-color: #4b5563 !important;
}

body.dark .category-order-item:hover {
    background-color: #4b5563 !important;
}

body.dark .category-order-item.drag-over {
    background-color: #1e3a8a !important;
    border-color: #3b82f6 !important;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slide-up {
    animation: slideUp 0.3s ease-out;
}

#custom-toast {
    transition: all 0.3s ease;
}

/* Supermarkt-Auswahl Buttons */
.supermarket-option {
    text-align: left;
}

.supermarket-option:active {
    transform: scale(0.98);
}

/* Dark Mode für Toast */
body.dark #custom-toast {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}
