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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #121212;
    color: #e0e0e0;
    padding: 16px;
    padding-bottom: 32px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 24px;
    padding: 20px 0;
}

h1 {
    font-size: 28px;
    font-weight: 600;
    color: #f5f5f5;
}

.subtitle {
    color: #9e9e9e;
    font-size: 14px;
    margin-top: 4px;
}

/* Search Bar */
#searchInput {
    margin-top: 16px;
    padding: 10px 14px;
    width: 100%;
    max-width: 400px;
    font-size: 15px;
    border: 1px solid #333;
    border-radius: 8px;
    background: #1e1e1e;
    color: #f5f5f5;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}
#searchInput:focus {
    border-color: #64b5f6;
    background: #222;
}

/* Categories */
.categories-container {
    max-width: 1400px;
    margin: 0 auto;
}

.category-accordion {
    background: #1e1e1e;
    border-radius: 12px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    overflow: hidden;
}

.category-header {
    padding: 16px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: background 0.2s;
}
.category-header:hover {
    background: #2a2a2a;
}

.category-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
}

.category-count {
    font-size: 13px;
    color: #9e9e9e;
    margin-left: 8px;
    font-weight: normal;
}

.chevron {
    font-size: 20px;
    color: #9e9e9e;
    transition: transform 0.3s;
}
.category-accordion.active .chevron {
    transform: rotate(180deg);
}

.category-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}
.category-accordion.active .category-content {
    max-height: 2000px;
    transition: max-height 0.5s ease-in;
}

.food-list {
    padding: 0 20px 16px 20px;
}

/* Food Items */
.food-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #2c2c2c;
}
.food-item:last-child {
    border-bottom: none;
}

.status-indicator {
    width: 12px; height: 12px;
    border-radius: 50%;
    margin-right: 12px;
    flex-shrink: 0;
}
.status-safe { background: #27ae60; }
.status-caution { background: #f39c12; }
.status-avoid { background: #e74c3c; }

.food-name {
    font-size: 15px;
    font-weight: 500;
    color: #f5f5f5;
    flex: 1;
}
.food-notes {
    font-size: 13px;
    color: #9e9e9e;
    font-style: italic;
    margin-left: 24px;
    margin-top: 2px;
}

/* Responsive Layout */
@media (min-width: 768px) {
    .categories-container {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 20px;
    }
    .category-accordion { margin-bottom: 0; }
    .category-header { cursor: default; background: #2a2a2a; }
    .category-header:hover { background: #2a2a2a; }
    .chevron { display: none; }
    .category-content { max-height: none !important; }
    .food-list { padding: 16px 20px 20px 20px; }
}
@media (min-width: 1200px) {
    .categories-container { grid-template-columns: repeat(4, 1fr); }
}

/* Legend */
.legend {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 32px;
    padding: 16px;
    background: #1e1e1e;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #e0e0e0;
}
.legend-dot {
    width: 12px; height: 12px; border-radius: 50%;
}

.search-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto 24px;
}

#searchInput {
    width: 100%;
    padding: 10px 36px 10px 12px; /* leave space on the right for the icon */
    border-radius: 8px;
    border: 1px solid #ccc;
    font-size: 16px;
}

#clearSearch {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 16px;
    color: #888;
    display: none; /* hidden by default */
}

#clearSearch:hover {
    color: #333;
}

mark {
    background: #ffe066;
    padding: 0 2px;
    border-radius: 3px;
    color: #000;
}
