/* Food Inventory App Styles */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    background-color: #2c5530;
    color: white;
    padding: 20px;
    text-align: center;
    margin-bottom: 20px;
}

.header h1 {
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.header .subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 20px;
}

.card h2 {
    margin-bottom: 15px;
    color: #2c5530;
    font-size: 1.3rem;
}

/* Forms */
.form-group {
    margin-bottom: 15px;
}

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

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #2c5530;
    box-shadow: 0 0 0 2px rgba(44, 85, 48, 0.2);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: #2c5530;
    color: white;
}

.btn-primary:hover {
    background-color: #1e3d22;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-small {
    padding: 5px 10px;
    font-size: 0.85rem;
}

.btn-block {
    width: 100%;
}

/* Landing page specific */
.landing-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.landing-card {
    width: 100%;
    max-width: 400px;
}

.landing-card .tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
}

.landing-card .tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 1rem;
    color: #666;
    transition: color 0.2s;
}

.landing-card .tab.active {
    color: #2c5530;
    border-bottom: 2px solid #2c5530;
    margin-bottom: -2px;
}

.landing-card .tab:hover {
    color: #2c5530;
}

/* Dashboard layout */
.dashboard {
    min-height: 100vh;
}

.dashboard-header {
    background-color: #2c5530;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-header h1 {
    font-size: 1.4rem;
}

.dashboard-header .inventory-name {
    font-size: 0.9rem;
    opacity: 0.9;
}

.dashboard-content {
    padding: 20px;
    max-width: 900px;
    margin: 0 auto;
}

/* Add Item Form */
.add-item-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}

.add-item-form .item-name-input {
    flex: 2;
    min-width: 200px;
}

.add-item-form .quantity-input {
    flex: 0 0 80px;
}

.add-item-form .unit-select {
    flex: 0 0 120px;
}

.add-item-form .category-select {
    flex: 1;
    min-width: 150px;
}

.add-item-form .add-btn {
    flex: 0 0 auto;
}

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

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.autocomplete-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

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

.autocomplete-item:hover,
.autocomplete-item.highlighted {
    background-color: #f0f7f1;
}

.autocomplete-item .item-name {
    font-weight: 500;
}

.autocomplete-item .item-category {
    font-size: 0.8rem;
    color: #666;
}

.autocomplete-header {
    padding: 8px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background-color: #f5f5f5;
    border-bottom: 1px solid #eee;
}

/* Category Filter */
.category-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.category-btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    background: white;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.category-btn:hover {
    border-color: #2c5530;
    color: #2c5530;
}

.category-btn.active {
    background-color: #2c5530;
    color: white;
    border-color: #2c5530;
}

/* Inventory List */
.inventory-list-wrapper {
    width: 100%;
}

.inventory-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.inventory-search {
    flex: 1;
    min-width: 200px;
}

.inventory-search input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.inventory-search input:focus {
    outline: none;
    border-color: #2c5530;
}

.inventory-sort {
    min-width: 150px;
}

.inventory-sort select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.inventory-sort select:focus {
    outline: none;
    border-color: #2c5530;
}

.inventory-results-count {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 10px;
}

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

/* Category headers for grouped view */
.inventory-category-header {
    padding: 10px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #2c5530;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background-color: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
    border-top: 1px solid #e0e0e0;
    margin-top: 8px;
}

.inventory-category-header:first-child {
    margin-top: 0;
    border-top: none;
}

.inventory-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s;
}

.inventory-item:hover {
    background-color: #f9f9f9;
}

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

.inventory-item .item-info {
    flex: 1;
}

.inventory-item .item-name {
    font-weight: 500;
    margin-bottom: 2px;
}

.inventory-item .item-category {
    font-size: 0.8rem;
    color: #666;
}

.inventory-item .item-quantity {
    font-size: 1.1rem;
    font-weight: 500;
    color: #2c5530;
    margin-right: 15px;
    min-width: 80px;
    text-align: right;
}

.inventory-item .item-actions {
    display: flex;
    gap: 5px;
}

.inventory-item .item-actions button {
    padding: 5px 8px;
    font-size: 0.8rem;
}

