/* Modern Food Explorer UI */
:root {
    --primary-color: #5b68d6;
    --primary-hover: #4751b6;
    --secondary-color: #ff6b6b;
    --text-color: #333333;
    --text-light: #666666;
    --text-lighter: #999999;
    --bg-color: #f8f9fd;
    --card-bg: #ffffff;
    --border-color: #e0e0e0;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.08);
    --success-color: #4caf50;
    --warning-color: #ff9800;
    --error-color: #f44336;
    --heart-color: #ff6b6b;
    --sidebar-width: 260px;
    --header-height: 80px;
    --border-radius: 12px;
    --card-radius: 16px;
    --transition: all 0.3s ease;
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-color);
    font-weight: 600;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    font-size: inherit;
    transition: var(--transition);
}

button:focus {
    outline: none;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* App Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--card-bg);
    box-shadow: var(--shadow-md);
    padding: 24px 0;
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 32px;
}

/* Sidebar Styles */
.logo {
    display: flex;
    align-items: center;
    padding: 0 24px;
    margin-bottom: 32px;
}

.logo i {
    font-size: 24px;
    color: var(--primary-color);
    margin-right: 12px;
}

.logo h2 {
    color: var(--primary-color);
    font-weight: 700;
}

nav {
    margin-bottom: 24px;
}

