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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 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: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    padding: 30px;
    text-align: center;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

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

.ai-badge {
    background: rgba(255,255,255,0.2);
    padding: 8px 16px;
    border-radius: 20px;
    margin-top: 15px;
    display: inline-block;
    font-size: 14px;
    font-weight: 600;
}

.content {
    padding: 30px;
}

.ai-status {
    background: #e8f5e8;
    border: 1px solid #4caf50;
    color: #2e7d32;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-status.offline {
    background: #fff3e0;
    border-color: #ff9800;
    color: #f57c00;
}

.search-section {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
}

.search-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-group {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.input-wrapper {
    flex: 1;
    min-width: 200px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

input[type="text"], input[type="number"], select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
}

input[type="text"]:focus, input[type="number"]:focus, select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 10px;
    margin-bottom: 10px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-ai {
    background: linear-gradient(135deg, #ff9a9e, #fecfef);
    color: #333;
}

.btn-secondary {
    background: linear-gradient(135deg, #ffecd2, #fcb69f);
    color: #333;
}

.category-filter {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.category-btn {
    background: #e3f2fd;
    border: 1px solid #2196f3;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-btn.active {
    background: #2196f3;
    color: white;
}

.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.recipe-card {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.recipe-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    border-color: #667eea;
}

.recipe-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 16px;
}

.recipe-info {
    color: #666;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.recipe-category {
    background: #667eea;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    margin-left: auto;
}

.ai-suggestions {
    background: linear-gradient(135deg, #fff5f5, #ffe0e6);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
    border: 1px solid #fbb6ce;
}

.results {
    margin-top: 30px;
}

.result-card {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
    border-left: 5px solid #667eea;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.result-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
}

.result-info {
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: #666;
}

.category-section {
    margin-bottom: 25px;
}

.category-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-weight: 600;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ingredient-list {
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.ingredient-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

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

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

.ingredient-amount {
    color: #667eea;
    font-weight: 600;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
    display: none;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

.error-message {
    background: #fff5f5;
    border: 1px solid #fed7d7;
    color: #c53030;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
}

.success-message {
    background: #f0fff4;
    border: 1px solid #9ae6b4;
    color: #22543d;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: #667eea;
}

.stat-label {
    color: #666;
    font-size: 14px;
    margin-top: 5px;
}

@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .container {
        width: 100vw;
        max-width: 100vw;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
    }
    
    .header {
        padding: 20px;
    }
    
    .header h1 {
        font-size: 1.4rem;
    }
    
    .content {
        padding: 15px;
    }

    .search-section {
        padding: 15px;
        border-radius: 0;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .recipe-grid {
        grid-template-columns: 1fr;
    }

    .btn,
    .btn-ai,
    .btn-secondary {
        width: 100%;
        margin-right: 0;
        margin-bottom: 10px;
        box-sizing: border-box;
    }

    .category-filter {
        flex-direction: column;
        gap: 10px;
    }

    .category-btn {
        width: 100%;
        box-sizing: border-box;
    }
}