/* Reset und Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    color-scheme: light dark;

    /* Farben */
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #6b7280;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    
    /* Grautöne */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* Schatten */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    /* Übersichtlich */
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --transition: all 0.2s ease-in-out;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--gray-700);
    line-height: 1.6;
}

/* Avatar Styles - Kompatibilität */
.user-avatar {
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.user-avatar-fallback {
    font-size: 0.7em;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Icon Styles */
.user-icon {
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 8px;
    vertical-align: middle;
    border: 2px solid rgba(255,255,255,0.3);
}

.user-icon-fallback {
    border-radius: 50%;
    background: #95a5a6;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 8px;
    vertical-align: middle;
    color: white;
}

.user-display {
    display: inline-flex;
    align-items: center;
}

.user-name {
    font-weight: 500;
}

/* Navigation */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Authentifizierung */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 80px);
    padding: 2rem;
}

.auth-card {
    background: white;
    padding: 3rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--gray-200);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h2 {
    color: var(--gray-900);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--gray-600);
    font-size: 0.9rem;
}

#authSubmitBtn{margin-top: 15px;}

/* Hauptbereich */
.main-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    gap: 2rem;
}

/* Artikel hinzufügen Sektion */
.add-item-section {
    margin-bottom: 1rem;
}

.add-item-card {
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.add-item-toggle {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
    text-align: left;
}

.add-item-toggle:hover {
    background: var(--gray-50);
}

.add-item-toggle .toggle-arrow {
    font-size: 0.75rem;
    transition: transform 0.25s ease;
    color: var(--gray-500);
}

.add-item-toggle[aria-expanded="true"] .toggle-arrow {
    transform: rotate(180deg);
}

.add-form-body {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows 0.25s ease;
    padding: 0 1.5rem;
}

.add-form-body.collapsed {
    grid-template-rows: 0fr;
}

.add-form-body > form {
    overflow: hidden;
    padding-bottom: 0;
    transition: padding-bottom 0.25s ease;
}

.add-item-toggle[aria-expanded="true"] + .add-form-body > form {
    padding-bottom: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

.form-group label {
    font-weight: 500;
    color: var(--gray-700);
    margin: 0.5rem 0 .2rem;
    font-size: 0.9rem;
}

.form-input {
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
    background: white;
    color: var(--gray-900);
    width: 100%;
}

.form-input::placeholder {
    color: var(--gray-400);
    opacity: 1;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Autofill-Stile für Webkit/Chrome/iOS – verhindert weiße Schrift auf weißem Hintergrund */
.form-input:-webkit-autofill,
.form-input:-webkit-autofill:hover,
.form-input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--gray-900);
    -webkit-box-shadow: 0 0 0px 1000px white inset;
    box-shadow: 0 0 0px 1000px white inset;
}

[data-theme="dark"] .form-input:-webkit-autofill,
[data-theme="dark"] .form-input:-webkit-autofill:hover,
[data-theme="dark"] .form-input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--gray-900);
    -webkit-box-shadow: 0 0 0px 1000px var(--gray-50) inset;
    box-shadow: 0 0 0px 1000px var(--gray-50) inset;
}

/* Autocomplete */
.autocomplete-container {
    position: relative;
}

.voice-group {
    flex: 0 0 auto;
}