/* Quantity controls */
.quantity-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.quantity-controls button {
    width: 28px;
    height: 28px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quantity-controls button:hover {
    background-color: #f0f0f0;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.empty-state h3 {
    margin-bottom: 10px;
    color: #999;
}

/* Messages */
.message {
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.message-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Loading spinner */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2c5530;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Unit dropdown with tabs */
.unit-dropdown {
    position: relative;
}

.unit-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 5px;
}

.unit-tab {
    flex: 1;
    padding: 5px;
    text-align: center;
    font-size: 0.75rem;
    cursor: pointer;
    border: none;
    background: none;
    color: #666;
}

.unit-tab.active {
    color: #2c5530;
    border-bottom: 2px solid #2c5530;
}

/* Edit Defaults Panel */
.add-item-container {
    width: 100%;
}

.edit-defaults-panel {
    margin-top: 15px;
    border-top: 1px solid #eee;
    padding-top: 10px;
}

.edit-defaults-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: #666;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 5px 0;
    transition: color 0.2s;
}

.edit-defaults-toggle:hover {
    color: #2c5530;
}

.edit-defaults-toggle .toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: bold;
    color: #2c5530;
}

.edit-defaults-content {
    margin-top: 15px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 6px;
    border: 1px solid #eee;
}

.edit-defaults-hint {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 15px;
}

.edit-defaults-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}

.edit-defaults-fields .form-group {
    flex: 1;
    min-width: 120px;
    margin-bottom: 0;
}

.edit-defaults-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.edit-defaults-message {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.edit-defaults-message.success {
    background-color: #d4edda;
    color: #155724;
}

.edit-defaults-message.error {
    background-color: #f8d7da;
    color: #721c24;
}

/* Login Container and Inventories List */
.login-container {
    width: 100%;
    max-width: 500px;
}

.inventories-list-card {
    margin-top: 20px;
}

.inventories-list-card h3 {
    margin-bottom: 15px;
    color: #2c5530;
    font-size: 1.1rem;
}

.inventories-list-card .loading-text,
.inventories-list-card .empty-text {
    color: #666;
    font-size: 0.9rem;
    text-align: center;
    padding: 10px;
}

.inventories-list {
    list-style: none;
    max-height: 300px;
    overflow-y: auto;
}

.inventory-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border: 1px solid #eee;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

.inventory-list-item:hover {
    background-color: #f0f7f1;
    border-color: #2c5530;
}

.inventory-info {
    flex: 1;
    min-width: 0;
}

.inventory-display-name {
    font-weight: 500;
    margin-bottom: 4px;
    color: #333;
}

.inventory-details {
    display: flex;
    gap: 15px;
    font-size: 0.75rem;
    color: #888;
}

.inventory-unique-id {
    font-family: monospace;
}

.inventory-db-id {
    color: #aaa;
}

/* Dashboard Tabs */
.dashboard-tabs {
    display: flex;
    background-color: white;
    border-bottom: 2px solid #eee;
    padding: 0 20px;
    max-width: 900px;
    margin: 0 auto;
}

.dashboard-tab {
    padding: 15px 25px;
    border: none;
    background: none;
    font-size: 1rem;
    color: #666;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dashboard-tab:hover {
    color: #2c5530;
}

.dashboard-tab.active {
    color: #2c5530;
    font-weight: 500;
}

.dashboard-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background-color: #2c5530;
}

.tab-badge {
    background-color: #2c5530;
    color: white;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: normal;
}

.tab-content {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Inventory Item Expansion Panel */
.inventory-item {
    flex-direction: column;
    padding: 0;
}

.inventory-item-main {
    display: flex;
    align-items: center;
    padding: 12px;
    width: 100%;
}

.inventory-item.expanded {
    background-color: #f9f9f9;
}

.item-expansion-panel {
    padding: 15px;
    background-color: #f0f7f1;
    border-top: 1px solid #e0e0e0;
    width: 100%;
}

.expansion-content {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.expansion-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.expansion-field label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #555;
}

.expansion-field input,
.expansion-field select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    min-width: 120px;
}

.expansion-field input:focus,
.expansion-field select:focus {
    outline: none;
    border-color: #2c5530;
}

.expansion-actions {
    display: flex;
    gap: 10px;
}

/* Unit Dropdown Select with optgroups */
.unit-dropdown-select {
    width: 100%;
}

