@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&family=Lora:wght@400;500&display=swap');

:root {
    /* Standard Theme (Red) */
    --primary-color: #F00F40;
    --primary-color-rgb: 240, 15, 64;
    --secondary-color: #3D4A52;
    --background-color: #f0f2f5;
    --card-background: rgba(255, 255, 255, 0.7);
    --card-background-solid: #ffffff;
    --text-color: #1e293b;
    --text-muted-color: #64748b;
    --border-color: rgba(0, 0, 0, 0.08);
    --success-color: #10b981;
    
    --border-radius-md: 16px;
    --border-radius-lg: 24px;
    --shadow-subtle: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lifted: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
}

/* Packing Mode Theme (Purple) - applied to body */
body.packing-mode {
    --primary-color: #8B5CF6; /* Violet-500 */
    --primary-color-rgb: 139, 92, 246;
    --secondary-color: #4C1D95; /* Violet-900 */
    --success-color: #a78bfa; /* Lighter violet for progress bar in this mode */
}

[data-theme="dark"] {
    --secondary-color: #7b8c96;
    --background-color: #111827;
    --card-background: rgba(31, 41, 55, 0.7);
    --card-background-solid: #1f2937;
    --text-color: #f3f4f6;
    --text-muted-color: #9ca3af;
    --border-color: rgba(243, 244, 246, 0.1);
    --shadow-subtle: 0 4px 6px -1px rgba(0,0,0,0.2), 0 2px 4px -2px rgba(0,0,0,0.2);
    --shadow-lifted: 0 20px 25px -5px rgba(0,0,0,0.4), 0 8px 10px -6px rgba(0,0,0,0.4);
}

/* Adjustments for Packing Mode in Dark Theme */
[data-theme="dark"] body.packing-mode {
    --secondary-color: #ddd6fe;
    --success-color: #8B5CF6;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease, --primary-color 0.3s ease;
}

#app-background {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: -1;
    background: linear-gradient(125deg, #e6e9f0 0%, #eef1f5 100%);
    background-size: 200% 200%;
    animation: gradient-animation 15s ease infinite;
    transition: opacity 0.5s ease;
}

/* Special background for packing mode */
body.packing-mode #app-background {
     background: linear-gradient(125deg, #f3e8ff 0%, #e0e7ff 100%);
}

[data-theme="dark"] #app-background {
    opacity: 0;
}

@keyframes gradient-animation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.view {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px 15px;
    min-height: 100vh;
    display: none;
}
.view.active { display: block; }

@keyframes view-enter { from { opacity: 0; transform: scale(0.98); } to { opacity: 1; transform: scale(1); } }
@keyframes item-enter { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }
.view-enter { animation: view-enter 0.5s cubic-bezier(0.25, 1, 0.5, 1) forwards; }
.item-enter { animation: item-enter 0.4s ease-out forwards; }

.page-header { padding: 30px 0; text-align: center; position: relative;}
.page-header h1 { 
    font-size: 2.25rem; 
    font-weight: 700; 
    color: var(--secondary-color); 
    transition: color 0.3s ease;
    /* FIX: Padding verhindert, dass Text auf dem Handy unter die Buttons rutscht */
    padding: 0 55px; 
}
.page-header .back-btn { position: absolute; left: 15px; top: 40px; }
.theme-toggle-btn { position: absolute; top: 36px; right: 15px; color: var(--secondary-color); }

/* Mobile Anpassung für kleineren Header */
@media (max-width: 600px) {
    .page-header h1 { font-size: 1.75rem; }
    .page-header .back-btn { top: 32px; }
    .theme-toggle-btn { top: 28px; }
}

.action-button {
    font-family: 'Poppins', sans-serif; cursor: pointer; border: none;
    transition: all 0.2s ease-in-out; display: inline-flex;
    align-items: center; justify-content: center; gap: 8px;
    padding: 12px 24px; background-color: var(--primary-color); color: white;
    border-radius: var(--border-radius-md); font-weight: 600; font-size: 1rem;
    box-shadow: 0 4px 10px rgba(var(--primary-color-rgb), 0.2);
}
.action-button:hover { filter: brightness(1.1); transform: translateY(-3px); box-shadow: 0 7px 15px rgba(var(--primary-color-rgb), 0.3); }
.action-button:active { transform: translateY(0); }

.icon-button {
    background: none; border: none; cursor: pointer; padding: 8px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    transition: background-color 0.2s ease, color 0.3s ease;
}
.icon-button:hover { background-color: rgba(0,0,0,0.05); }
[data-theme="dark"] .icon-button:hover { background-color: rgba(255,255,255,0.1); }

/* Button active states */
.icon-button.active {
    background-color: rgba(var(--primary-color-rgb), 0.1);
    color: var(--primary-color);
}