.voice-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.voice-lang-btn {
    font-size: 1rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.2s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.voice-lang-btn:hover,
.voice-lang-btn:active {
    opacity: 1;
    transform: scale(1.15);
}

.voice-input-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    width: 4rem;
    height: 46px;
    background: var(--gray-100);
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1.3rem;
    padding: 0.25rem;
    transition: background 0.2s, border-color 0.2s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.voice-label {
    font-size: 0.6rem;
    color: var(--gray-500);
    font-weight: 500;
    line-height: 1;
}

.voice-input-btn:hover,
.voice-input-btn:active {
    background: var(--gray-200);
    border-color: var(--gray-400);
    transform: scale(0.97);
}

.voice-input-btn.listening {
    background: rgba(239,68,68,0.1);
    border-color: rgb(239,68,68);
    animation: pulse-mic 1s infinite;
}

.voice-input-btn.listening .voice-label {
    color: rgb(239,68,68);
}

@keyframes pulse-mic {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
    50%       { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid var(--gray-200);
    border-top: none;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
    box-shadow: var(--shadow-md);
}

.autocomplete-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--gray-100);
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background: var(--gray-50);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-kategorie {
    font-size: 0.8rem;
    color: var(--gray-500);
    background: var(--gray-100);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-300);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn-full {
    width: 100%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Shopping List */
.shopping-list-section {
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    overflow: hidden;
    min-height: 430px;
}

.shopping-list-header {
    padding: 2rem 2rem 1rem 2rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.shopping-list-header h3 {
    color: var(--gray-900);
    font-weight: 600;
}

.list-filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.list-filter label {
    font-weight: 500;
    color: var(--gray-600);
    white-space: nowrap;
}

.filter-select {
    min-width: 150px;
}

/* Custom Filter Dropdown mit Icon-Support */
.custom-filter-dropdown {
    position: relative;
    min-width: 180px;
}

.custom-filter-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--gray-800);
    text-align: left;
    transition: border-color 0.2s;
}

.custom-filter-selected:hover,
.custom-filter-dropdown.open .custom-filter-selected {
    border-color: var(--primary);
    outline: none;
}

.filter-arrow {
    font-size: 0.7rem;
    color: var(--gray-500);
    transition: transform 0.2s;
    flex-shrink: 0;
}

.custom-filter-dropdown.open .filter-arrow {
    transform: rotate(180deg);
}

.custom-filter-options {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    z-index: 1000;
    overflow: hidden;
    background: #fff;
}

.custom-filter-dropdown.open .custom-filter-options {
    display: block;
}

.custom-filter-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--gray-800);
    transition: background 0.15s;
}

.custom-filter-option:hover {
    background: var(--gray-100);
}

.custom-filter-option.active {
    background: var(--primary-light, #eef2ff);
    color: var(--primary);
    font-weight: 500;
}

.list-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--gray-600);
}

.shopping-list {
    padding: 1rem;
}

.artikel-item {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    background: var(--gray-50);
    transition: var(--transition);
}

.artikel-item:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.artikel-item.erledigt {
    opacity: 0.7;
    background: var(--gray-100);
}

.artikel-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.artikel-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.artikel-name {
    font-weight: 500;
    color: var(--gray-900);
}

.artikel-item.erledigt .artikel-name {
    text-decoration: line-through;
    color: var(--gray-500);
}

.artikel-details {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--gray-600);
}

.artikel-kategorie,
.artikel-menge {
    background: var(--gray-200);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.artikel-meta {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.artikel-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    padding: 0.5rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.edit-btn {
    /* background: var(--warning-color); */
    color: white;
}

.delete-btn {
    /* background: var(--danger-color); */
    color: white;
}

.action-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-state h4 {
    color: var(--gray-700);
    margin-bottom: 1rem;
}

.empty-state p {
    color: var(--gray-500);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--gray-200);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-500);
}

.modal-form {
    padding: 2rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.modal-description {
    margin-bottom: 1.5rem;
    color: var(--gray-600);
    line-height: 1.5;
}

/* Reset User Info */
.reset-user-info {
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    border: 1px solid var(--gray-200);
}

.reset-user-info p {
    margin: 0;
    color: var(--gray-700);
}

/* Passwort Stärke Indikator */
.password-strength {
    margin-top: 0.5rem;
}

.password-strength-bar {
    height: 4px;
    border-radius: 2px;
    background: var(--gray-200);
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.password-strength-fill {
    height: 100%;
    transition: var(--transition);
    border-radius: 2px;
}

.password-strength-weak .password-strength-fill {
    width: 33%;
    background: var(--danger-color);
}

.password-strength-medium .password-strength-fill {
    width: 66%;
    background: var(--warning-color);
}

.password-strength-strong .password-strength-fill {
    width: 100%;
    background: var(--success-color);
}

.password-strength-text {
    font-size: 0.8rem;
    color: var(--gray-500);
}

/* Auth Switch */
.auth-switch {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--gray-200);
}

.auth-switch a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* Passwort vergessen Link */
.auth-forgot-password {
    text-align: center;
    margin-top: 1rem;
}

.auth-forgot-password a {
    color: var(--gray-600);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
}

.auth-forgot-password a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Icon-Auswahl */
.icon-auswahl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin: 20px 0;
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
}