.unit-dropdown-select optgroup {
    font-weight: 600;
    color: #333;
}

/* Hardcoded Items */
.hardcoded-items-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.user-defined-section,
.hardcoded-section {
    border-radius: 6px;
}

.user-defined-section h3,
.hardcoded-section h3 {
    margin-bottom: 5px;
    color: #2c5530;
    font-size: 1.1rem;
}

.section-hint {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 15px;
}

.hardcoded-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 200px;
}

.search-box input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.search-box input:focus {
    outline: none;
    border-color: #2c5530;
}

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

.category-filter-select select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.items-scroll-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 6px;
}

.items-grid {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 10px;
    padding: 10px;
}

.hardcoded-item {
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 12px;
    transition: border-color 0.2s;
}

.hardcoded-item:hover {
    border-color: #2c5530;
}

.hardcoded-item.user-defined {
    background-color: #f0f7f1;
    border-color: #c3e6cb;
}

.hardcoded-item .item-name {
    font-weight: 500;
    margin-bottom: 5px;
    color: #333;
}

.hardcoded-item .item-details {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 5px;
}

.hardcoded-item .item-aliases,
.hardcoded-item .item-types {
    font-size: 0.75rem;
    color: #888;
    font-style: italic;
}

.items-count {
    text-align: center;
    padding: 10px;
    font-size: 0.85rem;
    color: #888;
}

/* Clickable item cards */
.hardcoded-item.clickable {
    cursor: pointer;
}

.hardcoded-item .item-name {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hardcoded-item .expand-icon {
    font-size: 1.2rem;
    color: #2c5530;
    font-weight: bold;
}

/* Expanded Nutrition Card */
.hardcoded-item.expanded-card {
    grid-column: 1 / -1;
    max-width: 400px;
    background-color: white;
    border: 2px solid #2c5530;
    cursor: pointer;
}

.expanded-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.expanded-header .item-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

.item-category-badge {
    background-color: #2c5530;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* FDA-style Nutrition Label */
.nutrition-label {
    border: 1px solid #333;
    padding: 5px;
    background-color: white;
    margin-bottom: 15px;
}

.nutrition-title {
    font-size: 1.8rem;
    font-weight: 900;
    border-bottom: 1px solid #333;
    padding-bottom: 2px;
    margin-bottom: 3px;
}

.serving-size {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    padding: 3px 0;
}

.nutrition-divider {
    height: 1px;
    background-color: #333;
    margin: 3px 0;
}

.nutrition-divider.thick {
    height: 8px;
    background-color: #333;
}

.nutrition-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    padding: 2px 0;
    border-bottom: 1px solid #ddd;
}

.nutrition-row:last-child {
    border-bottom: none;
}

.nutrition-row.calories {
    font-size: 1rem;
}

.nutrition-row.calories .label {
    font-weight: 700;
}

.nutrition-row.calories .value {
    font-size: 1.5rem;
    font-weight: 700;
}

.nutrition-row.indent {
    padding-left: 20px;
}

.nutrition-row .label {
    flex: 1;
}

.nutrition-row .value {
    min-width: 60px;
    text-align: right;
}

.nutrition-row .dv {
    min-width: 40px;
    text-align: right;
    font-weight: 600;
}

.daily-value-header {
    text-align: right;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 0;
}

.nutrition-footer {
    font-size: 0.7rem;
    color: #666;
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid #333;
}

/* Expanded card additional info */
.item-aliases-full,
.item-types-full {
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 10px;
}

.item-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.item-tags .tag {
    background-color: #e8f5e9;
    color: #2c5530;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
}

.click-hint {
    text-align: center;
    font-size: 0.75rem;
    color: #999;
    margin-top: 10px;
}

/* Duplicate Warning Dialog */
.duplicate-warning-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.duplicate-warning-dialog {
    background: white;
    border-radius: 8px;
    padding: 25px;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.duplicate-warning-dialog h3 {
    color: #dc3545;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.duplicate-warning-dialog p {
    margin-bottom: 20px;
    color: #555;
}

.duplicate-comparison {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    padding: 15px;
    background-color: #f5f5f5;
    border-radius: 6px;
}

.duplicate-comparison .existing-item,
.duplicate-comparison .new-item {
    flex: 1;
    text-align: center;
}

.duplicate-comparison .comparison-label {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 5px;
}

.duplicate-comparison .comparison-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c5530;
}

.duplicate-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.duplicate-actions .btn {
    flex: 1;
    min-width: 100px;
    text-align: center;
}

/* Similar Items Warning Dialog */
.similar-warning-dialog {
    background: white;
    border-radius: 8px;
    padding: 25px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.similar-warning-dialog h3 {
    color: #f0ad4e;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.similar-warning-dialog p {
    margin-bottom: 15px;
    color: #555;
}

.similar-items-list {
    list-style: none;
    margin-bottom: 20px;
    max-height: 200px;
    overflow-y: auto;
}

.similar-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background-color: #f5f5f5;
    border-radius: 6px;
    margin-bottom: 8px;
}

.similar-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.similar-item-name {
    font-weight: 500;
    color: #333;
}

.similar-item-qty {
    font-size: 0.85rem;
    color: #2c5530;
}

.similar-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.similar-actions .btn {
    flex: 1;
    min-width: 100px;
    text-align: center;
}

/* Add Mode Toggle Switch */
.add-mode-toggle {
    display: flex;
    background-color: #f0f0f0;
    border-radius: 6px;
    padding: 4px;
    margin-bottom: 20px;
}

.add-mode-toggle .toggle-btn {
    flex: 1;
    padding: 10px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.95rem;
    color: #666;
    border-radius: 4px;
    transition: all 0.2s;
}

.add-mode-toggle .toggle-btn:hover {
    color: #2c5530;
}

.add-mode-toggle .toggle-btn.active {
    background-color: #2c5530;
    color: white;
    font-weight: 500;
}

/* From List Mode */
.from-list-mode {
    width: 100%;
}

.list-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.list-search {
    flex: 1;
    min-width: 200px;
}

.list-search input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.list-search input:focus {
    outline: none;
    border-color: #2c5530;
}

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

.list-filter select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

/* From List Grid */
.from-list-grid-container {
    max-height: 350px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 6px;
    margin-bottom: 15px;
}

.from-list-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 10px;
}

