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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    color: #333;
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.subtitle {
    color: #666;
    font-size: 1.1rem;
}

.add-item-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 30px;
    position: relative;
}

.add-item-section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.form-group {
    margin-bottom: 15px;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.search-results {
    list-style: none;
    background: white;
    border: 2px solid #667eea;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.search-results.active {
    display: block;
}

.search-results li {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
}

.search-results li:hover {
    background: #f0f4ff;
}

.search-results li:last-child {
    border-bottom: none;
}

.search-results li .item-category-tag {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    margin-left: 10px;
}

.search-results li .custom-badge {
    display: inline-block;
    background: #f39c12;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    margin-left: 6px;
}

.search-delete-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: #ff6b6b;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 2px 6px;
    margin-left: 8px;
    border-radius: 4px;
    transition: all 0.2s;
    opacity: 0;
}

.search-results li:hover .search-delete-btn {
    opacity: 1;
}

.search-delete-btn:hover {
    background: #fff0f0;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-primary {
    background: #667eea;
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.btn-add-custom {
    background: #27ae60;
    color: white;
    width: 100%;
    margin-top: 15px;
    font-weight: 600;
}

.btn-add-custom:hover {
    background: #219a52;
    transform: translateY(-2px);
}

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

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.25s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.modal-header h2 {
    color: #333;
    font-size: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 6px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.modal-save {
    margin-top: 10px;
}

/* Category suggestions dropdown */
.category-suggestions {
    list-style: none;
    background: white;
    border: 2px solid #667eea;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 110;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.category-suggestions.active {
    display: block;
}

.category-suggestions li {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
}

.category-suggestions li:hover {
    background: #f0f4ff;
}

.category-suggestions li:last-child {
    border-bottom: none;
}

.category-suggestions li .existing-badge {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 0.7rem;
    margin-left: 8px;
}

.view-controls {
    margin-bottom: 30px;
}

.view-controls h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.btn-filter {
    background: #e9ecef;
    color: #555;
    padding: 8px 20px;
    font-size: 0.9rem;
}

.btn-filter:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

.btn-filter.active {
    background: #667eea;
    color: white;
}

.items-container {
    margin-top: 20px;
}

/* Summary bar */
.summary-bar {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    margin-bottom: 15px;
    color: white;
    font-weight: 600;
}

.summary-total {
    font-size: 1.1rem;
}

.summary-checked {
    font-size: 1rem;
    opacity: 0.9;
}

.summary-progress {
    flex: 1;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
    outline: none;
}

.summary-progress::-webkit-progress-bar {
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
}

.summary-progress::-webkit-progress-value {
    background: #4ade80;
    border-radius: 4px;
    transition: width 0.4s ease;
}

.summary-progress::-moz-progress-bar {
    background: #4ade80;
    border-radius: 4px;
}

/* Aisle progress */
.aisle-progress {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 15px 20px;
    background: #fff8e1;
    border: 2px dashed #ffb74d;
    border-radius: 10px;
    margin-bottom: 15px;
}

.aisle-progress span {
    font-weight: 600;
    color: #333;
}

.aisle-steps {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 1.4rem;
}

.aisle-step {
    transition: transform 0.2s;
}

.aisle-step-active {
    transform: scale(1.3);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1.3); }
    50% { transform: scale(1.5); }
}

/* Category groups */
.category-group {
    margin-bottom: 15px;
    border-radius: 10px;
    overflow: hidden;
    background: #fafafa;
    border: 1px solid #eee;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.category-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #f0f0f0;
    font-weight: 700;
    font-size: 1rem;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
    user-select: none;
}

.category-count {
    font-weight: 400;
    color: #888;
    font-size: 0.85rem;
}

.category-count small {
    color: #4ade80;
}

/* List transition animations */
.aisle-transition-left {
    animation: slideOutLeft 0.2s ease-in forwards;
}

@keyframes slideOutLeft {
    to { transform: translateX(-100%); opacity: 0; }
}

.aisle-transition-right {
    animation: slideInRight 0.3s ease-out;
}

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

/* Current aisle badge */
.aisle-current-badge {
    margin-left: auto;
    font-size: 1.1rem;
    filter: drop-shadow(0 0 4px rgba(102, 126, 234, 0.6));
}

/* Checked row */
.compact-item.checked-row {
    background: #f0fff4;
}

.compact-item.checked-row .item-name {
    text-decoration: line-through;
    color: #999;
}

.compact-list {
    list-style: none;
}

.compact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
    min-height: 48px;
}

.compact-item:hover {
    background: #f8f9fa;
}

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

.item-checkbox {
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: #667eea;
    flex-shrink: 0;
    min-width: 44px;
    min-height: 44px;
}

.item-name {
    flex: 1;
    cursor: pointer;
    color: #333;
    font-size: 1rem;
}

.item-name.checked-item {
    text-decoration: line-through;
    color: #999;
}

.item-cat {
    font-size: 0.75rem;
    color: #888;
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 10px;
}

.btn-compact-delete {
    background: none;
    border: none;
    color: #ccc;
    font-size: 1.2rem;
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
}

.btn-compact-delete:hover {
    color: #ff6b6b;
    background: #fff0f0;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    color: #999;
    font-size: 1.2rem;
    padding: 60px 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.start-stop-section {
    text-align: center;
    margin-bottom: 25px;
    padding: 20px;
    background: #fff8e1;
    border-radius: 10px;
    border: 2px dashed #ffb74d;
}

.btn-start {
    background: #ff6b6b;
    color: white;
    font-size: 1.2rem;
    padding: 14px 40px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.btn-start:hover {
    background: #ee5a5a;
    transform: translateY(-2px);
}

.btn-start.stop {
    background: #555;
}

.btn-start.stop:hover {
    background: #444;
}

.start-stop-hint {
    margin-top: 12px;
    color: #888;
    font-size: 0.95rem;
    min-height: 1.2em;
}

.current-section {
    background: #667eea;
    position: relative;
}

.view-controls.filter-disabled .filters {
    opacity: 0.4;
    pointer-events: none;
}



@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    header h1 {
        font-size: 1.6rem;
    }

    header {
        margin-bottom: 25px;
    }

    .items-container {
        grid-template-columns: 1fr;
    }

    .filters {
        justify-content: center;
        gap: 6px;
    }

    .btn-filter {
        padding: 6px 14px;
        font-size: 0.8rem;
    }

    .compact-item {
        padding: 10px 10px;
        gap: 10px;
    }

    .item-cat {
        font-size: 0.65rem;
    }
}

@media (max-width: 380px) {
    header h1 {
        font-size: 1.3rem;
    }

    .filter-disabled {
        position: static !important;
    }
}

/* Safe areas for modern phones with notches */
@supports (padding-top: env(safe-area-inset-top)) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}