.icon-option {
    padding: 15px;
    border: 2px solid var(--gray-300);
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    background: white;
}

.icon-option:hover {
    border-color: var(--primary-color);
    background-color: #f8f9fa;
}

.icon-option.selected {
    border-color: var(--primary-color);
    background-color: #e7f3ff;
}

.icon-preview {
    margin: 0 auto 8px;
}

.icon-label {
    font-size: 12px;
    color: var(--gray-600);
    font-weight: 500;
}

.icon-option.selected .icon-label {
    color: var(--primary-color);
    font-weight: 600;
}

/* Avatar-Auswahl - Legacy */
.avatar-auswahl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 15px;
    margin-top: 10px;
    padding: 15px;
    background: var(--gray-100);
    border-radius: 8px;
}

.avatar-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.avatar-option:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.15);
}

.avatar-option.selected {
    border-color: var(--primary-color);
    background: rgb(0, 123, 255, 0.1);
}

.avatar-preview {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin-bottom: 8px;
}

.avatar-label {
    font-size: 0.75rem;
    color: var(--gray-600);
    text-align: center;
    font-weight: 500;
}

.avatar-option.selected .avatar-label {
    color: var(--primary-color);
    font-weight: 600;
}

/* Loading Spinner */
.loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--gray-200);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 100px;
    right: 20px;
    z-index: 1500;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    background: white;
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--success-color);
    max-width: 350px;
    animation: slideIn 0.3s ease-out;
    pointer-events: auto;
    cursor: pointer;
    transition: var(--transition);
}

.toast:hover {
    transform: translateX(-5px);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 10px 10px -5px rgb(0 0 0 / 0.04);
}

.toast.error {
    border-left-color: var(--danger-color);
}

.toast.warning {
    border-left-color: var(--warning-color);
}

.toast.info {
    border-left-color: var(--primary-color);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toast-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    font-weight: 500;
}

.toast-removing {
    animation: slideOut 0.3s ease-out forwards;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Offline Indicator */
.offline-indicator {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--warning-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    font-size: 0.9rem;
    box-shadow: var(--shadow);
    z-index: 1100;
    animation: slideDown 0.3s ease-out;
}

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

/* Feedback */
.feedback {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-top: 1rem;
}

.feedback.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.feedback.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-container {
        padding: 1rem;
    }
    
    .nav-logo {
        font-size: 1.2rem;
    }
    
    .main-container {
        padding: 1rem;
    }
    
    .add-item-card {
        padding: 1.5rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .auth-card {
        padding: 2rem;
        margin: 1rem;
    }
    
    .artikel-item {
        grid-template-columns: auto 1fr;
        gap: 0.5rem;
    }
    
    .artikel-actions {
        grid-column: 1 / -1;
        justify-content: flex-end;
        margin-top: 0.5rem;
    }
    
    .modal-form {
        padding: 1.5rem;
    }
    
    .modal-actions {
        flex-direction: column;
    }
}

/* PWA Install Banner */
.install-banner {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
    z-index: 1000;
    animation: slideUp 0.3s ease-out;
}

.install-banner-content {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    gap: 1rem;
}

.install-banner-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.install-banner-text {
    flex: 1;
}

.install-banner-text h4 {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
}

.install-banner-text p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--gray-600);
}

.install-banner-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* ── iOS-spezifischer Install-Hinweis ────────────────────────────────── */
.ios-install-banner {
    position: fixed;
    bottom: 70px;           /* Etwas Abstand über der Safari-Toolbar */
    left: 12px;
    right: 12px;
    background: #1c1c1e;
    color: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    z-index: 9999;
    padding: 1rem 1.25rem 1.5rem;
    animation: slideUp 0.35s ease-out;
}