.from-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 4px;
    transition: border-color 0.2s;
}

.from-list-item:hover {
    border-color: #2c5530;
}

.from-list-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.from-list-item-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.from-list-item-defaults {
    font-size: 0.75rem;
    color: #888;
}

.from-list-item-actions {
    display: flex;
    gap: 5px;
    margin-left: 8px;
}

.btn-icon {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon.btn-add {
    background-color: #2c5530;
    color: white;
    font-weight: bold;
}

.btn-icon.btn-add:hover {
    background-color: #1e3d22;
}

.btn-icon.btn-settings {
    background-color: #e0e0e0;
    color: #666;
}

.btn-icon.btn-settings:hover {
    background-color: #d0d0d0;
    color: #333;
}

/* List Defaults Panel */
.list-defaults-panel {
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
}

.list-defaults-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.list-defaults-header h4 {
    margin: 0;
    font-size: 1rem;
    color: #2c5530;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    padding: 0;
    line-height: 1;
}

.btn-close:hover {
    color: #333;
}

.list-defaults-panel .edit-defaults-panel {
    margin-top: 0;
    border-top: none;
    padding-top: 0;
}

.list-defaults-panel .edit-defaults-panel.always-expanded .edit-defaults-content {
    margin-top: 0;
    padding: 0;
    background: none;
    border: none;
}

.list-count {
    text-align: center;
    font-size: 0.85rem;
    color: #888;
}

/* Create Custom Item Panel */
.create-custom-panel {
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 6px;
    margin-bottom: 20px;
}

.create-custom-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: #2c5530;
    font-weight: 500;
    text-align: left;
}

.create-custom-toggle:hover {
    background-color: #f0f7f1;
}

.create-custom-toggle .toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 2px solid #2c5530;
    border-radius: 50%;
    font-size: 1.2rem;
    font-weight: bold;
}

.create-custom-content {
    padding: 15px;
    border-top: 1px solid #eee;
}

.panel-hint {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 15px;
}