.glass-card {
    background: var(--card-background);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-subtle);
    border: 1px solid rgba(255,255,255,0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
[data-theme="dark"] .glass-card { border: 1px solid rgba(255,255,255,0.1); }

.input-wrapper { position: relative; }
.input-wrapper svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--text-muted-color); }
.input-field {
    width: 100%; padding: 12px 16px 12px 48px;
    border-radius: var(--border-radius-md); font-size: 1rem;
    border: 1px solid var(--border-color); background-color: #fff;
    color: var(--text-color);
    font-family: 'Poppins', sans-serif; transition: all 0.2s ease-in-out;
}
.input-field:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 4px rgba(var(--primary-color-rgb), 0.1); }
[data-theme="dark"] .input-field { background-color: #374151; border-color: #4b5563; }
[data-theme="dark"] .input-field::placeholder { color: var(--text-muted-color); }
[data-theme="dark"] .input-field:focus { background-color: #4b5563; }

.add-list-controls { display: flex; gap: 12px; margin-top: 12px; }
.add-list-controls .input-field { padding-left: 16px; }

.secondary-action { background-color: var(--secondary-color); width: 100%; margin-top: 12px; box-shadow: 0 4px 10px rgba(61, 74, 82, 0.2); }

/* --- PACKING MODE CONTROL STYLES --- */
.packing-mode-control {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}
[data-theme="dark"] .packing-mode-control { border-top: 1px solid rgba(255,255,255,0.1); }

.packing-mode-text {
    font-size: 0.9rem;
    color: var(--text-muted-color);
    line-height: 1.3;
}
.packing-mode-text strong {
    display: block;
    color: var(--text-color);
    margin-bottom: 2px;
    font-size: 0.95rem;
}

/* Toggle Switch CSS */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1;
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 34px;
}
[data-theme="dark"] .slider { background-color: #4b5563; }
.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
input:checked + .slider {
    background-color: var(--primary-color);
}
input:focus + .slider {
    box-shadow: 0 0 1px var(--primary-color);
}
input:checked + .slider:before {
    -webkit-transform: translateX(22px);
    -ms-transform: translateX(22px);
    transform: translateX(22px);
}
/* ---------------------------------- */

#list-collection { display: grid; gap: 16px; margin-top: 30px; }
.list-card {
    display: flex; align-items: center; gap: 16px; cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.list-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lifted); }
.list-card-progress { position: relative; width: 60px; height: 60px; flex-shrink: 0; }
.list-card-progress svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.list-card-progress circle { fill: none; stroke-width: 6; }
.progress-bg { stroke: var(--border-color); }
.progress-value { stroke: var(--primary-color); stroke-dasharray: 157; stroke-dashoffset: 157; transition: stroke-dashoffset 0.5s ease-out, stroke 0.3s ease; }
.progress-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 0.8rem; font-weight: 600; color: var(--primary-color); transition: color 0.3s ease; }
.list-card-content { flex-grow: 1; }
.list-card-content h2 { font-size: 1.2rem; font-weight: 600; color: var(--secondary-color); }
.list-card-content p { font-size: 0.9rem; color: var(--text-muted-color); }
.list-card-actions .icon-button:hover { background-color: #ffeeee; color: var(--primary-color); }
[data-theme="dark"] .list-card-actions .icon-button:hover { background-color: rgba(var(--primary-color-rgb), 0.15); }

.checklist-header { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; text-align: left; }
.checklist-header .back-btn { color: var(--secondary-color); flex-shrink: 0; }
.checklist-header h1 { font-size: 1.75rem; font-weight: 700; color: var(--secondary-color); flex-grow: 1; transition: color 0.3s ease; }
.checklist-header .icon-button { color: var(--text-muted-color); flex-shrink: 0; }

/* Packing Mode Badge */
.mode-badge {
    display: none;
    font-size: 0.75rem;
    background: var(--primary-color);
    color: white;
    padding: 4px 8px;
    border-radius: 8px;
    font-weight: 600;
    margin-right: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
body.packing-mode .mode-badge { display: inline-block; }
/* FIX: Erlaube Badge auf dem Dashboard zu sehen, unabhängig von body class */
.list-card .mode-badge { display: inline-block; margin-bottom: 5px; }

.progress-wrapper { margin-bottom: 25px; }
.progress-labels { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 0.9rem; font-weight: 500; color: var(--text-muted-color); }
.progress-bar-container { width: 100%; background-color: var(--border-color); border-radius: 25px; overflow: hidden; }
.progress-bar { height: 8px; width: 0%; background-color: var(--success-color); border-radius: 25px; transition: width 0.4s ease-in-out, background-color 0.3s ease; }

.category details { background: var(--card-background-solid); border-radius: var(--border-radius-lg); box-shadow: var(--shadow-subtle); margin-bottom: 20px; }
.category summary {
    background-image: linear-gradient(to right, var(--secondary-color), #55626b);
    color: white; padding: 16px 20px; font-size: 1.1rem; font-weight: 600;
    display: flex; justify-content: space-between; align-items: center;
    cursor: pointer; list-style: none;
    transition: border-radius 0.2s ease-in-out, background-image 0.3s ease;
    border-radius: var(--border-radius-lg);
}

/* Gradient change for packing mode */
body.packing-mode .category summary {
     background-image: linear-gradient(to right, var(--secondary-color), #7c3aed);
}

[data-theme="dark"] .category summary { background-image: linear-gradient(to right, #4a5568, #2d3748); }
/* Dark mode packing gradient override */
[data-theme="dark"] body.packing-mode .category summary { background-image: linear-gradient(to right, #5b21b6, #4c1d95); }

.category details[open] summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.category .summary-title { flex-grow: 1; }
.category .summary-actions { display: flex; align-items: center; }
.category .summary-actions .icon-button { color: rgba(255,255,255,0.8); }
.category .summary-actions .icon-button:hover { color: white; background-color: rgba(255,255,255,0.1); }
.category .summary-icon { transition: transform 0.3s ease; }
.category details[open] summary .summary-icon { transform: rotate(90deg); }

.checklist { list-style: none; }
.checklist li { padding: 12px 15px; border-bottom: 1px solid #e2e8f0; position: relative; }
[data-theme="dark"] .checklist li { border-bottom: 1px solid #374151; }
.checklist li:last-child { border-bottom: none; }

.item-container { display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 8px; padding: 4px 0; }
.item-container input[type="checkbox"] { display: none; }
.checkmark-label { grid-column: 1; cursor: pointer; padding-top: 2px; }
.checkmark { width: 24px; height: 24px; border: 2px solid #e2e8f0; border-radius: 8px; flex-shrink: 0; transition: all 0.2s; display: flex; align-items: center; justify-content: center; }
[data-theme="dark"] .checkmark { border: 2px solid #4b5563; }
.checkmark svg { opacity: 0; transition: opacity 0.2s; color: white;}
input[type="checkbox"]:checked ~ .checkmark-label .checkmark { background-color: var(--primary-color); border-color: var(--primary-color); }
input[type="checkbox"]:checked ~ .checkmark-label .checkmark svg { opacity: 1; }

.item-content { grid-column: 2; cursor: pointer; min-height: 30px; overflow: hidden; }
.item-quantity-box {
    float: right; margin-left: 8px; margin-bottom: 4px; font-size: 0.9rem; font-weight: 600;
    color: var(--primary-color); background-color: rgba(var(--primary-color-rgb), 0.1);
    padding: 2px 10px; border-radius: 8px; white-space: nowrap; transition: color 0.3s ease, background-color 0.3s ease;
}
.item-text { font-weight: 500; transition: all 0.2s; line-height: 1.4; white-space: normal; overflow-wrap: break-word; display: block; }
input[type="checkbox"]:checked ~ .item-content .item-text { text-decoration: line-through; color: var(--text-muted-color); }
.item-container .icon-button { color: var(--text-muted-color); }

.notes-container { display: none; margin-top: 10px; padding-left: 36px; }
.notes-container.visible { display: block; }
.notes-textarea { width: 100%; padding: 10px 14px; border-radius: var(--border-radius-md); border: 1px solid #e2e8f0; font-size: 0.95rem; resize: vertical; min-height: 60px; font-family: 'Poppins'; color: var(--text-color); }
[data-theme="dark"] .notes-textarea { background-color: #374151; border: 1px solid #4b5563; }

#import-view .glass-card { padding: 25px; }
#import-view h2 { font-size: 1.25rem; margin-bottom: 10px; }
#import-view p { color: var(--text-muted-color); margin-bottom: 15px; }
#import-view code { background-color: #e2e8f0; padding: 2px 6px; border-radius: 4px; font-family: monospace; }
[data-theme="dark"] #import-view code { background-color: #374151; }
#import-view hr { border: none; border-top: 1px solid #e2e8f0; margin: 20px 0; }
[data-theme="dark"] #import-view hr { border-top: 1px solid #374151; }
#csv-text-input { 
    display: block; width: 100%; margin-top: 12px; font-family: 'Poppins'; 
    min-height: 150px; resize: vertical; padding: 12px;
    border-radius: var(--border-radius-md); font-size: 0.9rem;
    border: 1px solid #e2e8f0;
}
#process-import-btn { width: 100%; margin-top: 20px; }

.fab { position: fixed; bottom: 30px; right: 30px; width: 60px; height: 60px; border-radius: 50%; z-index: 100; }
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.5); display: none; align-items: flex-end; justify-content: center; z-index: 1000; opacity: 0; transition: opacity 0.3s ease; }
[data-theme="dark"] .modal-overlay { background-color: rgba(17, 24, 39, 0.7); }
.modal-overlay.visible { display: flex; opacity: 1; }
.modal-content { background: var(--card-background); width: 100%; max-width: 800px; padding: 20px; border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0; transform: translateY(100%); transition: transform 0.3s ease; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.modal-overlay.visible .modal-content { transform: translateY(0); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header h2 { font-size: 1.25rem; color: var(--secondary-color); }
.modal-body .input-field { margin-bottom: 12px; padding-left: 16px; }

#item-action-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.2); z-index: 1100; display: none;
}
#item-action-overlay.visible { display: block; }
#item-action-menu {
    position: absolute; width: 220px; padding: 8px; background: var(--card-background-solid);
    border-radius: var(--border-radius-md); box-shadow: var(--shadow-lifted);
    border: 1px solid var(--border-color); list-style: none; display: flex;
    flex-direction: column; gap: 4px;
}
.item-action-button {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: none; background-color: transparent;
    cursor: pointer; width: 100%; text-align: left; font-family: 'Poppins', sans-serif; font-size: 0.95rem; font-weight: 500;
    border-radius: 8px; transition: background-color 0.2s ease, color 0.2s ease; color: var(--text-color);
}
.item-action-button svg { flex-shrink: 0; color: var(--text-muted-color); transition: color 0.2s ease; }
.item-action-button:hover { background-color: #f1f5f9; }
[data-theme="dark"] .item-action-button:hover { background-color: #374151; }
.item-action-button.delete:hover { background-color: rgba(var(--primary-color-rgb), 0.1); color: var(--primary-color); }
.item-action-button.delete:hover svg { color: var(--primary-color); }
[data-theme="dark"] .item-action-button.delete:hover { background-color: rgba(var(--primary-color-rgb), 0.2); }

#move-modal .modal-content { max-height: 70vh; display: flex; flex-direction: column; }
#move-modal-body { overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.category-move-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.category-move-button { width: 100%; }

@media print {
    body * { visibility: hidden; }
    #print-area, #print-area * { visibility: visible; }
    #print-area { position: absolute; left: 0; top: 0; width: 100%; }
}
.print-page { display: none; }

@media print {
     :root {
         --primary-color: #F00F40;
         --secondary-color: #3D4A52;
         --text-color: #1e293b;
         --text-muted-color: #64748b;
     }
    @page { size: A4; margin: 1.5cm; }
    body { font-family: 'Lora', serif; color: var(--text-color); line-height: 1.5; background-color: #fff !important; }
    .print-page { display: block !important; }
    .print-header {
        border-bottom: 2px solid var(--primary-color); padding-bottom: 15px; margin-bottom: 30px; text-align: center;
    }
    .print-header h1 {
        font-family: 'Poppins', sans-serif; font-size: 26pt; font-weight: 700; color: var(--secondary-color); margin: 0 0 5px 0;
    }
    .print-header p {
        font-family: 'Poppins', sans-serif; font-size: 10pt; color: var(--text-muted-color); margin: 0;
    }
    .print-main { column-count: 2; column-gap: 25px; }
    .print-category {
        border: 1px solid #e2e8f0; border-radius: 12px; padding: 15px; margin-bottom: 20px; break-inside: avoid; background-color: #fff;
    }
    .print-category h2 {
        font-family: 'Poppins', sans-serif; font-size: 15pt; font-weight: 600; color: var(--primary-color);
        margin: 0 0 15px 0; padding-bottom: 10px; border-bottom: 1px solid #e2e8f0;
    }
    .print-item-list { list-style: none; padding: 0; margin: 0; }
    .print-item {
        display: flex; align-items: flex-start; padding: 10px 0; font-size: 11pt; border-bottom: 1px dotted #d1d9e6;
    }
    .print-item:last-child { border-bottom: none; }
    .print-item .checkbox {
        width: 20px; height: 20px; border: 2px solid #94a3b8; border-radius: 5px;
        margin-right: 15px; flex-shrink: 0; margin-top: 2px;
    }
    .print-item .text { flex-grow: 1; padding-right: 10px; }
    .print-item .quantity {
        font-size: 10pt; font-weight: 600; font-family: 'Poppins', sans-serif;
        color: var(--secondary-color); background-color: #f1f5f9;
        padding: 2px 10px; border-radius: 6px; white-space: nowrap;
    }
    .print-footer {
        text-align: center; margin-top: 30px; padding-top: 15px;
        border-top: 1px solid #e2e8f0; font-size: 8pt; color: #94a3b8;
    }
}