nav a {
    display: flex;
    align-items: center;
    padding: 14px 24px;
    color: var(--text-light);
    text-decoration: none;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

nav a i {
    margin-right: 12px;
    font-size: 18px;
}

nav a:hover {
    background-color: rgba(91, 104, 214, 0.06);
    color: var(--primary-color);
}

nav a.active {
    background-color: rgba(91, 104, 214, 0.1);
    color: var(--primary-color);
    border-left: 3px solid var(--primary-color);
    font-weight: 600;
}

/* Favorites Panel */
.favorites-panel {
    padding: 0 24px;
    margin-bottom: 24px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.favorites-panel h3 {
    font-size: 16px;
    margin-bottom: 16px;
    color: var(--text-color);
    font-weight: 600;
}

.favorites-list {
    list-style: none;
    max-height: 500px;
    overflow-y: auto;
}

.favorites-list .placeholder {
    color: var(--text-lighter);
    font-style: italic;
    padding: 8px 0;
}

.favorite-item {
    display: flex;
    flex-direction: column;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.favorite-item:hover {
    background-color: rgba(91, 104, 214, 0.05);
}

.favorite-item:last-child {
    border-bottom: none;
}

.favorite-name {
    font-weight: 500;
    margin-bottom: 4px;
}

.favorite-country {
    font-size: 12px;
    color: var(--text-lighter);
}

.view-all-favorites {
    text-align: center;
    padding: 10px 0;
    margin-top: 10px;
    color: var(--primary-color);
    font-weight: 500;
    cursor: pointer;
    border-top: 1px solid var(--border-color);
}

.view-all-favorites:hover {
    background-color: rgba(91, 104, 214, 0.05);
}

/* Header Styles */
header {
    margin-bottom: 32px;
}

header h1 {
    font-size: 28px;
    margin-bottom: 8px;
}

header p {
    color: var(--text-light);
    font-size: 16px;
}

/* Search Section */
.search-section {
    background-color: var(--card-bg);
    border-radius: var(--card-radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 32px;
}

.search-container {
    display: flex;
    flex-direction: column;
}

.search-tabs {
    display: flex;
    margin-bottom: 16px;
    background-color: var(--bg-color);
    border-radius: calc(var(--border-radius) - 4px);
    padding: 4px;
}

.search-tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    border-radius: calc(var(--border-radius) - 4px);
    font-weight: 500;
    transition: var(--transition);
}

.search-tab.active {
    background-color: var(--primary-color);
    color: white;
}

.input-group {
    display: flex;
    align-items: center;
    background-color: var(--bg-color);
    border-radius: calc(var(--border-radius) - 4px);
    padding: 4px 4px 4px 16px;
    border: 1px solid var(--border-color);
}

.input-group i {
    color: var(--text-lighter);
    margin-right: 8px;
}

.input-group input {
    flex: 1;
    border: none;
    padding: 12px 0;
    font-size: 16px;
    background: transparent;
}

.input-group input:focus {
    outline: none;
}

.input-group button {
    background-color: var(--primary-color);
    color: white;
    padding: 12px 24px;
    border-radius: calc(var(--border-radius) - 4px);
    font-weight: 600;
}

.input-group button:hover {
    background-color: var(--primary-hover);
}

.popular-countries,
.popular-ingredients,
.popular-foods {
    display: flex;
    align-items: center;
    margin-top: 16px;
}

.popular-countries span,
.popular-ingredients span,
.popular-foods span {
    color: var(--text-lighter);
    margin-right: 12px;
    font-size: 14px;
}

.country-pill,
.ingredient-pill,
.food-pill {
    background-color: rgba(91, 104, 214, 0.1);
    color: var(--primary-color);
    padding: 6px 14px;
    border-radius: 20px;
    margin-right: 8px;
    font-size: 14px;
    transition: var(--transition);
}

.country-pill:hover,
.ingredient-pill:hover,
.food-pill:hover {
    background-color: rgba(91, 104, 214, 0.2);
}

/* Favorites Controls */
.favorites-controls {
    background-color: var(--card-bg);
    border-radius: var(--card-radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 32px;
}

.filter-controls {
    display: flex;
    margin-top: 16px;
    gap: 16px;
}

.filter-controls label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.filter-controls input[type="checkbox"] {
    margin-right: 8px;
}

/* Results Section */
.results-section, .favorites-content {
    background-color: var(--card-bg);
    border-radius: var(--card-radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 32px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.actions {
    display: flex;
    align-items: center;
}

#results-count {
    color: var(--text-lighter);
    font-size: 14px;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    min-height: 200px;
}

.placeholder-message {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
    color: var(--text-lighter);
    text-align: center;
}

.placeholder-message i {
    font-size: 48px;
    margin-bottom: 16px;
    color: rgba(91, 104, 214, 0.2);
}

/* Country Headers */
.country-header {
    grid-column: 1 / -1;
    margin: 16px 0;
    display: flex;
    align-items: center;
}

.country-header h2 {
    font-size: 20px;
}

.country-food-count {
    font-size: 14px;
    color: var(--text-lighter);
    font-weight: normal;
    margin-left: 8px;
}

/* Food Cards */
.food-card {
    background-color: var(--bg-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.food-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.food-card.highlight {
    animation: highlight-card 2s;
}

@keyframes highlight-card {
    0% { transform: translateY(-4px); box-shadow: 0 0 0 4px var(--heart-color); }
    50% { transform: translateY(-4px); box-shadow: 0 0 0 4px var(--heart-color); }
    100% { transform: translateY(-4px); box-shadow: var(--shadow-md); }
}

.food-card-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.food-name {
    font-size: 18px;
    margin-bottom: 4px;
}

.food-country {
    display: inline-block;
    background-color: rgba(91, 104, 214, 0.1);
    color: var(--primary-color);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.food-card-content {
    padding: 16px;
}

.food-description {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.food-ingredients {
    margin-bottom: 16px;
}

.food-ingredients h4 {
    font-size: 14px;
    margin-bottom: 4px;
    color: var(--text-color);
}

.ingredients-list {
    font-size: 13px;
    color: var(--text-light);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    background-color: #f5f7fa;
    padding: 8px;
    border-radius: 4px;
    line-height: 1.5;
}

.nutritional-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.nutrition-item {
    font-size: 13px;
    display: flex;
    align-items: center;
}

.nutrition-item .label {
    color: var(--text-lighter);
    margin-right: 4px;
}

.nutrition-item .value {
    font-weight: 600;
    color: var(--text-color);
}

.vegetarian-item {
    color: var(--success-color);
}

.vegetarian-item i {
    margin-right: 4px;
}

.vegetarian-no {
    color: var(--text-light);
}

.food-card-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.health-score {
    display: flex;
    align-items: center;
}

.score-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #e6f7e7;
    margin-right: 8px;
}

.score-value {
    font-weight: 700;
    font-size: 16px;
    color: var(--success-color);
}

.score-label {
    font-size: 11px;
    color: var(--text-lighter);
    line-height: 1.2;
}

.favorite-btn, .remove-favorite-btn {
    padding: 8px 16px;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
}

.favorite-btn {
    background-color: #fff0f0;
    color: var(--heart-color);
    border: 1px solid var(--heart-color);
}

.favorite-btn:hover {
    background-color: var(--heart-color);
    color: white;
}

.favorite-btn i {
    margin-right: 6px;
}

.favorite-btn.in-favorites {
    background-color: var(--heart-color);
    color: white;
}

.remove-favorite-btn {
    background-color: #fdeaea;
    color: var(--error-color);
    border: 1px solid var(--error-color);
}

.remove-favorite-btn:hover {
    background-color: var(--error-color);
    color: white;
}

.remove-favorite-btn i {
    margin-right: 6px;
}

/* Toast notifications */
#toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1000;
}

.toast {
    min-width: 280px;
    padding: 16px;
    border-radius: var(--border-radius);
    background-color: var(--card-bg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    animation: slide-in 0.3s ease, fade-out 0.3s 3s forwards;
}

.toast.success {
    border-left: 4px solid var(--success-color);
}

.toast.error {
    border-left: 4px solid var(--error-color);
}

.toast.warning {
    border-left: 4px solid var(--warning-color);
}

.toast-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
}

.toast.success .toast-icon {
    background-color: #e6f7e7;
    color: var(--success-color);
}

.toast.error .toast-icon {
    background-color: #fdeaea;
    color: var(--error-color);
}

.toast.warning .toast-icon {
    background-color: #fff8e1;
    color: var(--warning-color);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.toast-message {
    font-size: 14px;
    color: var(--text-light);
}

.toast-close {
    color: var(--text-lighter);
    cursor: pointer;
    margin-left: 12px;
}

@keyframes slide-in {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .results-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

@media (max-width: 992px) {
    .sidebar {
        width: 80px;
        overflow: hidden;
    }
    
    .sidebar .logo h2,
    .sidebar nav a span,
    .sidebar .favorites-panel h3,
    .sidebar .favorites-panel .favorite-country,
    .sidebar .view-all-favorites {
        display: none;
    }
    
    .sidebar nav a {
        justify-content: center;
        padding: 16px;
    }
    
    .sidebar nav a i {
        margin-right: 0;
        font-size: 20px;
    }
    
    .sidebar .logo {
        justify-content: center;
        padding: 0;
    }
    
    .sidebar .logo i {
        margin-right: 0;
    }
    
    .favorite-item {
        padding: 10px 0;
        align-items: center;
    }
    
    .content {
        margin-left: 80px;
    }
}

@media (max-width: 768px) {
    .content {
        padding: 16px;
    }
    
    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .actions {
        width: 100%;
        margin-top: 16px;
    }
    
    .search-tabs {
        flex-direction: column;
    }
    
    .search-tab {
        margin-bottom: 8px;
    }
    
    .input-group {
        flex-direction: column;
        padding: 8px;
    }
    
    .input-group i {
        display: none;
    }
    
    .input-group input {
        width: 100%;
        padding: 8px;
        margin-bottom: 8px;
    }
    
    .input-group button {
        width: 100%;
    }
    
    .popular-countries,
    .popular-ingredients,
    .popular-foods {
        flex-wrap: wrap;
    }
    
    .country-pill,
    .ingredient-pill,
    .food-pill {
        margin-bottom: 8px;
    }
    
    .filter-controls {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 576px) {
    .results-grid {
        grid-template-columns: 1fr;
    }
}