.create-custom-form {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.create-custom-form .form-group {
    flex: 1;
    min-width: 120px;
    margin-bottom: 0;
}

.create-custom-form .form-group:first-child {
    flex: 2;
    min-width: 200px;
}

.create-custom-message {
    margin-top: 15px;
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 0.9rem;
}

.create-custom-message.success {
    background-color: #d4edda;
    color: #155724;
}

.create-custom-message.error {
    background-color: #f8d7da;
    color: #721c24;
}

/* Custom Items Grid */
.custom-items-grid {
    position: relative;
}

.custom-item-card {
    position: relative;
    list-style: none;
}

.btn-delete-custom {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background-color: #dc3545;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

.custom-item-card:hover .btn-delete-custom {
    opacity: 1;
}

.btn-delete-custom:hover {
    background-color: #c82333;
}

/* Recipes Tab */
.recipes-container {
    width: 100%;
}

.recipes-tabs {
    display: flex;
    border-bottom: 2px solid #eee;
    margin-bottom: 20px;
}

.recipes-tab {
    padding: 12px 25px;
    border: none;
    background: none;
    font-size: 1rem;
    color: #666;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.recipes-tab:hover {
    color: #2c5530;
}

.recipes-tab.active {
    color: #2c5530;
    font-weight: 500;
}

.recipes-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background-color: #2c5530;
}

.recipes-content {
    padding: 20px;
}

.under-construction {
    text-align: center;
    padding: 40px 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
    border: 2px dashed #ddd;
}

.under-construction h3 {
    color: #2c5530;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.under-construction p {
    color: #666;
    font-size: 0.95rem;
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Responsive */
@media (max-width: 600px) {
    .add-item-form {
        flex-direction: column;
    }

    .add-item-form > * {
        width: 100%;
        flex: none !important;
    }

    .dashboard-header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .dashboard-tabs {
        padding: 0 10px;
    }

    .dashboard-tab {
        padding: 12px 15px;
        font-size: 0.9rem;
    }

    .inventory-item-main {
        flex-wrap: wrap;
    }

    .inventory-item-main .item-quantity {
        order: -1;
        width: 100%;
        text-align: left;
        margin-bottom: 5px;
    }

    .inventory-item-main .item-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 10px;
    }

    .expansion-content {
        flex-direction: column;
    }

    .expansion-field {
        width: 100%;
    }

    .edit-defaults-fields {
        flex-direction: column;
    }

    .edit-defaults-fields .form-group {
        width: 100%;
    }

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

    .hardcoded-controls {
        flex-direction: column;
    }

    .duplicate-warning-dialog,
    .similar-warning-dialog {
        padding: 20px;
        max-width: 95%;
    }

    .duplicate-actions,
    .similar-actions {
        flex-direction: column;
    }

    .duplicate-actions .btn,
    .similar-actions .btn {
        width: 100%;
    }

    .inventory-controls {
        flex-direction: column;
    }

    .inventory-search,
    .inventory-sort {
        width: 100%;
        min-width: auto;
    }

    .from-list-grid {
        grid-template-columns: 1fr;
    }

    .list-controls {
        flex-direction: column;
    }

    .list-search,
    .list-filter {
        width: 100%;
        min-width: auto;
    }

    .create-custom-form {
        flex-direction: column;
    }

    .create-custom-form .form-group {
        width: 100%;
        min-width: auto;
    }

    .recipes-tabs {
        flex-wrap: wrap;
    }

    .recipes-tab {
        flex: 1;
        min-width: 100px;
        text-align: center;
    }
}

/* ============================================
   Recipe Cards
   ============================================ */

.recipe-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.recipe-count {
    color: #666;
    margin-bottom: 0.5rem;
}

.recipe-card {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    transition: box-shadow 0.2s;
}

.recipe-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.recipe-card.favorite {
    border-left: 4px solid #f4a62a;
}

.recipe-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    cursor: pointer;
}

.recipe-title h4 {
    margin: 0 0 0.25rem 0;
    color: #2c5530;
}

.recipe-cuisine {
    font-size: 0.85rem;
    color: #888;
}

.recipe-score {
    text-align: center;
    background: #2c5530;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    min-width: 60px;
}

.score-value {
    display: block;
    font-size: 1.25rem;
    font-weight: bold;
}

.score-label {
    font-size: 0.7rem;
    opacity: 0.8;
}