.ios-install-close {
    position: absolute;
    top: 0.6rem;
    right: 0.8rem;
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    font-size: 1.2rem;
    line-height: 1;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ios-install-content {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.ios-install-icon {
    font-size: 2rem;
    flex-shrink: 0;
    line-height: 1;
}

.ios-install-text {
    font-size: 0.9rem;
    line-height: 1.45;
}

.ios-install-text strong:first-child {
    display: block;
    font-size: 1rem;
    margin-bottom: 0.3rem;
}

.ios-install-text p {
    margin: 0;
    color: rgba(255,255,255,0.8);
}

.ios-share-glyph {
    font-family: -apple-system, sans-serif;
    font-size: 1.05em;
}

/* Pfeil, der nach unten auf die Safari-Toolbar zeigt */
.ios-install-arrow {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid #1c1c1e;
}
/* ──────────────────────────────────────────────────────────────────────── */

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

/* Mobile PWA Optimierungen */
@media (display-mode: standalone) {
    /* Styles wenn App im Standalone-Modus läuft */
    .navbar {
        padding-top: env(safe-area-inset-top, 0);
    }
    
    /* Verstecke Install Banner wenn bereits installiert */
    .install-banner {
        display: none !important;
    }
    
    /* Zusätzlicher Abstand für Geräte mit Notch */
    .main-container {
        padding-bottom: env(safe-area-inset-bottom, 2rem);
    }
}

/* Touch-optimierte Elemente */
@media (hover: none) and (pointer: coarse) {
    /* Größere Touch-Ziele für mobile Geräte */
    .btn {
        min-height: 44px;
        padding: 0.75rem 1.5rem;
    }
    
    .action-btn {
        min-width: 44px;
        min-height: 44px;
    }
    
    .artikel-checkbox {
        width: 24px;
        height: 24px;
    }
    
    .form-input {
        padding: 1rem;
        font-size: 16px; /* Verhindert Zoom auf iOS */
    }
    
    /* Hover-Effekte für Touch-Geräte deaktivieren */
    .btn:hover,
    .artikel-item:hover,
    .action-btn:hover {
        transform: none;
        box-shadow: initial;
    }
}

/* Hochformat-spezifische Anpassungen */
@media (orientation: portrait) and (max-width: 768px) {
    .shopping-list-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .list-stats {
        align-self: stretch;
        justify-content: space-between;
    }
}

/* Landscape-Modus für kleine Bildschirme */
@media (orientation: landscape) and (max-height: 500px) {
    .auth-container {
        padding: 1rem;
    }
    
    .auth-card {
        padding: 1.5rem;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .main-container {
        padding: 1rem;
    }
    
    .nav-container {
        padding: 0.5rem 1rem;
    }
}

/* Accessibility Verbesserungen */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .spinner {
        animation: none;
    }
}

/* Benutzer-Zuordnungs-Styles */
.artikel-assignment,
.artikel-creator,
.artikel-meta {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.artikel-benutzer-info {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.artikel-benutzer-info strong {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.8rem;
}

.nicht-zugewiesen {
    color: var(--gray-400);
    font-style: italic;
}

.artikel-assignment {
    color: var(--primary-color);
    font-weight: 500;
}

.artikel-creator {
    color: var(--gray-600);
}

.artikel-meta {
    color: var(--success-color);
    font-weight: 500;
}

/* Responsive Form-Row Erweiterungen */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
    }
    
    .form-row .form-group {
        min-width: 100%;
    }
    
    .artikel-assignment,
    .artikel-creator,
    .artikel-meta {
        font-size: 0.7rem;
    }
}

/* Offline-Indikator */
.offline-indicator {
    background: var(--warning-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
    animation: pulse 2s infinite;
}

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

/* Dark Mode – manuell via [data-theme="dark"] auf <html> */
[data-theme="dark"] {
    --gray-50:  #1e2433;
    --gray-100: #252d3d;
    --gray-200: #2e3a50;
    --gray-300: #3e4f68;
    --gray-400: #5a6e8a;
    --gray-500: #7a90aa;
    --gray-600: #9eb3c8;
    --gray-700: #c4d4e0;
    --gray-800: #dde8f0;
    --gray-900: #f0f6fb;
    color-scheme: dark;
}

[data-theme="dark"] body {
    background: linear-gradient(135deg, #1a1f2e 0%, #2d1f3d 100%);
    color: var(--gray-700);
}

[data-theme="dark"] .navbar {
    background: rgba(20, 26, 40, 0.97);
    border-bottom-color: var(--gray-200);
}

[data-theme="dark"] .auth-card,
[data-theme="dark"] .add-item-card,
[data-theme="dark"] .shopping-list-section,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .autocomplete-dropdown,
[data-theme="dark"] .custom-filter-options,
[data-theme="dark"] .toast {
    background: var(--gray-100) !important;
    border-color: var(--gray-200);
    color: var(--gray-800);
}

[data-theme="dark"] .form-input,
[data-theme="dark"] .custom-filter-selected {
    background: var(--gray-50);
    border-color: var(--gray-300);
    color: var(--gray-900);
}

[data-theme="dark"] .form-input:focus {
    border-color: var(--primary-color);
    background: var(--gray-50);
}

[data-theme="dark"] .form-input option,
[data-theme="dark"] select.form-input {
    background: var(--gray-100);
    color: var(--gray-900);
}

[data-theme="dark"] .artikel-item {
    background: var(--gray-50);
    border-color: var(--gray-200);
}

[data-theme="dark"] .artikel-item.erledigt {
    background: var(--gray-100);
}

[data-theme="dark"] .artikel-kategorie,
[data-theme="dark"] .artikel-menge,
[data-theme="dark"] .autocomplete-kategorie {
    background: var(--gray-200);
    color: var(--gray-700);
}

[data-theme="dark"] .autocomplete-item:hover,
[data-theme="dark"] .autocomplete-item.active,
[data-theme="dark"] .custom-filter-option:hover {
    background: var(--gray-200);
}

[data-theme="dark"] .custom-filter-option.active {
    background: rgba(99, 102, 241, 0.2);
}

[data-theme="dark"] .btn-secondary {
    background: var(--gray-200);
    color: var(--gray-800);
}

[data-theme="dark"] .btn-secondary:hover:not(:disabled) {
    background: var(--gray-300);
}

[data-theme="dark"] .add-item-toggle:hover,
[data-theme="dark"] .add-item-toggle {
    background: transparent;
    color: var(--gray-900);
}

[data-theme="dark"] .shopping-list-header,
[data-theme="dark"] .add-item-card {
    border-color: var(--gray-200);
}

[data-theme="dark"] .icon-option,
[data-theme="dark"] .avatar-option {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

[data-theme="dark"] .icon-option:hover,
[data-theme="dark"] .avatar-option:hover {
    background-color: var(--gray-200);
}

[data-theme="dark"] .icon-auswahl-grid,
[data-theme="dark"] .avatar-auswahl-grid {
    background: var(--gray-50);
    border-color: var(--gray-200);
}

[data-theme="dark"] .loading-spinner {
    background: rgba(20, 26, 40, 0.9);
}

[data-theme="dark"] .modal-overlay {
    background: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .feedback.error { background: rgba(239,68,68,0.15); color: #fca5a5; }
[data-theme="dark"] .feedback.success { background: rgba(16,185,129,0.15); color: #6ee7b7; }

/* Dark-Mode Toggle Button */
.dark-mode-toggle {
    background: none;
    border: 1.5px solid var(--gray-300);
    border-radius: 20px;
    padding: 0.3rem 0.7rem;
    cursor: pointer;
    font-size: 1rem;
    color: var(--gray-600);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}

.dark-mode-toggle:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

#abmeldenBtn {
    padding: 0.4rem;
    width: 2.2rem;
    height: 2.2rem;
    line-height: 1;
    background-color: #dc2626;
    border-color: #dc2626;
    color: #fff;
}

#abmeldenBtn:hover {
    background-color: #b91c1c;
    border-color: #b91c1c;
}