.recipe-description {
    color: #555;
    font-size: 0.9rem;
    margin: 0.75rem 0;
}

.recipe-missing {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.5rem;
}

.missing-label {
    font-size: 0.85rem;
    color: #888;
}

.missing-item {
    background: #fff3cd;
    color: #856404;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.recipe-details {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
}

.recipe-type {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.recipe-optional {
    font-size: 0.85rem;
}

.optional-group {
    margin: 0.25rem 0;
    color: #555;
}

.optional-role {
    color: #888;
    text-transform: capitalize;
    margin-right: 0.5rem;
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.empty-state h3 {
    color: #2c5530;
}

/* Recipe actions (favorite + score) */
.recipe-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.favorite-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #ccc;
    transition: color 0.2s, transform 0.2s;
    padding: 0.25rem;
    line-height: 1;
}

.favorite-btn:hover {
    color: #f4a62a;
    transform: scale(1.1);
}

.favorite-btn.active {
    color: #f4a62a;
}

/* Tab count badges */
.tab-count {
    background: rgba(255,255,255,0.2);
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

.recipes-tab.active .tab-count {
    background: rgba(44, 85, 48, 0.2);
}

/* Expand/collapse button */
.expand-btn {
    background: none;
    border: none;
    color: #2c5530;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0.5rem 0;
    text-decoration: underline;
    margin-top: 0.5rem;
}

.expand-btn:hover {
    color: #1a3a1c;
}

/* Ingredient tags */
.ingredient-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.ingredient-tag {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.ingredient-tag.required {
    background: #d4edda;
    color: #155724;
}

.ingredient-tag.classic.have {
    background: #cce5ff;
    color: #004085;
}

.ingredient-tag.classic.missing {
    background: #fff3cd;
    color: #856404;
}

/* Recipe required and classic sections */
.recipe-required,
.recipe-classic {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.5rem;
}

.recipe-required .section-label,
.recipe-classic .section-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    min-width: 60px;
}

.recipe-required strong,
.recipe-classic strong {
    font-size: 0.85rem;
    color: #555;
}

/* Required tag with check/missing states */
.ingredient-tag.required.have {
    background: #d4edda;
    color: #155724;
}

.ingredient-tag.required.missing {
    background: #f8d7da;
    color: #721c24;
}

/* Missing items text style */
.missing-items-text {
    font-size: 0.85rem;
    color: #856404;
}

/* Recipe card responsive */
@media (max-width: 480px) {
    .recipe-header {
        flex-direction: column;
        gap: 0.75rem;
    }

    .recipe-actions {
        align-self: flex-start;
    }

    .recipe-score {
        align-self: flex-start;
    }
}

/* ============================================
   Algorithm Tuning Panel
   ============================================ */

.tuning-panel {
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.tuning-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.tuning-header:hover {
    background-color: #eee;
}

.tuning-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #333;
}

.tuning-icon {
    font-size: 1.2rem;
    color: #2c5530;
}

.tuning-summary {
    display: flex;
    align-items: center;
    gap: 12px;
}

.weight-summary {
    font-size: 0.8rem;
    color: #666;
    background: #e0e0e0;
    padding: 4px 10px;
    border-radius: 12px;
}

.collapse-indicator {
    color: #888;
    font-size: 0.9rem;
}

.tuning-content {
    padding: 16px;
    border-top: 1px solid #ddd;
    background: white;
}

.tuning-hint {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 16px;
}

.slider-group {
    margin-bottom: 20px;
}

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

.slider-header label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
}

.slider-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2c5530;
    background: #e8f5e9;
    padding: 2px 8px;
    border-radius: 4px;
}

.weight-slider {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: #ddd;
    border-radius: 4px;
    outline: none;
}

.weight-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #2c5530;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
}

.weight-slider::-webkit-slider-thumb:hover {
    background: #1e3d22;
}

.weight-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #2c5530;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #888;
    margin-top: 4px;
}

.tuning-actions {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #eee;
}

.tuning-actions button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   Nutrition Edit Modal
   ============================================ */

.nutrition-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.nutrition-modal {
    background: white;
    border-radius: 8px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.nutrition-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
}

.nutrition-modal-header h3 {
    margin: 0;
    color: #2c5530;
    font-size: 1.2rem;
}

.nutrition-modal-subheader {
    padding: 10px 20px;
    background-color: #f5f5f5;
    border-bottom: 1px solid #eee;
}

.nutrition-modal-subheader .item-name {
    font-weight: 600;
    color: #333;
}

.nutrition-modal-subheader .item-alias,
.nutrition-modal-subheader .item-type {
    margin-left: 8px;
    color: #666;
    font-style: italic;
}

.fallback-notice {
    margin: 15px 20px;
    padding: 10px 15px;
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #856404;
}

.nutrition-modal-content {
    padding: 20px;
}

.serving-row {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.serving-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.nutrition-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.nutrition-grid .form-group {
    margin-bottom: 0;
}

.nutrition-grid .form-group label {
    font-size: 0.8rem;
    margin-bottom: 4px;
}

.nutrition-grid .form-group input {
    padding: 8px 10px;
    font-size: 0.9rem;
}

.nutrition-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid #eee;
    background-color: #f9f9f9;
}

/* Edit Nutrition Button */
.btn-edit-nutrition {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    font-size: 0.8rem;
    background-color: #e8f5e9;
    color: #2c5530;
    border: 1px solid #c8e6c9;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-edit-nutrition:hover {
    background-color: #c8e6c9;
    border-color: #a5d6a7;
}

/* Alias Selector */
.alias-selector {
    margin-top: 10px;
}

.alias-selector label {
    display: block;
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 5px;
}

.alias-selector select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.alias-selector select:focus {
    outline: none;
    border-color: #2c5530;
}

/* Type Selector (alias renamed to type) */
.type-selector {
    margin: 15px 20px;
    padding: 10px 15px;
    background-color: #f5f5f5;
    border-radius: 6px;
}

.type-selector label {
    display: inline-block;
    font-size: 0.85rem;
    color: #555;
    margin-right: 10px;
    font-weight: 500;
}

.type-selector select {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    background-color: white;
}

.type-selector select:focus {
    outline: none;
    border-color: #2c5530;
}

/* Item Type Badge in Inventory List */
.item-type-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 500;
    background-color: #e3f2fd;
    color: #1565c0;
    border-radius: 10px;
    vertical-align: middle;
}

/* Type selector in Add Item Form */
.type-select {
    min-width: 120px;
}

.type-select select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* Item types display in cards */
.item-types,
.item-types-full {
    font-size: 0.8rem;
    color: #666;
    margin-top: 4px;
}

.item-types-full {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

/* List mode type display */
.from-list-item-type {
    display: inline-block;
    font-size: 0.7rem;
    color: #888;
    background-color: #f0f0f0;
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 4px;
}

/* List mode type selector panel */
.list-type-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background-color: #e8f5e9;
    border-radius: 4px;
    margin-bottom: 10px;
}

.list-type-selector label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #333;
}

.list-type-selector select {
    flex: 1;
    padding: 6px 12px;
    border: 1px solid #c8e6c9;
    border-radius: 4px;
    font-size: 0.9rem;
}

.list-type-selector .btn {
    white-space: nowrap;
}

/* Warning message style */
.message-warning {
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    padding: 10px 15px;
    margin: 10px 20px;
    border-radius: 4px;
    font-size: 0.85rem;
}

/* Nutrition Preview in Add Item */
.nutrition-preview {
    margin-top: 15px;
    padding: 15px;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 6px;
}

.nutrition-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.nutrition-preview-header h4 {
    margin: 0;
    font-size: 0.95rem;
    color: #333;
}

.nutrition-preview-content {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    font-size: 0.85rem;
}

.nutrition-preview-item {
    display: flex;
    justify-content: space-between;
}

.nutrition-preview-item .label {
    color: #666;
}

.nutrition-preview-item .value {
    font-weight: 500;
    color: #333;
}

.nutrition-fallback-note {
    margin: 10px 0;
    padding: 8px 12px;
    background-color: #fff3cd;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #856404;
}

/* Nutrition actions in expanded card */
.nutrition-actions {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    text-align: center;
}

/* Responsive */
@media (max-width: 500px) {
    .nutrition-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .serving-row {
        flex-direction: column;
    }

    .nutrition-preview-content {
        grid-template-columns: repeat(2, 1fr);
    }
}
